2.0.0 CLI develop - #137
Conversation
* Tighten test coverage and remove low-value cases Highlights: - Remove low-value tests for less_server unknown calls/casts, plugin missing-module/empty-sheet paths, duplicate formatter checks, and fake dist-node list checks - Replace direct plugin manager/render-worker checks with integration-style coverage through observer_cli_plugin:start/1 - Stop the plugin render worker before deleting ETS state during quit/restart paths to avoid stale-worker races - Strengthen plugin sheet/header and formatter fallback assertions Validation: - rebar3 fmt - git diff --check - rebar3 fmt --check - rebar3 compile - rebar3 as ci compile - rebar3 eunit: 257 tests, 0 failures - rebar3 as test eunit: 257 tests, 0 failures - rebar3 xref - rebar3 dialyzer * Prepare observer_cli internals for 2.0 guardrails Change highlights: - Separate command, collection, and rendering seams across Home, Application, ETS, Mnesia, Network, System, Process detail, Port detail, and escript startup paths. - Add behavior-focused tests for startup, shared navigation, plugin routing, formatter fallback, escript remote handling, page rendering fragments, and collection seams. - Harden empty Plugin manager input handling so page, interval, numeric jump, and default jump inputs no-op instead of crashing when no plugin is configured. - Keep the change internal: no new dependency, no generic TUI framework, no public snapshot CLI, and no plugin API break in this slice. Verification: - Ran `rebar3 fmt`. - Ran `rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test`: 32 tests, 0 failures. - Ran `git diff --check`. - Ran `rebar3 eunit`: 311 tests, 0 failures. - Ran `epmd -daemon && rebar3 as test do eunit, covertool generate`: 311 tests, 0 failures; total coverage 96.9%. - Ran `rebar3 compile`, `rebar3 xref`, `rebar3 as ci compile`, and `rebar3 check` successfully. * Record 2.0 refactor baseline 改动重点: - Add the issue #133 Phase 0 baseline evidence file with current validation commands, coverage, public entry points, compatibility boundaries, and explicit non-goals. - Keep the slice documentation-only and scoped to ignored .agents evidence. 验证: - gh issue view 133 --json number,title,state,updatedAt,body confirmed the source issue state. - epmd -daemon && rebar3 as test do eunit, covertool generate passed with 311 tests, 0 failures, and 96.9% line coverage. - rebar3 check passed. - git diff --cached --check and scope review passed; manual terminal QA was skipped because this slice only records baseline evidence. * Inventory public observer_cli entry points 改动重点: - Add a scoped public-entry inventory under .agents for normal/local/remote/escript/plugin startup, formatter configuration, and major interactive commands. - Keep the slice documentation-only, with no runtime behavior, plugin API, formatter, or command changes. 验证: - gh issue view 133 --repo zhongwencool/observer_cli --json number,title,state,updatedAt,body,comments confirmed the source issue state. - rebar3 as test eunit --module=observer_cli_start_test,observer_cli_lib_test,observer_cli_process_test,observer_cli_port_test,observer_cli_plugin_test,observer_cli_escriptize_test passed with 176 tests and 0 failures. - git diff --cached --check and scope review passed before commit. * Add startup smoke behavior guardrails 改动重点: - Add a Phase 0 smoke EUnit that drives observer_cli:start/1 through startup quit, top-menu page switches, interval changes, pagination, and direct process-pid jump input. - Record checklist item 3 evidence in .agents/observer-cli-2-refactor/SMOKE_BEHAVIOR_TESTS.md; keep the process-jump case isolated so linked render-worker shutdown does not cancel EUnit. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_start_test: 12 tests, 0 failures. - Ran rebar3 eunit: 312 tests, 0 failures; the existing observer_cli_process:render_state/3 timeout warning remained non-fatal. - Ran git diff --check and git diff --cached --check. * Add golden output guard helpers 改动重点: - Added observer_cli_test_io helpers for stable plain-text fragment checks and ANSI boundary checks without asserting volatile runtime values. - Added observer_cli_golden_test as the deterministic base test for those helpers and recorded Phase 0 item 4 evidence under .agents. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_golden_test: 2 tests, 0 failures. - Ran rebar3 eunit: 314 tests, 0 failures. - Ran git diff --check and rebar3 check. * Add Home golden output coverage 改动重点: - Add a Home golden-output test covering menu labels, footer commands, top-n title fragments, and wide summary fragments. - Reuse the Home footer rendering path in tests and keep border padding before trailing reset/border suffixes so ANSI boundary checks catch stale redraw artifacts. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_golden_test. - Ran rebar3 as test eunit --module=observer_cli_golden_test,observer_cli_core_test,observer_cli_lib_test. - Ran git diff --check, rebar3 eunit, and rebar3 check. * Add System golden output coverage 改动重点: - Add a deterministic System golden output test covering section titles, grouping fragments, ANSI boundaries, and wide terminal value-column growth. - Record checklist item 6 evidence and validation in the golden output test notes without changing runtime CLI behavior. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_system_test with 24 tests and 0 failures. - Ran rebar3 as test eunit --module=observer_cli_golden_test,observer_cli_system_test with 27 tests and 0 failures. - Ran git diff --check, rebar3 eunit with 316 tests and 0 failures, and rebar3 check. * Add Process and Port detail golden guards 改动重点: - Add stable golden fragment assertions for Process and Port detail titles, footers, link and monitor sections, and dead-object messages. - Extend the test IO helper with captured output support and expose the existing dead-view renderers only under TEST so runtime CLI behavior is unchanged. - Record item 7 evidence in the Phase 0 golden-output notes. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_process_test,observer_cli_port_test,observer_cli_golden_test; 86 tests passed. - Ran git diff --check. - Ran rebar3 eunit; 320 tests passed. - Ran rebar3 check. * Add plugin behavior guardrail tests 改动重点: - Strengthen plugin config assertions and multi-plugin shortcut coverage without changing runtime code. - Add sheet sort-order and row drill-down assertions using existing plugin test fixtures and record Goal 08 evidence. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test (33 tests, 0 failures). - Ran git diff --check, rebar3 eunit (321 tests, 0 failures), and rebar3 check. * Add escript remote startup guard tests 改动重点: - Extend observer_cli_escriptize tests for invalid escript argument counts and interval parse failures. - Add a usage-path guard proving invalid escript args do not invoke the runner. - Strengthen remote_load peer coverage by asserting observer_cli application env is copied to the remote node. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_escriptize_test,observer_cli_start_test (48 tests, 0 failures). - Ran git diff --check. - Ran rebar3 eunit (322 tests, 0 failures; existing render_state timeout warning observed). * Record Goal 10 validation coverage 改动重点: - Add scoped Goal 10 evidence documenting the full validation refresh and current covertool results. - Record that total coverage and all key modules meet the 95% threshold without adding runtime code or broader refactor changes. 验证: - Ran git diff --check, rebar3 fmt, rebar3 compile, rebar3 eunit, rebar3 xref, rebar3 as ci compile, rebar3 check, and epmd -daemon && rebar3 as test do eunit, covertool generate. * Extract shared command parsing boundary 改动重点: - Move shared pure command parsing into observer_cli_command:parse_shared/1 and keep observer_cli_lib:parse_cmd/3 as the IO/routing boundary. - Route Process, Port, and Plugin numeric fallback parsing through observer_cli_command:parse_integer/1 without changing action names or return values. - Record Goal 11 evidence and refresh the public command inventory references. 验证: - Ran rebar3 fmt, git diff --check, rebar3 compile, rebar3 as ci compile, rebar3 eunit, and rebar3 check. - Ran rebar3 as test eunit --module=observer_cli_lib_test,observer_cli_process_test,observer_cli_port_test,observer_cli_plugin_test (134 tests, 0 failures). - Full rebar3 eunit passed with 322 tests, 0 failures; existing non-fatal observer_cli_process:render_state/3 timeout warning observed. * Cover Home command parsing cases 改动重点: - Add explicit Home parser assertions for proc_count sort commands, proc_window commands, default and numeric jumps, scheduler toggle, PID jumps, malformed PID input, and unknown input. - Record Goal 12 evidence under .agents without changing parser return values, CLI behavior, or plugin API behavior. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_lib_test with 27 tests and 0 failures. - Ran git diff --check. - Ran rebar3 eunit with 324 tests and 0 failures; observed the existing non-fatal observer_cli_process:render_state/3 timeout warning. - Ran rebar3 check. * Cover list-page command parsing 改动重点: - Add shared parser assertions for Network, ETS/Mnesia, and Application sorting, pagination aliases, hide, interval, and quit inputs. - Record Goal 13 evidence with validation results and the manual-QA skip reason. 验证: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_lib_test - git diff --check - rebar3 eunit - rebar3 check * Cover detail command parsing 改动重点: - Add Process parser assertions for back, home, subview, interval, jump, unknown input, and quit commands. - Add less-client navigation coverage for real Home and Back keys and Port parser coverage for jump, interval, unknown input, and terminal-error quit handling. - Make Port command parsing return quit on terminal input errors instead of falling through to numeric parsing. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_process_test,observer_cli_port_test,less_client_test with 100 tests and 0 failures. - Ran git diff --check, rebar3 eunit with 328 tests and 0 failures, and rebar3 check. * Remove duplicate command parser branches 改动重点: - Collapse equivalent shared command aliases for quit, pagination, and PID jump prefixes into guarded branches without changing parser return values. - Collapse Process and Port q/Q quit aliases into guarded branches and record Goal 15 validation evidence. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_lib_test,observer_cli_process_test,observer_cli_port_test before and after deletion with 113 tests and 0 failures each. - Ran git diff --check, rebar3 eunit with 328 tests and 0 failures, and rebar3 check. * Consolidate rendering helper names 改动重点: - Add intent-revealing ANSI, selected menu item, top-menu, menu-header, and footer helpers while keeping shared legacy wrappers for compatibility. - Move Home, list pages, Process, Port, Plugin, Help, and less footer call sites to the new helper names without changing rendered text or command behavior. - Record Goal 16 evidence under .agents with validation results and the unused-wrapper adjustment. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_lib_test,observer_cli_golden_test,observer_cli_system_test,observer_cli_process_test,observer_cli_port_test,observer_cli_plugin_test,less_client_test with 183 tests and 0 failures. - Ran git diff --check and git diff --cached --check. - Ran rebar3 check. - Ran rebar3 eunit with 328 tests and 0 failures. * Centralize width helper boundaries 改动重点: - Add observer_cli_lib:layout_base_width/0 and layout_extra_width/1,2 so base and extra width math share the existing rendering helper boundary. - Route Home, plugin fallback, Process/Port, and menu title width formulas through the shared boundary without changing rendered widths. - Record Goal 17 evidence under .agents/observer-cli-2-refactor/GOAL_17_WIDTH_HELPERS.md. 验证: - Ran rebar3 fmt; focused EUnit for lib/core/process/port/plugin-render/golden modules (151 tests, 0 failures); git diff --check; rebar3 check; rebar3 eunit (328 tests, 0 failures). - Did not rerun manual terminal QA because this slice only moves existing width calculations behind helper functions. * Add width helper boundary tests 改动重点: - Expand observer_cli_lib width-helper tests for narrow, exact-base, anti-auto-wrap, and wide terminal boundaries. - Cover weighted wide-width distribution plus padded bordered lines containing Unicode and ANSI-colored content. - Record goal 18 evidence under the 2.0 refactor agent notes without touching prerequisite checklist items. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_lib_test: 31 tests, 0 failures. - Ran git diff --check. - Ran rebar3 check. - Ran rebar3 eunit: 329 tests, 0 failures; existing non-fatal render_state timeout warning still appeared. * Refactor Home summary rendering 改动重点: - Split Home System and memory/process summary rendering into stable row/cell block construction followed by one shared Home summary renderer. - Preserved existing grouping, widths, ANSI styles, warning-color cells, unsupported atom-count fallback text, and left Home top-n rendering untouched. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_core_test,observer_cli_golden_test (31 tests, 0 failures), rebar3 check, git diff --check, rebar3 eunit (329 tests, 0 failures), and rebar3 as ci compile. * Refactor Home top-n rendering 改动重点: - Consolidated the Home top-n renderer into one shared spec-driven path for all sort types while preserving each sort's titles, widths, row formats, value conversion, and pid-info lookup keys. - Added Goal 20 evidence and focused regression coverage for type-specific Home top-n headers and row widths. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_core_test,observer_cli_golden_test (32 tests, 0 failures). - Ran git diff --check, rebar3 compile, rebar3 eunit (330 tests, 0 failures), rebar3 check, and rebar3 as ci compile. * Separate System rendering sections 改动重点: - Route the System worker through `render_system_sections/1` so system info, allocator block sizes, distribution nodes, and cache-hit rates are composed through named section helpers. - Preserve the existing section renderers, output order, menu/footer behavior, and user-visible System page fragments. - Add Goal 21 evidence under `.agents/observer-cli-2-refactor/` with the scoped validation record. 验证: - Ran `rebar3 fmt`. - Ran `rebar3 as test eunit --module=observer_cli_system_test` and `rebar3 as test eunit --module=observer_cli_system_test,observer_cli_golden_test`. - Ran `git diff --check`, `rebar3 compile`, `rebar3 eunit`, `rebar3 check`, and `rebar3 as ci compile`. * Refactor Process detail rendering boundaries 改动重点: - Split Process Info rendering into section composition plus local meta, memory, and garbage-collection field helpers without changing labels, ordering, widths, or colors. - Reused the existing links/monitors and reductions/memory renderers through a new Process detail section boundary, and shared the non-State subview menu/body/footer wrapper while leaving the State less-client path unchanged. - Added focused Process tests and a goal evidence file for checklist item 22. 验证: - Ran `rebar3 fmt`. - Ran `rebar3 as test eunit --module=observer_cli_process_test,observer_cli_golden_test` with 60 tests and 0 failures. - Ran `rebar3 check` after fixing the Dialyzer queue-opaque warning surfaced by the new section helper. - Ran `git diff --check`, `rebar3 compile`, `rebar3 eunit` with 333 tests and 0 failures, and `rebar3 as ci compile`. - Manual terminal QA was not rerun because this slice only changes behavior-preserving rendering helper boundaries. * Split port detail rendering boundaries 改动重点: - Add a Port Info section boundary that composes attr/value, link/monitor, socket peer, stats, and options rendering without changing output. - Split attr/value and socket-peer helpers and cover the section composition with a focused regression. - Record Goal 23 evidence under `.agents/observer-cli-2-refactor/`. 验证: - Ran `rebar3 fmt`. - Ran `rebar3 as test eunit --module=observer_cli_port_test,observer_cli_golden_test` with 32 tests and 0 failures. - Ran `git diff --check`, `rebar3 compile`, `rebar3 eunit` with 334 tests and 0 failures, `rebar3 check`, and `rebar3 as ci compile`. * Record golden output rerun 改动重点: - Add Goal 24 evidence documenting the focused golden/stable-fragment EUnit rerun after Phase 2 rendering helper cleanup. - Leave production and test code unchanged; record the covered Home, System, Process, and Port output surfaces plus skipped validation boundaries. 验证: - Ran `rebar3 as test eunit --module=observer_cli_golden_test,observer_cli_core_test,observer_cli_system_test,observer_cli_process_test,observer_cli_port_test` with 143 tests and 0 failures. - Ran `git diff --check --cached` and reviewed the staged scope before committing. * Record data/render boundaries 改动重点: - Add Goal 25 evidence that maps each major page from collected Erlang terms/maps/proplists to the existing TUI render input boundary. - Document that this slice adds no behavior layer, no production-code change, and no user-visible rendering change. 验证: - Ran `rebar3 compile` successfully. - Ran focused EUnit for core page boundary modules with 225 tests and 0 failures. - Ran `git diff --cached --check` successfully. * Separate Home data collection from rendering 改动重点: - Build a Home snapshot in redraw_running/8 that separates runtime summary sampling, process ranking, scheduler row sizing, and TUI rendering without intentional behavior changes. - Split IO/GC diff from scheduler usage diff in node_stats/2 and keep test-only render wrappers under -ifdef(TEST). - Add a focused Home snapshot EUnit assertion and ignored .agents evidence for goal 26. 验证: - rebar3 fmt - git diff --check - rebar3 compile - rebar3 as ci compile - rebar3 as test eunit --module=observer_cli_core_test,observer_cli_golden_test - rebar3 eunit - rebar3 check * Separate System data collection from rendering 改动重点: - Split System collection into OS process metrics, runtime system info, allocator/cache data, and pre-collected distribution-node rows consumed by render sections. - Move distribution queue size and limit lookup out of row rendering while preserving the existing System page output shape and tests. - Record Goal 27 evidence under the refactor notes. 验证: - Ran rebar3 fmt. - Ran rebar3 compile and rebar3 as ci compile. - Ran rebar3 as test eunit --module=observer_cli_system_test, rebar3 eunit, git diff --check, and rebar3 check. * Separate Application data collection from rendering 改动重点: - Move Application row collection into collect_app_render_info/3 so rendering consumes collected sorted and paginated rows. - Keep the existing sublist_top_n_attrs sorting path and sort keys while adding focused coverage for Application row order and pagination. - Record goal 28 evidence under .agents/observer-cli-2-refactor. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_application_test (10 tests, 0 failures). - Ran git diff --check, rebar3 compile, rebar3 as ci compile, rebar3 eunit (336 tests, 0 failures), and rebar3 check. * Separate ETS and Mnesia collection from rendering 改动重点: - Collect ETS and Mnesia sorted/paginated row tuples before rendering while reusing existing collection and observer_cli_lib:sublist/3 paths. - Preserve Mnesia error and hidden-system-table branches, ETS unread handling, and Mnesia storage handling with focused tests and goal evidence. 验证: - Ran rebar3 fmt; rebar3 as test eunit --module=observer_cli_ets_test,observer_cli_mnesia_test; git diff --check; rebar3 compile; rebar3 as ci compile; rebar3 eunit; rebar3 check. * Separate Network collection from rendering 改动重点: - Split Network IO sampling into collected summary terms before rendering while preserving the existing Byte Input/Output and Total Input/Output values. - Collect per-port Network row maps before rendering, preserving count/window mode, selected-row formatting, non-count IO column ordering, and reversed port store entries for drill-down fallback. - Add focused Network seam tests and Goal 30 evidence under `.agents/observer-cli-2-refactor/`. 验证: - `rebar3 fmt` passed. - `rebar3 as test eunit --module=observer_cli_inet_test` passed with 24 tests and 0 failures. - `rebar3 compile`, `git diff --check`, `rebar3 as ci compile`, `rebar3 eunit`, and `rebar3 check` passed. * Normalize Process and Port detail collection terms 改动重点: - Normalize Process garbage-collection data from recon into a map before rendering while preserving the existing dead-process and State recon error paths. - Normalize Port type data from recon into a map for socket peer, stats, and options rendering while preserving missing-field output behavior. - Add focused detail collection/rendering assertions and record Goal 31 validation evidence. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_process_test,observer_cli_port_test,observer_cli_golden_test with 90 tests and 0 failures. - Ran git diff --check, rebar3 compile, rebar3 as ci compile, rebar3 eunit with 344 tests and 0 failures, and rebar3 check. * Add collected data structure tests 改动重点: - Strengthen Home, System, Application, ETS, Mnesia, Network, Process, and Port tests to assert collected term shapes and important seam fields without pinning volatile runtime counters. - Add Goal 32 evidence documenting the test-only scope, preserved CLI behavior, validation commands, skipped manual QA reason, and known baseline warning noise. 验证: - gh issue view 133 --json number,title,updatedAt,body --jq '{number,title,updatedAt,line79:(.body|split("\\n")[78])}' - rebar3 fmt - rebar3 as test eunit --module=observer_cli_core_test,observer_cli_system_test,observer_cli_application_test,observer_cli_ets_test,observer_cli_mnesia_test,observer_cli_inet_test,observer_cli_process_test,observer_cli_port_test - git diff --check - rebar3 eunit - rebar3 as ci compile * Document snapshot seam for machine output 改动重点: - Add Goal 33 evidence documenting that future JSON / term output must consume collected Erlang terms or maps before TUI rendering instead of parsing terminal text. - List the current internal collection/render seams for Home, System, Application, ETS, Mnesia, Network, Process detail, and Port detail, and record this slice's non-goals. 验证: - Confirmed issue #133 line 80 with `gh issue view 133 --json number,title,updatedAt,body --jq '{number,title,updatedAt,line80:(.body|split("\\n")[79])}'`. - Checked documented collector/render names with `rg -n "collect_.*\\(|render_.*snapshot|render_.*info|render_.*rows" src/observer_cli*.erl test/observer_cli*_test.erl`. - Ran `git diff --no-index --check /dev/null .agents/observer-cli-2-refactor/GOAL_33_SNAPSHOT_SEAM.md` and `git diff --cached --check`; skipped rebar3 because this was a docs-only slice with no Erlang source or test changes. * Document manager lifecycle inventory 改动重点: - Add Goal 34 evidence identifying shared start, quit, interval, pagination, timer, and worker-cleanup behavior across current view manager loops. - Record the narrow extraction boundary for the next slice without changing Erlang source or introducing a generic manager framework. 验证: - Verified issue #133 checklist line with gh issue view. - Reviewed manager lifecycle paths with grep over src/observer_cli*.erl and checked the staged docs diff with git diff --cached --check. - Skipped rebar3 because this slice only adds ignored .agents documentation and does not change Erlang source, tests, or runtime behavior. * Extract stable page lifecycle helper 改动重点: - Add observer_cli_lib:next_page/2 for shared page lower-bound updates. - Use the helper in Home, Application, ETS, Mnesia, Network, and Plugin pagination paths without changing cleanup or timer behavior. - Record Goal 35 evidence and keep the scope below a generic view framework. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_lib_test,observer_cli_plugin_test with 58 tests and 0 failures. - Ran git diff --check, rebar3 compile, rebar3 eunit with 346 tests and 0 failures, rebar3 as ci compile, and rebar3 check. * Refactor Home manager actions 改动重点: - Split Home manager command dispatch into local action helpers while preserving the existing cleanup resource for scheduler wall-time restoration. - Kept Home quit and process drill-down behavior explicit, including store cleanup and store-backed row selection semantics. - Added focused coverage for Home process row selection and recorded Goal 36 evidence. 验证: - Ran gh issue view 133 to confirm checklist item 36 and issue updatedAt 2026-07-05T12:39:22Z. - Ran rebar3 fmt; rebar3 as test eunit --module=observer_cli_core_test,observer_cli_start_test; git diff --check; rebar3 compile; rebar3 check; rebar3 eunit; rebar3 as ci compile. * Consolidate Application ETS Mnesia manager restarts 改动重点: - Reuse local cleanup-and-start helpers in Application, ETS, and Mnesia managers for sort, interval, and page actions without changing command behavior. - Move page up/down updates in those managers behind local restart_page helpers while preserving observer_cli_lib:next_page/2 lower-bound behavior. - Record Goal 37 scope, non-goals, and validation evidence under .agents/observer-cli-2-refactor/. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_application_test,observer_cli_ets_test,observer_cli_mnesia_test; 30 tests, 0 failures. - Ran git diff --check, rebar3 compile, rebar3 eunit, rebar3 as ci compile, and rebar3 check; full eunit passed with 347 tests and the existing non-fatal observer_cli_process:render_state/3 timeout warning. * Refactor Network manager restart paths 改动重点: - Consolidate Network mode/type restarts and page restarts through local helpers while preserving inline interval updates and store-backed port drill-down branches. - Record Goal 38 scope, non-goals, and validation evidence under the 2.0 refactor artifacts. 验证: - Ran `rebar3 fmt`, `rebar3 as test eunit --module=observer_cli_inet_test`, `git diff --check`, `rebar3 compile`, `rebar3 eunit`, `rebar3 as ci compile`, and `rebar3 check`. * Refactor Process and Port manager dispatch 改动重点: - Split Port manager action handling from command parsing so Home and Network navigation live in the manager loop without changing command return atoms. - Reused small local Process helpers for Home and Plugin back navigation while keeping state subview switching and worker messages unchanged. - Added Goal 39 evidence with scope, non-goals, validation, and skipped manual QA rationale. 验证: - Ran `gh issue view 133 --repo zhongwencool/observer_cli --json number,title,updatedAt,body --jq ...` to confirm checklist item 39 and issue updatedAt `2026-07-05T12:39:22Z`. - Ran `rebar3 fmt`, `rebar3 as test eunit --module=observer_cli_process_test,observer_cli_port_test`, `git diff --check`, `rebar3 compile`, `rebar3 as ci compile`, `rebar3 eunit`, and `rebar3 check`. - Skipped manual terminal QA because this slice only moves local manager dispatch and stop/start helpers while existing focused navigation tests cover Process/Port Home, Back, Network, interval, and subview paths. * Delete redundant clean forwarding wrappers 改动重点: - Removed `clean/1` exports that only forwarded to `observer_cli_lib:exit_processes/1` from Application, ETS, Help, Network, Mnesia, and System. - Kept Home cleanup routed through `observer_cli:clean/1` so scheduler wall-time restoration remains unchanged while plain top-menu cleanup uses `exit_processes/1` directly. - Added Goal 40 evidence and moved cleanup proof into `observer_cli_lib_test` top-menu cleanup cases. 验证: - Ran `gh issue view 133 --json title,body,updatedAt,url --jq '{title,updatedAt,url,body}'` to confirm checklist item 40. - Ran `rebar3 fmt`, focused EUnit for touched modules, `git diff --check`, `rebar3 compile`, `rebar3 eunit`, `rebar3 as ci compile`, and `rebar3 check`. - Skipped manual terminal QA because this only deletes pure cleanup forwarding wrappers and preserves the same cleanup helper path covered by EUnit. * Record plugin callback usage boundary 改动重点: - Add Goal 41 evidence documenting the current observer_cli plugin callback/config usage without changing runtime code. - List the plugin capabilities that must survive the 2.0 boundary: attributes, sheet header, sheet body, shortcuts, sorting, and row handlers. - Note current public plugin examples and the position-based API seams reserved for the next design slice. 验证: - Confirmed issue #133 and checklist item 41 with `gh issue view 133 --json number,title,updatedAt,body`. - Ran `rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test` with 33 tests and 0 failures. - Ran `git diff --cached --check` before committing. * Design plugin 2.0 callback contract 改动重点: - Add Goal 42 evidence for the smallest plugin 2.0 API break: named callback result maps, column-id sheet rows, sort ids, and explicit row handles. - Keep the slice documentation-only so runtime CLI behavior, public plugin docs, and tests remain unchanged for Goals 43-45. 验证: - Ran `gh issue view 133 --json number,title,updatedAt,body` to confirm the issue item and update timestamp. - Ran `rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test` with 33 tests and 0 failures. - Ran `git diff --no-index --check -- /dev/null .agents/observer-cli-2-refactor/GOAL_42_PLUGIN_2_API_DESIGN.md` and `git diff --cached --check`. * Add plugin compatibility contract tests 改动重点: - Add observer_cli_plugin_compat helpers that normalize 2.0 plugin callback maps, migrate sort_column and handler tuple config, and raise clear plugin_api_error reasons for rejected 1.x shapes. - Add compatibility EUnit coverage for retained config/cell behavior, missing-callback fallback, migrated config keys, invalid columns/sorts, legacy callback returns, and non-pid default handles. - Record Goal 43 scope, compatibility decisions, validation, and skipped terminal QA evidence under .agents. 验证: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test,observer_cli_plugin_compat_test -> 38 tests, 0 failures - rebar3 compile - git diff --check and git diff --cached --check - rebar3 as ci compile - rebar3 eunit -> 352 tests, 0 failures - rebar3 check * Wire plugin rendering to structured 2.0 data 改动重点: - Route plugin attribute, header, body, sorting, and row-selection rendering through the normalized 2.0 map-shaped structures. - Update plugin-focused tests and the local test plugin to cover column-id sorting, explicit row handles, and unchanged plugin page controls. - Record goal 44 scope, behavior decisions, validation, and skipped runtime QA evidence. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test,observer_cli_plugin_compat_test with 38 tests and 0 failures. - Ran rebar3 compile, rebar3 as ci compile, rebar3 eunit with 352 tests and 0 failures, rebar3 check, and git diff --cached --check. * Document plugin 2.0 migration path 改动重点: - Update docs/plugin.md to describe the map-based plugin 2.0 callback contract, column-id sorting, explicit row handles, and new handler configuration. - Add a 1.x-to-2.0 migration guide with old-to-new callback/config mappings and a minimal before/after example. - Record goal 45 scope, documentation decisions, validation, and skipped broad validation evidence. 验证: - Ran gh issue view 133 --json body,updatedAt,title to confirm checklist item 45. - Ran git diff --check and git diff --cached --check. - Ran rebar3 ex_doc and confirmed the generated migration link target in doc/plugin.html. - Ran rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test,observer_cli_plugin_compat_test with 38 tests and 0 failures. * Record plugin validation boundary 改动重点: - Add Goal 46 evidence that records the plugin-focused EUnit run and full EUnit run after the plugin 2.0 API boundary work. - Document that no Erlang source, tests, docs, generated docs, or built-in CLI page behavior changed in this validation-only slice. - Note the known non-fatal render_state timeout warning and the deferred manual terminal QA boundary. 验证: - Ran `gh issue view 133 --json number,title,updatedAt,url,body` to confirm issue #133 checklist item 46. - Ran `rebar3 as test eunit --module=observer_cli_plugin_test,observer_cli_plugin_render_test,observer_cli_plugin_compat_test` with 38 tests and 0 failures. - Ran `rebar3 eunit` with 352 tests and 0 failures. - Ran `git diff --cached --check` before committing. * Document 2.0 module responsibilities 改动重点: - Add a developer documentation page that maps 2.0 entry points, commands, collection, rendering, pagination, plugin, formatter, and snapshot-seam ownership. - Include the new page in ExDoc extras and record Goal 47 validation evidence under `.agents/observer-cli-2-refactor/`. - Keep the slice docs-only with no Erlang source, generated docs, README, changelog, plugin guide, formatter guide, or runtime behavior changes. 验证: - Confirmed issue #133 checklist item 47 with `gh issue view`. - Checked documented module and function names with focused `rg` searches over `src/`. - Ran `git diff --check`, `rebar3 ex_doc`, generated-doc inclusion `rg`, and `git diff --cached --check`. - Skipped EUnit and terminal QA because this docs-only slice changes no Erlang or runtime paths; the skip reason is recorded in the Goal 47 evidence file. * Document 2.0 release notes scope 改动重点: - Add a README 2.0 draft note limited to preserved CLI behavior, plugin API breaking changes, and future AI-friendly snapshots. - Add a docs/CHANGELOG.md 2.0.0 draft entry and goal 48 evidence file. 验证: - Confirmed issue #133 line 104 with gh. - Ran git diff --check, rebar3 ex_doc, generated-doc rg checks, and git diff --cached --check. - Did not run EUnit, compile, xref, covertool, or manual terminal QA because this docs-only slice changed no Erlang runtime paths; goal 49 owns the full validation bundle. * Record goal 49 static validation 改动重点: - Add Goal 49 evidence documenting the requested formatting, compile, CI compile, xref, EUnit, and covertool results. - Record that no source or user-visible CLI behavior changed and that formatting produced no tracked diff. 验证: - Ran rebar3 fmt, rebar3 compile, rebar3 as ci compile, rebar3 xref, rebar3 eunit, and epmd -daemon && rebar3 as test do eunit, covertool generate. - Confirmed EUnit passed with 352 tests and covertool generated observer_cli.covertool.xml with line-rate 0.966. - Ran git diff --check --cached and reviewed git status --short --branch before committing. * Record manual terminal QA evidence 改动重点: - Add Goal 50 evidence for the real PTY sweep of Home, System, Process, Port, Network, ETS, Mnesia, Application, Doc, and empty Plugin state. - Record the exact normal-shell scope and skipped raw/remote/escript validation boundaries for neighboring goals. 验证: - Ran `gh issue view 133 --json number,title,updatedAt,state,body` to confirm checklist item 50 scope. - Ran `stty rows 40 cols 120; rebar3 shell`, then `observer_cli:start().` and manually inspected Home, System, Network, ETS, Mnesia, Application, Doc, empty Plugin, and Process Info in a real PTY. - Ran a dedicated `rebar3 shell` PTY with a live `gen_tcp:listen/2` fixture and `observer_cli_port:start(LS, #view_opts{}).` to inspect Port Info. - Ran `git status --short --branch`, reviewed the staged diff, and ran `git diff --cached --check`. * Verify remote and escript startup 改动重点: - Load dependency application metadata before collecting escript remote-load modules so simulated target nodes receive recon modules such as recon_lib. - Add a focused regression test for unloaded recon metadata and record Goal 51 remote/escript startup evidence under .agents. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_escriptize_test,observer_cli_start_test, which passed 49 tests with only existing deprecated catch warnings. - Ran simulated peer-node remote startup smoke, which returned remote_start_result=quit. - Ran rebar3 escriptize and a piped escript startup smoke against a short-name target node without observer_cli code paths; the remote Home screen rendered and ended with quit without undef or ERROR REPORT output. - Ran git diff --check, rebar3 compile, and rebar3 check. * Record final cleanup review evidence 改动重点: - Add the Goal 52 final diff review evidence file covering the branch diff scope, stale local planning doc cleanup, and the decision to leave split-goal inputs for Goal 53. - Confirm no tracked temporary helper modules, duplicated test fixtures, stale public docs, CLI behavior, or plugin API behavior changed in this slice. 验证: - Ran `gh issue view 133 --json number,title,state,updatedAt,body` to confirm the checklist line. - Ran `git diff --check main...HEAD`, `rebar3 fmt`, `rebar3 xref`, and `rebar3 eunit` with 353 tests and 0 failures. - Ran stale-marker `rg` review and checked `git status --short --branch` before adding evidence. * Record refactor issue closeout 改动重点: - Add Goal 53 closeout evidence for the GitHub follow-up issue and #133 closure. - Keep the repo diff limited to ignored .agents evidence; no CLI code, tests, or user-facing docs changed. 验证: - Verified #134 is open and #133 is closed with gh issue view. - Checked staged scope with git status --short --branch, git diff --cached --stat, and git diff --cached --check. - Did not run rebar3 because this slice changed only closeout evidence. * Remove deprecated catch warnings from tests Changes: - Replace deprecated test-only catch expressions around Mnesia schema cleanup with try/catch blocks. - Convert escriptize error-path assertions to try/catch or ?assertError so expected failures stay explicit without deprecated catch syntax. - Suppress OTP net_address untyped-record noise locally in the system test module, matching the production module boundary. Validation: - Ran rebar3 fmt. - Ran rebar3 ct -c -v and confirmed the reported warnings are gone. - Ran rebar3 as test eunit --module=observer_cli_mnesia_test,observer_cli_escriptize_test,observer_cli_system_test with 70 tests and 0 failures. - Ran rebar3 as ci compile. - Ran rebar3 as test do eunit, cover with 353 tests and 0 failures. - Ran git diff --check. * Use inverse highlight for selected process rows 改动重点: - Replace the selected-row green background with terminal inverse video so row text follows the user's terminal contrast settings. - Keep the existing shared CHOOSE_BG marker aligned with inverse video for other row-selection paths. - Add a focused TopN rendering assertion that selected rows contain inverse video and no longer emit the green background escape. 验证: - Ran `rebar3 fmt --check`. - Ran `rebar3 as test eunit --module=observer_cli_core_test,observer_cli_inet_test,observer_cli_plugin_test` with 81 tests and 0 failures. - Ran `git diff --check`. - Ran `rebar3 compile`. - Did not run live Ghostty visual verification; change is limited to ANSI selection escapes and covered by focused rendering tests. * Raise observer_cli test coverage above 99% Change highlights: - Add integration-leaning EUnit coverage for pager, home/process/app/ets/network/mnesia/plugin worker and manager paths, plugin API validation, Mnesia disc-only tables, and loopback TCP network rendering. - Extend the test IO helper with delayed get_line replies so timer/redraw branches are exercised without changing production code. - Keep runtime source files untouched while aggregate coverage reaches 2139/2160 lines, or 99.027778%. Validation: - Ran rebar3 fmt. - Ran rebar3 eunit: 377 tests, 0 failures. - Ran rebar3 cover: total 99%. - Ran rebar3 covertool generate: line-rate 0.99, 2139/2160 lines. - Ran rebar3 as ci compile. - Ran git diff --check.
Changes: - Collect and render priority, stack size, binary reference summary, catch level, suspending processes, and error handler in process detail. - Keep binary references summarized as count/bytes instead of dumping full reference lists in the live TUI. - Update process detail collection and golden fragment tests for the new fields. Validation: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_process_test. - Ran rebar3 as ci compile. - Ran rebar3 eunit. - Ran rebar3 check.
Key changes: - Collect process, port, atom, ETS, distribution buffer, dirty CPU scheduler, run queue, and loaded module counts for the System page. - Render the new System statistics block as a compact 3-by-3 table without duplicating uptime. - Keep width allocation within the rendered line budget to avoid terminal wrapping artifacts. Validation: - Ran rebar3 as test eunit --module=observer_cli_system_test. - Ran scoped rebar3 fmt --check for src/observer_cli_system.erl and test/observer_cli_system_test.erl. - Ran rebar3 as ci compile. - Full rebar3 eunit is blocked by unrelated dirty port test changes in the worktree.
Key changes: - Add a Ports page routed from the top menu with queue_size and memory sorting plus row jump into port detail. - Collect and render port controls, slot, parallelism, locking, monitored_by, memory, and queue_size while filtering inet ports already covered by Network. - Render port detail inet options from an Observer-style option list and align Ports table headers and rows with shared column widths. Validation: - Ran rebar3 as test eunit --module=observer_cli_port_test; 40 tests, 0 failures. - Ran rebar3 compile; the deprecated catch warning is gone, with unrelated observer_cli.erl warnings still present. - Ran git diff --cached --check. - Did not use whole-tree rebar3 fmt --check as final validation because unrelated unstaged src/observer_cli.erl edits currently fail the formatter check.
改动重点: - Scale the two-column and four-column scheduler usage bars with the existing weighted_widths/2 layout helper instead of fixed 57/22/23 character bars. - Keep the >100 scheduler compact percentage-only view unchanged and preserve padding through the existing pad_rendered/1 path. - Add a regression check that verifies wider terminals increase the rendered scheduler bar content instead of only adding trailing spaces. 验证: - Ran git diff --cached --check. - Ran rebar3 fmt --check. - Ran rebar3 as test eunit --module=observer_cli_core_test. - Ran rebar3 compile.
Change highlights: - Replace the Home memory panel's Port Parallelism (+spp) field with persistent_term:info() count and memory output. - Simplify stable Home system info to only static system fields and update Home rendering tests and golden fragments. - Add docs/observer-2.19-gap-report.md with a source-backed Observer 2.19 parity inventory, missing metrics, and core-scope recommendations. Validation: - Ran rebar3 fmt -c -- src/observer_cli.erl test/observer_cli_core_test.erl test/observer_cli_golden_test.erl. - Ran rebar3 as test eunit --module=observer_cli_core_test,observer_cli_golden_test. - Ran rebar3 compile. - Ran git diff --cached --check after staging all changes.
Changes: - Add a standalone Sockets page for OTP socket API handles, wired through K navigation, shared command parsing, help text, view options, and golden/help/lib tests. - Render general socket counters, activity-first socket rows, socket details, counters, options, addresses, and monitor metadata with readable legend and sort headers. - Use observer_cli_lib:sublist/3 for socket list sorting/pagination, keep visible row selection in observer_cli_store, and widen store specs for socket terms. - Align port selection with the existing optimized render path so large port lists avoid the slower direct top-n path. Validation: - Ran rebar3 fmt. - Ran rebar3 eunit --module=observer_cli_socket_test,observer_cli_lib_test. - Ran rebar3 eunit. - Ran rebar3 as ci compile. - Ran rebar3 xref. - Ran rebar3 check. - Ran git diff --check. - Ran an Erlang smoke check that opened 64 OTP socket handles and confirmed socket_overviews=64.
Enhances distribution node output by adding a Health column with colorized states (ok/warn/down/unknown), clearer queue/percent formatting, and safer handling for disabled or empty distribution states. Updates tests to cover empty/disabled cases, warn threshold behavior, column alignment, and revised wide-layout column expectations.
* docs diagnostics design md * Add command-first diagnostics routing 改动重点: - Add pure routing for every reserved 2.0 verb, legacy and explicit TUI forms, and deterministic option errors. - Probe remote module availability before legacy loading so the TUI starts exactly once on preinstalled and loaded targets. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_escriptize_test,observer_cli_start_test (68 tests, 0 failures). - Ran rebar3 eunit (417 tests, 0 failures). - Ran rebar3 compile and rebar3 as ci compile. - Ran git diff --check and git diff --cached --check. * Add diagnostics response encoding and exit handling 改动重点: - Add the versioned response envelope, stable error classes, text and consultable term encoders, dynamic OTP JSON encoding, one-MiB output enforcement, and terminal-safe dynamic text. - Route new command failures through explicit exit codes 0 through 4 while preserving the legacy TUI return path. 验证: - Ran rebar3 fmt and rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_escriptize_test (58 tests, 0 failures). - Ran rebar3 eunit (424 tests, 0 failures), rebar3 compile, rebar3 as ci compile, and rebar3 xref. - Ran rebar3 escriptize with term and misplaced-global-option subprocess checks, plus git diff --check and git diff --cached --check. * Add ephemeral diagnostics controller handshake 改动重点: - Validate bounded node names, deadlines, and explicit cookie environment or file sources without exposing cookie values. - Start a dynamic hidden outbound-only controller, replace its default cookie with cryptographic randomness before assigning the target cookie, and require the version 1 target capabilities handshake. - Add disposable-node coverage for pre-distributed refusal, random failure ordering, hidden and listener-free state, and missing or incompatible target modules. 验证: - Ran rebar3 fmt and rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_snapshot_test,observer_cli_escriptize_test (67 tests, 0 failures). - Ran disposable short-name and long-name escript probes; both reached the installed handshake and returned the expected command_unavailable result without emitting the cookie. - Ran rebar3 eunit (433 tests, 0 failures), rebar3 compile, rebar3 as ci compile, rebar3 xref, git diff --check, and git diff --cached --check. * Add bounded target diagnostics execution 改动重点: - Run target probes in linked monitored workers with an earlier deadline, max-heap boundary, controller monitoring, stable failure classes, and confirmed cleanup. - Normalize and redact report terms into capped JSON-safe data while preserving required JSON Pointer evidence during bounded item truncation. - Cover timeout, crash, max-heap, invalid UTF-8, field and response caps, evidence pointers, and controller disconnect outcomes. 验证: - Ran rebar3 as test eunit --module=observer_cli_snapshot_test,observer_cli_cli_test (24 tests, 0 failures). - Ran rebar3 eunit (439 tests, 0 failures), rebar3 compile, rebar3 as ci compile, rebar3 xref, rebar3 fmt, git diff --check, and git diff --cached --check. * Deliver scan-free diagnostic snapshots 改动重点: - Capture versioned runtime, resource limit, memory, IO, GC, scheduler, and peer facts without full resource enumeration. - Route redacted snapshot envelopes through local and remote escript execution with partial-report exit precedence. 验证: - Ran the focused snapshot, CLI, and escript EUnit suite with 78 tests and 0 failures. - Ran local and disposable remote snapshot smokes, 444 full EUnit tests, compile, CI compile, xref, format, and diff checks. * Add active diagnostics context commands 改动重点: - Add connect, fresh status, and idempotent disconnect on the shared stateless probe transport. - Store only validated target and cookie-source metadata in bounded safe ETF with strict permissions and atomic replacement. 验证: - Ran rebar3 fmt and the focused CLI/escript EUnit suite with 72 tests and 0 failures, including disposable-node lifecycle probes. - Ran 449 full EUnit tests, rebar3 compile, rebar3 as ci compile, and git diff --check. * Add runtime inspection commands 改动重点: - Expose bounded memory, scheduler wall-time, and public distribution inspection through the shared snapshot protocol. - Validate scheduler duration and deadline coupling, invalidate unsafe measurement windows, and report controller queue capability without private distribution APIs. 验证: - Ran rebar3 fmt and focused snapshot/CLI EUnit checks with 36 tests and 0 failures. - Ran a constrained real scheduler fixture with two normal and one dirty CPU scheduler online. - Ran 454 full EUnit tests, rebar3 compile, rebar3 as ci compile, rebar3 xref, and git diff --check. * Add safe process and application inspection 改动重点: - Add bounded iterator and list process inventories, exact stable Top-N windows, safe detail resolution, and public application attribution. - Enforce inspection option contracts and audit admission, lifecycle, exclusions, baselines, and working-set estimates. 验证: - Pass the focused 117-test EUnit suite and the full 463-test EUnit suite. - Pass admitted and refused 5,050/100,055-process fixtures, formatting, compile, CI compile, xref, and git diff --check. * Add safe ETS and Mnesia inspection 改动重点: - Inspect ETS and local Mnesia metadata with staged admission, raw generation correlation, correct storage units, deterministic Top-N sorting, and lifecycle-safe states. - Validate table command options and cover generation races, distinct Mnesia states, and exact main-table evidence without reading rows. 验证: - Ran the focused ETS, Mnesia, snapshot, and CLI EUnit suite with 72 tests and 0 failures. - Ran disposable 100001-table ETS and 10001-local-table Mnesia admission fixtures. - Ran rebar3 fmt, 471 full EUnit tests, rebar3 compile, rebar3 as ci compile, rebar3 xref, and git diff --check. * Add network Port and Socket inspection 改动重点: - Inspect VM and legacy inet network counters, documented Port metadata, and registry-known Socket counters with bounded Top-N acquisition and raw identity correlation. - Apply fixed total and delta formulas with explicit lifecycle, reset, shape-change, missing-core, optional-sendfile, enumeration, and registry coverage states. - Validate command sort, limit, duration, and timeout contracts without changing existing TUI collectors. 验证: - Ran rebar3 fmt and the focused five-module EUnit suite with 132 tests and 0 failures. - Ran disposable network, Port, and Socket total and bounded-delta fixtures. - Ran rebar3 eunit with 481 tests and 0 failures, rebar3 compile, rebar3 as ci compile, rebar3 xref, and git diff --check. * Compose admitted deep snapshots 改动重点: - Compose process, application, ETS, Mnesia, network, Port, and Socket probes with fixed defaults, shared deadlines and identifiers, observer exclusions, admission evidence, and partial cleanup semantics. - Restrict --deep to snapshot and cover admitted, refused, timed-out, heap-limited, and controller-disconnected captures. 验证: - Ran rebar3 fmt and the focused snapshot and CLI EUnit suite with 51 tests and 0 failures. - Ran rebar3 eunit with 488 tests and 0 failures, rebar3 compile, rebar3 as ci compile, rebar3 xref, and git diff --check. * Add redacted gen_server state shape inspection 改动重点: - Add strict local target admission, bounded target-side value-free state shaping, explicit High-risk copy and late-request warnings, and parser coverage for gen-server-state. - Cover secret redaction, not-found targets, depth, node, and size caps, timeout late execution, callback failure, max-heap cleanup, and default-command exclusion. 验证: - Passed focused 57-test EUnit, full 494-test EUnit with a temporary inetrc for local hostname resolution, rebar3 compile, rebar3 as ci compile, rebar3 xref, formatting, and git diff --check. * Make EPMD handshake test hostname-independent 改动重点: - Query the local EPMD daemon through localhost so the listener-free controller assertion does not depend on machine hostname resolution. - Keep the production handshake unchanged and limit the fix to the existing dynamic controller test. 验证: - Ran rebar3 as test eunit --module=observer_cli_escriptize_test (52 tests, 0 failures). - Ran rebar3 fmt, rebar3 eunit (494 tests, 0 failures), and git diff --check. * Add bounded application supervision inspection 改动重点: - Resolve loaded application supervisor roots through public OTP APIs and report only bounded direct-child metadata with safe identity handling. - Reject arbitrary supervisor and recursion options while documenting non-atomic, O(children), soft-cap, and late-execution boundaries. - Cover static and dynamic supervisors, public outcome shapes, remote and restarting children, ambiguous IDs, scan refusal, redaction, and output caps. 验证: - Passed rebar3 as test eunit --module=observer_cli_snapshot_test,observer_cli_cli_test,observer_cli_application_test (76 tests). - Passed disposable static and dynamic supervisor fixtures within observer_cli_application_test. - Passed rebar3 eunit (499 tests), rebar3 compile, rebar3 as ci compile, rebar3 xref, rebar3 fmt, and git diff --check. * Deliver calibrated quick diagnostics 改动重点: - Add the default two-point diagnose capture with admitted shared process facts, versioned count-to-limit findings, stable reductions context, redacted evidence, and complete or partial semantics. - Route diagnose through the command parser and escript dispatcher with validated exit codes 0, 1, 3, and 4 while preserving existing TUI behavior. 验证: - Ran rebar3 as test eunit --module=observer_cli_diagnostic_test,observer_cli_snapshot_test,observer_cli_cli_test (64 tests, 0 failures). - Ran real escript subprocess coverage for diagnose exits 0, 1, 3, and 4 through observer_cli_escriptize_test. - Ran rebar3 eunit (506 tests, 0 failures), rebar3 compile, rebar3 as ci compile, rebar3 xref, rebar3 fmt, git diff --check, and git diff --cached --check. * Add observation diagnostics modes 改动重点: - Add validated five-point observation, seven-point deep, and one-level application sampling with monotonic targets, gap accounting, bounded trend collection, and independently admitted final binary-holder context. - Publish scheduler pressure only from two consecutive topology-stable low-cost windows, keep uncalibrated growth evidence context-only, and preserve partial-report exit precedence. 验证: - Ran focused diagnostic, snapshot, CLI, and dynamic-supervisor EUnit fixtures; ran constrained-scheduler, sampling-gap, and deep-holder disposable VM fixtures. - Ran rebar3 fmt, rebar3 eunit (511 tests), rebar3 compile, rebar3 as ci compile, rebar3 xref, git diff --check, and final allowed-path, secret, unbounded-acquisition, and forbidden-GC inspections. * Add bounded recon call tracing 改动重点: - Add exact-MFA and local-PID trace admission with bounded count or rate capture, ACK-based draining, and recon 2.5.6 capability gating. - Add owner-aware global stop, conservative emergency cleanup, fixed-name and trace-state verification, and explicit forced-loss reporting. - Add trace CLI validation, target dispatch integration, and lifecycle fixtures for natural, forced, collision, failure, and cleanup paths. 验证: - Ran rebar3 fmt. - Ran focused EUnit on observer_cli_trace_test and observer_cli_cli_test, including a disposable named node. - Ran rebar3 eunit with 524 tests passing. - Ran rebar3 compile, rebar3 as ci compile, rebar3 xref, and git diff --check. * Upgrade rebar3 for OTP 29 CI 改动重点: - Update the OTP 29 CI matrix entry from rebar3 3.26 to 3.27. - Keep older OTP matrix entries unchanged while avoiding the pre-1980 escript timestamp warnings fixed in rebar3 3.27. 验证: - Ran git diff --check successfully. - Rebuilt the observer_cli escript locally with rebar3 3.27 and confirmed the timestamp warnings were absent. - Ran the generated escript with --help and confirmed it exited successfully. * Handle remote application group leaders 改动重点: - Treat remote group leader PIDs as unattributed before calling local-only process_info/2. - Add a regression test proving remote PIDs are counted through the existing no_group path without crashing. 验证: - rebar3 fmt -c src/observer_cli_application.erl - rebar3 fmt -c test/observer_cli_application_test.erl - rebar3 as test eunit --module=observer_cli_application_test (19 tests, 0 failures) - git diff --check and git diff --cached --check * Complete diagnostics release proof gates 改动重点: - Wire every command-first inspection and trace route through the bounded target dispatcher while preserving the positional TUI path. - Add versioned trace envelopes, end-to-end request conversion checks, TUI parity coverage, deterministic trace activation, and release-gate lint and Dialyzer fixes. - Document supported commands, trust and risk boundaries, OTP 26-29 compatibility, the full cross-node matrix, measured resource budgets, cleanup evidence, and remaining limits. 验证: - Ran rebar3 fmt and the focused five-module EUnit suite (138 tests, 0 failures). - Ran rebar3 eunit (528 tests, 0 failures), rebar3 compile, rebar3 as ci compile, rebar3 xref, rebar3 dialyzer, rebar3 check, and git diff --check. - Ran focused EUnit, compile, and escriptize on OTP 26.2.5.2, 27.3.4.2, 28.5, and 29.0.3; all 16 controller-target snapshot cells passed. - Ran disposable end-to-end command, 10,000 and 100,000 resource admission, 100,000-process recon cleanup, atom-growth, scheduler-flag, and worker-cleanup proofs. * Make escript exit test context-independent Change highlights: - Pass an explicitly invalid option through the generated escript command. - Preserve the argument-error exit contract without depending on saved active diagnostics context. Verification: - rebar3 fmt --check - rebar3 as test eunit --module=observer_cli_escriptize_test - rebar3 eunit - git diff --check * Add comprehensive command-line help Change highlights: - Add top-level command groups, target and output option guidance, and duration syntax. - Add command-specific help for every diagnostics command with defaults, ranges, safety notes, and examples. - Document saved-context and explicit-target workflows and correct the connect example syntax. - Cover top-level help and every command help route with focused EUnit assertions. Verification: - rebar3 fmt --check src/observer_cli_escriptize.erl - rebar3 fmt --check test/observer_cli_escriptize_test.erl - rebar3 as test eunit --module=observer_cli_escriptize_test (56 tests, 0 failures in an isolated staged tree) - rebar3 escriptize - Manual escript checks for top-level and trace command help - git diff --cached --check * Harden diagnostics contracts and release proofs 改动重点: - Enforce command-specific CLI arguments, bounded controller deadlines, strict response schemas, privacy rules, resource wrapper invariants, and exit-code priority. - Correct Quick and observation diagnostics for ETS, Port, Socket, scheduler, trend, replacement, reset, and sampling semantics. - Harden Trace lifecycle cleanup and add adversarial fixtures for helper, dispatcher, formatter, module-reload, busy-session, emergency-stop, and recon-profile boundaries. - Update the design and validation evidence while keeping the release state design-reviewed until the proof runner is tracked. 验证: - Ran rebar3 fmt -c, rebar3 eunit with 571 tests and zero failures, and rebar3 check successfully. - Passed focused 181-test suites, compile, and escriptize on OTP 26.2.5.2, 27.3.4.2, 28.5, and 29.0.3. - Passed the 16/16 controller-target snapshot matrix plus 10k/100k resource and 100k-process Trace cleanup proofs. - Ran git diff --check and git diff --cached --check successfully. - Did not add the temporary release proof commands as a tracked runner; the design remains design-reviewed until that reproducibility gap is closed. * Highlight Observer CLI 2.0 diagnostics workflow 改动重点: - Expand the README diagnostics section with the 2.0 positioning, standalone build flow, legacy TUI compatibility, and a command map. - Document stateful and stateless workflows for test@127.0.0.1 without exposing the cookie on the command line. - Clarify output formats, OTP compatibility, deadlines, context behavior, and links to detailed validation evidence. 验证: - Ran the generated observer_cli --help and checked the documented command names and options against its output. - Ran git diff --check and git diff --cached --check successfully. - Did not run EUnit because this commit changes documentation only. * Handle stat read errors for disappearing ports Wrap network `stat_fun` calls in `network_resource/2` with `try/catch` so transient port failures (for example, a port disappearing during stat collection) are treated as `disappeared` instead of crashing collection. Add an inet test that simulates `badarg` from `stat_fun` and verifies the result increments `disappeared_count` and returns no items. * Generalize process duration collection and harden network counter parsing Summary: - Extend processes duration mode to all supported sorts (memory, message_queue_len, reductions, binary_memory, total_heap_size) with unified window outputs - Remove reduction-only restriction for process duration and update CLI usage/help with new examples - Add tolerant inet stat parsing so malformed network counter shapes degrade to disappeared instead of crashing - Add regression tests covering all process duration sorts and network stat-shape robustness; align diagnostics parity notes with new semantics Verification: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_cli_test --module=observer_cli_snapshot_test --module=observer_cli_inet_test - rebar3 eunit * Synchronize process TARGET details with TUI parity fields Changes: - Extend process detail collection keys with priority, binary refs counters, catchlevel, suspending, error_handler, trap_exit, links/monitors/monitored_by, and current_stacktrace. - Keep behavior for process target resolution and TopN windows unchanged while adding missing-field normalization and JSON-safe sanitization. - Add coverage in snapshot and process tests to assert schema-safe output and guard against forbidden tuple leakage in links/monitors/stack fields. - Update CLI/TUI parity documentation to mark newly covered fields and remove them from pending lists. Validation: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_snapshot_test - rebar3 as test eunit --module=observer_cli_process_test - rebar3 eunit - rebar3 as ci compile * Harden process detail parity fields 改动重点: - Correct GC tuning collection and binary reference counting to match OTP and TUI semantics. - Redact process identifiers across signals, suspension data, error handlers, and stack frames without exposing raw terms or source paths. - Bound signal and stack detail lists while preserving total counts and truncation status, and align parity documentation with the resulting behavior. 验证: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_snapshot_test,observer_cli_process_test: 105 tests, 0 failures. - Ran rebar3 eunit: 577 tests, 0 failures. - Ran rebar3 as ci compile. - Ran git diff --check and live OTP 29 redaction/controller validation. * Add complete CLI port inspection 改动重点: - Extend ports inventory with controls and slot aliases plus parallelism and locking fields - Add bounded port TARGET inspection for signals, inet endpoints, statistics, allowlisted options, and report-scoped redaction - Update CLI parsing, response validation, focused EUnit coverage, and Ports parity documentation - Keep raw Port parsing target-local and reject invalid, stale, report-scoped, or arbitrary Erlang terms as not_found 验证: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_snapshot_test,observer_cli_escriptize_test,observer_cli_port_test (184 tests, 0 failures) - rebar3 eunit (580 tests, 0 failures) - rebar3 as ci compile - git diff --check - OTP 29 live proof with external and gen_tcp ports through generated CLI, redaction checks, and -noshell TUI detail comparison * Expose ETS concurrency settings in CLI snapshots 改动重点: - Add write_concurrency and read_concurrency to structured ETS inventory rows. - Update ETS field accounting and parity documentation while preserving existing scan and generation checks. 验证: - Ran rebar3 fmt -- src/observer_cli_snapshot.erl test/observer_cli_snapshot_test.erl. - Ran rebar3 as test eunit --module=observer_cli_snapshot_test: 50 tests, 0 failures. - Ran git diff --cached --check. * Expose allocator diagnostics through memory CLI 改动重点: - Reuse the System collector to return util allocator block sizes, SBCS-to-MBCS ratios, and per-instance cache hit metrics from the memory command. - Add deterministic machine-readable fields, independent allocator probe status, partial-failure preservation, controller response validation, help text, and parity/design documentation. - Keep snapshot and diagnose allocator-free; do not add fragmentation, carrier tuning, or a separate command. 验证: - Passed rebar3 as test eunit --module=observer_cli_system_test,observer_cli_snapshot_test,observer_cli_escriptize_test (146 tests) and observer_cli_cli_test (30 tests). - Passed rebar3 fmt, rebar3 compile, rebar3 as ci compile, rebar3 escriptize, and git diff --check. - Verified term and JSON memory output against a disposable OTP 29 -noshell node; both probes completed, all nine util allocators and cache instances 0-8 were present, and allocator names matched direct recon_alloc output. - Full rebar3 eunit was run but remains at 582/583 because HEAD 14f33e4 leaves observer_cli_ets_test missing the new ETS concurrency fixture fields; this commit does not touch that unrelated failure. * Cover ETS concurrency metadata in tests 改动重点: - Extend the ETS metadata fixture with write and read concurrency values. - Update the explicit metadata-key assertion for the two additional ETS lookups. 验证: - Ran rebar3 fmt -- test/observer_cli_ets_test.erl. - Ran rebar3 as test eunit --module=observer_cli_ets_test: 14 tests, 0 failures. - Ran git diff --cached --check. * Align CLI top-N ordering with recon 改动重点: - Route process, application, ETS, Mnesia, network, port, socket, and diagnostic top-N ranking through recon_lib:sublist_top_n_attrs/2. - Remove custom comparators and align tie-order coverage and regression expectations with recon behavior. 验证: - rebar3 as test eunit --module=observer_cli_snapshot_test,observer_cli_diagnostic_test,observer_cli_ets_test,observer_cli_mnesia_test (96 tests, 0 failures) - rebar3 eunit (584 tests, 0 failures) - rebar3 fmt -c on all five changed files; git diff --check * Expose per-connection network metrics 改动重点: - Add packet counters, port context, peer endpoints, count sorting, and stable total/delta handling to network output. - Preserve listener semantics, report peer probe failures, enforce endpoint redaction validation, and restore deterministic raw-port tie ordering. - Update CLI help, parity/design documentation, and adversarial regression coverage without changing the schema or TUI. 验证: - Ran rebar3 fmt. - Ran focused EUnit: 180 tests, 0 failures. - Ran full EUnit: 584 tests, 0 failures. - Ran rebar3 compile and rebar3 as ci compile. - Verified OTP 26 compilation/API behavior and OTP 29 live listener behavior. - Ran git diff --check. * Simplify CLI validation and dispatch paths 改动重点: - Consolidate snapshot, diagnose, and inspection RPC dispatch handling while preserving command-specific schema errors and exit codes. - Reuse CLI option validation, bounded integer parsing, and snapshot limit and duration predicates without changing public behavior. - Keep the cleanup limited to command-mode modules and avoid TUI implementation changes. 验证: - Passed focused CLI regression suites, including 156 scoped tests and 66 escript dispatch tests. - Passed full `rebar3 eunit` with 584 tests and 0 failures. - Passed `rebar3 fmt --check`, `rebar3 as ci compile`, `rebar3 xref`, `rebar3 escriptize`, CLI help smoke testing, and `git diff --check`. * Raise test coverage above 98 percent 改动重点: - Add integration-heavy coverage for CLI commands, diagnostics, snapshots, tracing, sockets, ports, Mnesia, filesystem behavior, and distributed node lifecycles. - Add narrow TEST-only seams for deterministic error handling and boundary validation while preserving user-visible runtime behavior. - Cover terminal routing, resource cleanup, malformed responses, timeout paths, and real OTP resource interactions. 验证: - `rm -f _build/test/cover/ct.coverdata && rebar3 as test do eunit, covertool generate` passed with 633 tests, 0 failures, and 98.0819% line coverage (6392/6517). - `rebar3 fmt --check` passed. - `rebar3 as ci compile` passed. - `git diff --check` passed before staging. * Add optional diagnostics loading and refresh parity guidance 改动重点: - 默认在目标节点缺少 diagnostics 模块时输出可操作的友好提示,并新增显式 connect --load-diagnostics 自动加载选项 - 保持默认连接路径不修改目标节点,仅在用户明确请求时复用现有远程加载机制,并同步 README、开发规则和命令帮助 - 增加参数解析、提示输出和真实远程加载测试,同时更新 CLI/TUI 指标覆盖结论与后续优化优先级 验证: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_escriptize_test(105 tests, 0 failures) - rebar3 eunit(633 tests, 0 failures) - rebar3 compile - rebar3 escriptize - 使用生成的 observer_cli 在 test@127.0.0.1 验证默认缺模块提示、--load-diagnostics 加载成功及 memory JSON 输出 - git diff --check * Restore high-value CLI collector parity Key changes: - Follow application group-leader chains, emit sortable no_group aggregates, and preserve loaded application versions. - Expose socket owner and state metadata plus accepts and current max-packet metrics without adding probes or sort modes. - Refresh the CLI/TUI parity ledger and add regression coverage for attribution, redaction, and duration semantics. Validation: - Ran rebar3 fmt. - Ran rebar3 as test eunit --module=observer_cli_application_test,observer_cli_snapshot_test (86 tests, 0 failures). - Ran rebar3 eunit. - Ran rebar3 compile and rebar3 as ci compile. - Ran live OTP application and socket collector probes against the test build. * Add structured health text and process context Introduces structured text encoding for health-style commands (`diagnose`, `snapshot`, `memory`, `schedulers`, `distribution`, `network`) so output is readable and consistently ordered instead of raw map dumps. Process inventory now includes TUI-style context fields (`registered_name`, `label`, `initial_call`, `current_function`, `memory_bytes`, `message_queue_len`, `reductions`) while keeping duration sampling efficient by collecting only sort fields first and enriching only final Top N. Process labels are bounded and safely null on unsupported/failed lookups. Related docs and tests were updated for parity and behavior coverage. * Enforce compatible remote diagnostics bundles 改动重点: - Add a bundle version to the diagnostics capability handshake and require matching protocol and bundle versions before using remote code. - Reuse the existing remote loader for positional TUI and explicit diagnostics loading, validate every module load, and reject failed post-load probes. - Bump Rebar and Mix package metadata plus installation guidance to 2.0.0, clarify remote loading behavior, and document expanded text reports. - Add focused coverage for incompatible bundle replacement, failed reloads, capability validation, and version metadata synchronization. 验证: - Ran focused observer_cli_escriptize_test EUnit coverage: 73 tests, 0 failures. - Ran focused observer_cli_snapshot_test EUnit coverage: 67 tests, 0 failures. - Ran the full rebar3 eunit suite successfully with an isolated HOME. - Ran rebar3 compile, rebar3 as ci compile, and rebar3 escriptize. - Ran scoped rebar3 fmt --check checks and git diff --check. * Harden CLI response contracts 改动重点: - Forward the default scheduler duration so the documented no-option command reaches the target with a valid request. - Accept successful partial trace captures and stable trace error reasons while preserving their correct exit codes. - Keep target identity and partial runtime data when required snapshot or memory probes are unavailable, with regression coverage for each boundary. 验证: - Ran rebar3 eunit: 644 tests, 0 failures. - Ran rebar3 compile and rebar3 as ci compile successfully. - Ran rebar3 fmt --check and git diff --check successfully. - Verified live schedulers and deep diagnose commands complete with empty error lists against test@127.0.0.1. * Finalize Observer CLI 2.0 diagnostics interface 改动重点: - Harden command parsing, help, output envelopes, context cleanup, and capability reporting for the command-first diagnostics interface. - Require the explicit tui command, remove the positional TUI shorthand, and retain automatic bundle loading only for the explicit TUI route. - Add generated-escript smoke coverage, focused regression tests, CI wiring, and release documentation for the final CLI contract. 验证: - rebar3 fmt - rebar3 as test eunit --module=observer_cli_cli_test,observer_cli_escriptize_test (117 tests, 0 failures) - rebar3 eunit (649 tests, 0 failures) - rebar3 check - scripts/escript-smoke.sh and dash scripts/escript-smoke.sh (10 cases each) - git diff --cached --check * Rewrite observer_cli documentation for operators and AI agents 改动重点: - Replace the legacy documentation with a Diátaxis structure covering tutorials, how-to guides, reference, and explanation. - Use README as the ExDoc homepage, publish a standalone changelog, and emphasize the production-ready command CLI. - Generate llms.txt and per-page Markdown, configure Erlang rendering, and add shell syntax highlighting. - Remove stale audits, guides, and screenshots while retaining an explicit reproducible TUI screenshot TODO. 验证: - Ran `rebar3 docs` and verified the README redirect, all 20 llms.txt targets, Erlang CSS, and shell highlighting injection. - Ran `rebar3 check` successfully. - Ran `rebar3 hex build docs` and verified the tarball contains llms.txt, Markdown pages, and the shell highlighter. - Verified the generated HTML in a browser and ran `git diff --cached --check`. * Tighten docs wording across guides and references Refines README and documentation pages to be more concise and consistent while preserving the same behavior and contracts. The edits clarify diagnostic semantics, capability requirements, safety boundaries, exit-status interpretation, redaction defaults, and TUI/plugin guidance so operational usage is easier to scan and less ambiguous. * Add behavior-aware OTP state inspection 改动重点: - Replace the pre-release gen-server-state command with otp-state for gen_server, gen_statem, and gen_event. - Enforce bounded, value-free state shapes, strict response validation, redaction, fixed acquisition deadlines, and behavior-specific output limits. - Limit supervision admission to 300 children and output to 100 while retaining scan refusals across application observations. - Update CLI reference, safety guidance, smoke coverage, and real OTP boundary fixtures. 验证: - Ran rebar3 eunit: 654 tests, 0 failures. - Ran rebar3 check, rebar3 as ci compile, rebar3 fmt --check, and git diff --check. - Ran scripts/escript-smoke.sh and a built-binary gen_event probe against a real distributed target. - Ran focused OTP 26-28 validation and manual 100/101/300/301 supervision benchmarks. * Expand TUI reference with field semantics Greatly extends `docs/reference/tui.md` with detailed field-by-field documentation for Home, Network, Ports, Sockets, System, ETS, Mnesia, App, and Process detail views. It clarifies units, sampling behavior (current/total/delta/window), data sources, and renderer caveats so users can interpret TUI values consistently. * Redefine the CLI response contract 改动重点: - Replace the seven-field envelope with the fixed six-field response shared by every command producer. - Centralize outcome validation and exit-code derivation while keeping probe failures out of issues and skipped checks. - Simplify text rendering and retain command-domain data, safety controls, and output stream behavior. 验证: - Ran rebar3 fmt and the focused CLI, snapshot, diagnostic, and escriptize EUnit suites. - Ran rebar3 eunit with 659 tests and zero failures. - Ran rebar3 compile, rebar3 as ci compile, rebar3 xref, and scripts/escript-smoke.sh. * Publish the CLI response JSON Schema 改动重点: - Add a strict JSON Schema 2020-12 definition for the six-field envelope and supported command families. - Package the schema in Hex and escript artifacts without adding a runtime schema dependency. - Add parity tests for required keys, enums, strict objects, command families, and Erlang validator coverage. 验证: - Parsed the schema with the OTP JSON implementation and ran observer_cli_schema_test. - Ran rebar3 escriptize and confirmed the schema is present in the escript archive. - Ran rebar3 hex build and confirmed the schema is present in the package contents. * Document the response contract release changes 改动重点: - Record the fixed six-field envelope, published schema, and probe failure source of truth. - Document the release-candidate same-build requirement while protocol version remains 1. 验证: - Reviewed the staged changelog diff against the implemented contract and packaging behavior. - Ran git diff --cached --check. * Restructure docs around CLI/TUI core guides Consolidates the docs into a smaller, task-oriented structure: rewrites the README, turns the CLI reference into an end-to-end workflow guide, adds new Core concepts and TUI plugins pages, and updates TUI/changelog links. It removes the older tutorials/how-to/reference/explanation pages and updates docs.exs navigation groups to focus on CLI, TUI, plugins, and core concepts. * Improve docs structure and TUI navigation docs Update ExDoc extras to include the project changelog and license, grouped under a new Project section. Rewrite the 2.0.0 release-candidate changelog entry into a shorter, higher-level summary. Refresh the TUI navigation diagram and explanatory text to clearly distinguish global page shortcuts from row-level drill-down flows. * Update docs and add screenshot capture script Refreshes README and docs for 2.0 with corrected `v2.0.0` schema/source links, clearer CLI/TUI behavior notes, updated plugin API/state semantics, and expanded reference details (probe reporting, inputs, navigation, and edge cases). Adds new changelog notes and embedded Mermaid flows/TODO screenshot placeholders. Also introduces `scripts/docs-screenshots.sh`, which compiles a local fixture and launches guided TUI/plugin sessions to capture consistent documentation screenshots. * Add TUI screenshots to docs and README Embed captured TUI screenshots across README and reference docs, replacing prior TODO placeholders for Home, Sockets, Process Info, and Runtime plugin views. Also configure ExDoc asset copying in docs.exs so images are published under assets/ in generated documentation. * Tighten trace cleanup and response contracts Refines trace behavior across CLI, snapshot, and trace internals: `trace call` now requires timeout >= duration+7s, `trace stop --all` enforces a 5s minimum and explicit acknowledgement, and cleanup confirmation is reported accurately when worker timeout/death races occur. Trace captures now include selector metadata (`tracee`/`mfa`), preserve collected events on forced exits, detect/filter interference, and enforce a stricter response schema (including stop responses omitting historical events). Help/reference docs and tests were expanded to match the new safety and cleanup contract. * Add bounded log access and harden trace contracts 改动重点: - Add the logs command for bounded retained text from supported logger_std_h configured paths, with source and file-identity limits, schema validation, escaped output, and operator documentation. - Harden trace cleanup for process and port tracers, fixed recon name collisions, lifecycle races, response caps, and rate and completion semantics. - Tighten shared response validation and terminal-control escaping while expanding EUnit and escript smoke coverage. 验证: - REBAR_BASE_DIR=_build_commit_final rebar3 eunit (736 tests, 0 failures). - REBAR_BASE_DIR=_build_commit_final_fmt rebar3 fmt --check. - REBAR_BASE_DIR=_build_commit_final_ci rebar3 as ci compile. - REBAR_BASE_DIR=_build_commit_final_smoke scripts/escript-smoke.sh. - git diff --cached --check. * Remove log access design proposal doc Delete `docs/observer-cli-log-access-design.md`, removing the large v3 proposal for `observer_cli logs` from the docs tree. * Simplify boolean checks in trace validation Refactor `observer_cli_escriptize` trace validation to use direct boolean expressions instead of explicit `=:= true/false` comparisons. This updates cleanup confirmation handling and natural trace shape checks (`Reloaded`/`Interference`) while keeping the same expected boolean outcomes with clearer logic. * Refine forced payload and trace clear flow Simplify `with_forced_payload/3` to only handle forced outcomes, removing the pass-through fallback. In `clear_trace/0`, preserve `recon_trace:clear()` return values instead of collapsing non-`ok` results into `cleanup_unconfirmed`, while still treating exceptions as cleanup-unconfirmed errors. * Fix screenshot links in source documentation 改动重点: - Replace five relative screenshot paths with immutable raw GitHub URLs. - Keep the links valid in GitHub and Hex source views without changing ExDoc asset generation. 验证: - Ran `rebar3 docs` successfully. - Verified all five generated HTML image URLs, pinned commit asset blobs, and `git diff --cached --check`. * Harden TUI loading and release workflow Tighten the 2.0 release/CI setup by documenting supported OTP versions, adding release instructions, checking formatting in CI, and covering Mix compilation alongside the existing rebar3 jobs. On the runtime side, make TUI startup and remote loading safer: reject cross-OTP auto-loads with a clear error, only upload root app modules, include recon explicitly, handle stdin EOF and malformed PID input cleanly, pair scheduler wall-time cleanup correctly, clear stale redraw output, and refine snapshot/diagnostic lifecycle counts with bounded PID samples and updated tests. * Separate cross-OTP CI installations 改动重点: - Move the cross-OTP runtime out of setup-beam's shared install directory before installing the controller OTP. - Re-run OTP's Install script at the new prefix so both runtimes keep clean, valid library trees. 验证: - Parsed the staged workflow as YAML and ran git diff --cached --check. - Ran rebar3 fmt --check, rebar3 as ci compile, and rebar3 eunit (735 tests, 0 failures). - Did not run the Ubuntu multi-OTP matrix locally; GitHub Actions must verify the cross-runtime jobs. * Add tagged release installer workflow Restrict CI release handling to version tags, build and upload OTP-specific escript artifacts, and publish a GitHub Release with checksums. Add a versioned install script plus README, CLI docs, and releasing guide updates to describe the new escript-based release flow. * Restore project coverage above 98 percent Key changes: - Add behavior-backed CLI, distributed-node, schema, log, snapshot, socket, trace, and TUI failure-path coverage. - Enforce a 98 percent Codecov project target with zero tolerance for regression. - Keep production behavior unchanged by limiting the diff to tests and coverage policy. Validation: - epmd -daemon && rebar3 as test do eunit, covertool generate (770 tests, 0 failures; 7763/7912 lines, 98.1168 percent). - rebar3 compile - rebar3 as ci compile - rebar3 fmt --check - YAML coverage-gate validation and git diff --check * Skip unavailable process-label documentation links Key changes: - Exclude proc_lib:get_label/1 and proc_lib:set_label/1 from ExDoc auto-link resolution. - Preserve the inline code text while avoiding OTP 26 undefined-reference warnings. Validation: - OTP 26.2.5.2 isolated rebar3 as ci check - rebar3 as ci check on OTP 29.0.3 - rebar3 fmt --check - git diff --check * Clarify logs semantics and harden tests Update `logs` CLI/help docs to state it performs a single read (no follow), and clarify `--timeout` as a 10s default remote-operation deadline (max 120s). Tests were adjusted to be more environment-safe by tolerating `json_unavailable`, setting/restoring both `HOME` and `XDG_CONFIG_HOME` for context-path scenarios, and gating the socket capability-absence test to OTP 27+. * Harden release smoke tests and TUI metrics Adds stronger CI/release checks by smoke-testing the installer on Ubuntu (without `shasum`) and running a Mix release smoke path that verifies `:crypto` is included. The installer now accepts either `sha256sum` or `shasum`, and `mix.exs` declares `:crypto` in `extra_applications`. Fixes multiple runtime/data correctness issues across views: process heap/GC values are consistently converted to bytes, process detail rendering is bounded to prevent oversized/slow output, inet window sampling now uses consistent directional deltas and correct input/output column placement, ETS churn handles unread memory values safely, and Mnesia memory handling now treats `disc_only_copies` correctly while skipping disappeared tables. Docs and tests were updated to match the new behavior. * Add Mix escript build and detail limits Configure `mix escript.build` as a first-class build path (with matching escript metadata in `mix.exs`), add CI/release smoke coverage for the Mix-generated binary, and update install/reference docs accordingly. Tighten bounded process-detail handling by normalizing oversized message output to `too_large`, distinguishing true detail errors from size/time/heap limits, and enforcing worker kill timers; add a dedicated limits test suite for large terms, formatter hangs, parent death, and heap-limit behavior. * Enforce detail caps on final rendered output Updates process detail limiting to measure the final rendered payload (including view prefixes) against byte/character caps, with clearer handling for state errors versus formatter/output overflows. It also switches the default/sample formatter to `~p` printing, hardens output validation (binary size, unicode length, invalid formatter returns, formatter crashes), and expands limits tests to cover binary visibility, huge integers, unicode-heavy output, invalid formatter output, and fallback behavior. * Tighten process detail limit enforcement Strengthens process detail safety limits by switching depth validation from `io_lib:limit_term/2` to explicit structural depth traversal, and updates tests to cover deep nested terms and large binaries that must return `too_large`. It also applies a `64*1024 + 1` formatter `chars_limit` tripwire (with docs) so soft formatter truncation is rejected by the existing hard output cap, preserves formatter-rendered state output without rewriting the first line, and factors mnesia table memory sizing into a small helper for clearer storage-specific handling. * Unify detail output handling for binaries Remove the special-case clause that immediately returned `too_large` for oversized binaries. All output now flows through the same `unicode:characters_to_binary/1` path and shared size check, keeping detail output validation and conversion behavior consistent.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #137 +/- ##
==========================================
+ Coverage 92.37% 98.04% +5.67%
==========================================
Files 17 25 +8
Lines 2058 8029 +5971
==========================================
+ Hits 1901 7872 +5971
Misses 157 157 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66adda6dbd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| false; | ||
| enable_scheduler_wall_time(?ENABLE) -> | ||
| Token = atomics:new(1, []), | ||
| _ = erlang:system_flag(scheduler_wall_time, true), |
There was a problem hiding this comment.
Preserve the TUI scheduler flag state
When scheduler usage is enabled and the target already had scheduler_wall_time turned on, erlang:system_flag(scheduler_wall_time, true) returns that previous true state, but this code discards it and release_scheduler_wall_time/1 later always sets the flag to false. That regresses the old behavior and leaves other monitoring code on the target with scheduler wall-time disabled after quitting or restarting the TUI; store the previous value in the token and restore it on release.
Useful? React with 👍 / 👎.
| Second = SampleFun(), | ||
| scheduler_window(First, Second) | ||
| after | ||
| _ = FlagFun(false) |
There was a problem hiding this comment.
Restore scheduler wall-time after schedulers sampling
For observer_cli schedulers, the production FlagFun is erlang:system_flag(scheduler_wall_time, ...); if the target already had scheduler wall-time enabled, the true call returns that previous state but this after block unconditionally disables it. Running a read-only diagnostics command can therefore turn off another tool's global scheduler-wall-time instrumentation on the target; capture the value returned by FlagFun(true) and restore that value instead of always passing false.
Useful? React with 👍 / 👎.
| Started = erlang:monotonic_time(millisecond), | ||
| Plan = observation_plan(Started, Duration, Count), | ||
| ModuleLoaded = is_tuple(code:is_loaded(?MODULE)), | ||
| _ = observer_cli_snapshot:diagnostic_scheduler_flag(true), |
There was a problem hiding this comment.
Preserve scheduler wall-time during observations
When diagnose --observe runs on a node where scheduler_wall_time was already enabled, this call returns the previous true state, but the after block always calls diagnostic_scheduler_flag(false). That makes an observation/deep diagnosis globally disable scheduler wall-time for the target after it completes, so the observation path should restore the previous flag value rather than always clearing it.
Useful? React with 👍 / 👎.
| manager( | ||
| StorePid, RenderPid, #view_opts{sockets = Sockets = #sockets{cur_page = CurPage}} = ViewOpts | ||
| ) -> | ||
| case observer_cli_lib:parse_cmd(ViewOpts, ?MODULE, [RenderPid]) of |
There was a problem hiding this comment.
Stop the socket store when changing views
When a user leaves the Sockets page with a global shortcut such as H or N, parse_cmd/3 only receives [RenderPid], so clean_before_route/2 kills the renderer but leaves the StorePid spawned for socket row lookup running. Since a normal exit of the manager does not kill linked processes, each navigation away from Sockets leaves an orphan observer_cli_store loop on the target; pass StorePid in the cleanup args like the Network page does.
Useful? React with 👍 / 👎.
No description provided.