mirror of
https://github.com/instructkr/claw-code.git
synced 2026-06-06 09:52:43 -04:00
Compare commits
1 Commits
docs/roadm
...
docs/roadm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
527dd6b1ce |
@@ -6303,4 +6303,4 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
|
||||
|
||||
422. **`export --output-format json` and `--resume latest` report the same "no managed sessions" scenario using two different `kind` codes — `no_managed_sessions` vs `session_load_failed` — making "no session found" undetectable by a single kind-code check** — dogfooded 2026-04-30 KST (UTC+9) by Jobdori on `e939777f`. Running `claw export --output-format json` with no session present returns (on stderr, exit 1): `{"error":"no managed sessions found in .claw/sessions/<fingerprint>/","hint":"Start \`claw\` to create a session, then rerun with \`--resume latest\`.\nNote: claw partitions sessions per workspace fingerprint; sessions from other CWDs are invisible.","kind":"no_managed_sessions","type":"error"}`. Running `claw --resume latest /status --output-format json` with no session present returns (on stderr, exit 1): `{"error":"failed to restore session: no managed sessions found in .claw/sessions/<fingerprint>/","hint":"Start \`claw\` to create a session, then rerun with \`--resume latest\`.\nNote: claw partitions sessions per workspace fingerprint; sessions from other CWDs are invisible.","kind":"session_load_failed","type":"error"}`. Both describe the same root condition — there are no sessions to operate on — but they expose it via different `kind` discriminants. Automation that checks `kind == "no_managed_sessions"` to detect a cold workspace will miss the `--resume` path's `session_load_failed`, and vice versa. A wrapper that guards "run with --resume only if a session exists" must special-case both codes. The hint text is identical between them, suggesting the messages are logically equivalent. Additionally neither code matches the proposed canonical names `session_not_found` / `session_load_failed` as stable `ErrorKind` discriminants described in ROADMAP #77's fix shape, which explicitly proposes typed error-kind codes for session lifecycle failures. **Required fix shape:** (a) unify "no sessions found for this workspace fingerprint" under a single canonical `kind` code — either `no_managed_sessions` or `session_not_found` — used consistently by every command path that encounters an empty session registry; (b) if `session_load_failed` is a more general category (covering e.g. corrupt session files, IO errors, schema version mismatches), it should nest a concrete `reason:"no_managed_sessions"` or `reason:"session_not_found"` sub-field so callers can distinguish "empty registry" from "found but unreadable"; (c) align with the canonical error-kind contract proposed in #77; (d) add regression coverage proving `export` and `--resume latest` in an empty workspace both return an error with the same top-level `kind` code. **Why this matters:** session guard-rails in orchestration need a single stable `kind` to detect cold workspaces without enumerating all possible no-session synonyms. Two divergent codes for the same condition make defensive automation brittle and contradict the promise of machine-readable error envelopes. Source: Jobdori live dogfood, `e939777f`, 2026-04-30 KST (UTC+9).
|
||||
|
||||
425. **`status --output-format json` workspace.`changed_files` silently includes untracked files in its count alongside staged and unstaged tracked files — a claw checking `changed_files > 0` to detect "uncommitted changes" will false-positive when only untracked files exist** — dogfooded 2026-04-30 KST (UTC+9) by Jobdori on `e939777f`, traced to source. In a workspace with only one untracked file and no staged/unstaged tracked changes: `claw status --output-format json` returns `{"workspace":{"changed_files":1,"staged_files":0,"unstaged_files":0,"untracked_files":1,"git_state":"dirty · 1 files · 1 untracked",...}}`. `changed_files` is 1 even though `staged_files` and `unstaged_files` are both 0. Source trace: `rust/crates/rusty-claude-cli/src/main.rs:3230-3255` — `parse_git_workspace_summary` increments `changed_files` for every non-header, non-blank line in `git status --short --branch` output before branching on `??` (untracked). The `??` branch increments `untracked_files` then calls `continue`, but `changed_files` was already incremented — so `changed_files = staged_files + unstaged_files + untracked_files` (plus conflicted). Meanwhile `git_state` is computed from `is_clean() = changed_files == 0`, so a repo with only untracked files produces `git_state:"dirty"` and `changed_files:N` while `staged_files == 0 && unstaged_files == 0`. A claw using the idiomatic guard `if workspace.changed_files > 0 { block_commit_or_rebase }` will block even when there are only new untracked files that will not be part of any commit. A claw using `changed_files == 0` as a "clean for commit" signal must additionally check `staged_files == 0 && unstaged_files == 0` — but the field name `changed_files` does not signal this requirement. This is distinct from #125 (git_state:"clean" in non-git dirs): #125 covers a false "clean" in non-git dirs; this covers a false "dirty" in git repos with only untracked files. **Required fix shape:** (a) rename `changed_files` to `total_git_status_entries` or similar to accurately reflect it counts all `git status --short` entries including untracked, OR exclude untracked from `changed_files` and rename the field to `tracked_changed_files`; (b) OR keep `changed_files` but document it explicitly as "includes untracked" in the schema and add a separate `tracked_changed_files = staged_files + unstaged_files` computed field; (c) fix `is_clean()` to also require `untracked_files == 0` if untracked files are meant to be included in the "dirty" signal, or to only use `staged_files + unstaged_files` if they are not; (d) add regression coverage proving that a workspace with only untracked files returns `changed_files > 0` and the documentation makes the semantic explicit. **Why this matters:** `changed_files` is the primary integer gate for "is this workspace clean enough to proceed?" in CI/automation flows. A silent untracked-file false positive causes automation to block valid operations (commits, rebases, PR creation) or fail health checks unnecessarily. Source: Jobdori live dogfood + source trace, `e939777f`, 2026-04-30 KST (UTC+9). Cross-reference: #125 (git_state clean in non-git dir), #400 (status workspace session/session_id mismatch).
|
||||
426. **`claw plugins --output-format json` surface has zero test coverage in `output_format_contract.rs` — the contract tests that lock every other major JSON surface (`agents`, `mcp`, `skills`, `status`, `sandbox`, `doctor`, `help`, `version`, `acp`, `bootstrap-plan`, `system-prompt`, `init`, `diff`, `config`) do not include a single assertion about `plugins`, leaving the plugin JSON shape entirely untested and free to silently drift** — dogfooded 2026-05-01 KST (UTC+9) by Jobdori on `57096b0a`. Inspection of `rust/crates/rusty-claude-cli/tests/output_format_contract.rs` (11 tests) shows coverage for every major `--output-format json` surface except `plugins`. Live binary produces `{"action":"list","kind":"plugin","message":"<prose table>","reload_runtime":false,"target":null}` for `claw plugins --output-format json`, but no test asserts (a) that `kind == "plugin"`, (b) that `action == "list"`, (c) that the payload is valid JSON at all, (d) that `reload_runtime` is present and boolean, or (e) that `target` is present and null/typed. The only plugin-related test in `mock_parity_harness.rs` covers plugin tool execution round-trip, not the CLI inspection surface. This means the `plugins list` JSON schema documented in ROADMAP #416 (mutation-shape envelope, missing `plugins:[]` array) can silently regress or change shape between commits with no CI signal. By contrast, if `agents list` drops the `agents[]` field, `inventory_commands_emit_structured_json_when_requested` catches it immediately. **Required fix shape:** (a) add a `plugins_command_emits_json_when_requested` test in `output_format_contract.rs` that: runs `claw plugins --output-format json` in an isolated temp dir, asserts stdout is valid JSON, asserts `kind == "plugin"`, asserts `action == "list"`, asserts `reload_runtime` is boolean, asserts `target` is JSON null when no plugin is targeted; (b) add a second assertion variant for `claw plugins enable <name> --output-format json` to confirm the lifecycle-mutation envelope fields are stable; (c) pair with the existing ROADMAP #416 fix so when `plugins:[]` array is added, a test assertion locks it; (d) extend to `plugins disable`, `plugins install`, and `plugins uninstall` shapes once they are implemented. **Why this matters:** test brittleness — the plugin JSON surface is the only major `--output-format json` surface with zero contract coverage. Any schema change, regression, or panic in `plugins` dispatch goes undetected until a downstream claw hits it at runtime. CI's four-check suite gives a false assurance of coverage for plugin JSON because `cargo test --workspace` passes even with zero plugin contract assertions. Source: Jobdori dogfood + test-file inspection, `57096b0a`, 2026-05-01 KST (UTC+9). Cross-reference: #416 (plugins list returns mutation shape, no plugins array).
|
||||
|
||||
Reference in New Issue
Block a user