fix(#712): add missing action fields to doctor/status/bootstrap-plan/dump-manifests json responses

This commit is contained in:
YeonGyu-Kim
2026-05-26 03:02:57 +09:00
parent bae0099c7c
commit fdde5e45cf
2 changed files with 6 additions and 0 deletions

View File

@@ -7589,3 +7589,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
710. **`claw diff --output-format json` missing `action` and `working_directory` fields — both the ok and error paths in `render_diff_json_for` omitted `action` entirely (returning `null` at parse time) and omitted `working_directory`** — dogfooded 2026-05-26 on `8f8eb41e`. Both the clean/changes success path and the no-git-repo error path were missing the two envelope fields that automation uses for routing and provenance. Fix: added `action:"diff"` and `working_directory: cwd.display()` to both branches of `render_diff_json_for`; added contract-test assertions for both fields. Source: Jobdori dogfood on `8f8eb41e`, 2026-05-26. 710. **`claw diff --output-format json` missing `action` and `working_directory` fields — both the ok and error paths in `render_diff_json_for` omitted `action` entirely (returning `null` at parse time) and omitted `working_directory`** — dogfooded 2026-05-26 on `8f8eb41e`. Both the clean/changes success path and the no-git-repo error path were missing the two envelope fields that automation uses for routing and provenance. Fix: added `action:"diff"` and `working_directory: cwd.display()` to both branches of `render_diff_json_for`; added contract-test assertions for both fields. Source: Jobdori dogfood on `8f8eb41e`, 2026-05-26.
711. **`version`, `system-prompt`, `export`, and `init` `--output-format json` responses all lacked an `action` field — returned `null` or omitted entirely** — dogfooded 2026-05-26 on `42c17bc4`. All four commands emitted `kind` + `status` but no `action`, making them inconsistent with all other JSON surfaces that include the verb. Fix: added `action:"show"` to `version` and `system-prompt`, `action:"export"` to all three `export` paths, `action:"init"` to `init`; added contract-test assertions for each. Source: Jobdori dogfood on `42c17bc4`, 2026-05-26. 711. **`version`, `system-prompt`, `export`, and `init` `--output-format json` responses all lacked an `action` field — returned `null` or omitted entirely** — dogfooded 2026-05-26 on `42c17bc4`. All four commands emitted `kind` + `status` but no `action`, making them inconsistent with all other JSON surfaces that include the verb. Fix: added `action:"show"` to `version` and `system-prompt`, `action:"export"` to all three `export` paths, `action:"init"` to `init`; added contract-test assertions for each. Source: Jobdori dogfood on `42c17bc4`, 2026-05-26.
712. **`doctor`, `status`, `bootstrap-plan`, and `dump-manifests` `--output-format json` responses missing `action` field — consistent with batch of missing-action fixes in #710/#711** — dogfooded 2026-05-26 on `bae0099c`. `doctor` returned no `action`; `status` and `bootstrap-plan` same. `dump-manifests` had empty string. Fix: added `action:"doctor"` to doctor JSON, `action:"show"` to status and bootstrap-plan, `action:"dump"` to dump-manifests happy path. Source: Jobdori dogfood on `bae0099c`, 2026-05-26.

View File

@@ -2139,6 +2139,7 @@ impl DoctorReport {
let (ok_count, warn_count, fail_count) = self.counts(); let (ok_count, warn_count, fail_count) = self.counts();
json!({ json!({
"kind": "doctor", "kind": "doctor",
"action": "doctor",
"status": self.status(), "status": self.status(),
"message": report, "message": report,
"report": report, "report": report,
@@ -2890,6 +2891,7 @@ fn dump_manifests_at_path(
"{}", "{}",
serde_json::to_string_pretty(&json!({ serde_json::to_string_pretty(&json!({
"kind": "dump-manifests", "kind": "dump-manifests",
"action": "dump",
"commands": manifest.commands.entries().len(), "commands": manifest.commands.entries().len(),
"tools": manifest.tools.entries().len(), "tools": manifest.tools.entries().len(),
"bootstrap_phases": manifest.bootstrap.phases().len(), "bootstrap_phases": manifest.bootstrap.phases().len(),
@@ -2922,6 +2924,7 @@ fn print_bootstrap_plan(output_format: CliOutputFormat) -> Result<(), Box<dyn st
"{}", "{}",
serde_json::to_string_pretty(&json!({ serde_json::to_string_pretty(&json!({
"kind": "bootstrap-plan", "kind": "bootstrap-plan",
"action": "show",
"status": "ok", "status": "ok",
"phases": phases, "phases": phases,
}))? }))?
@@ -6748,6 +6751,7 @@ fn status_json_value(
let allowed_tool_entries = allowed_tools.map(|tools| tools.iter().cloned().collect::<Vec<_>>()); let allowed_tool_entries = allowed_tools.map(|tools| tools.iter().cloned().collect::<Vec<_>>());
json!({ json!({
"kind": "status", "kind": "status",
"action": "show",
"status": if degraded { "degraded" } else { "ok" }, "status": if degraded { "degraded" } else { "ok" },
"config_load_error": context.config_load_error, "config_load_error": context.config_load_error,
"config_load_error_kind": context.config_load_error_kind, "config_load_error_kind": context.config_load_error_kind,