refactor(#3309): extend planning-snapshot.cts with config/agentInstall/worktreeHealth
Phase 11 of epic #3180 (ADR-3180 §8.2/§8.3/§8.5) foundation. Extends the already-merged Phase-10 PlanningSnapshot additively with three fields the upcoming health-diagnostic rule table needs and Phase 10 never required: - config: {value, scope, exists} — parsed .planning/config.json. `exists` distinguishes absent (no diagnostic, non-answer) from present-but-invalid (CONFIG_UNREADABLE diagnostic, corruption) — both collapse to scope UNREADABLE, so a rule needs the extra bit to tell "not configured yet" apart from "config.json is broken." - agentInstall / worktreeHealth — not .planning/-sourced, wrap the existing checkAgentsInstalled/inspectWorktreeHealth owners with the same arguments cmdValidateHealth already passes them, so a later migration step reads these fields instead of calling the owners itself. Adds CONFIG_UNREADABLE to src/unusable-input.cts's UNUSABLE_REASON (eighth #1879 site), mirroring STATE_UNREADABLE's exact shape from Phase 10. Additive only — the four Phase-10 fields and worstScope/buildPhaseSnapshot are unchanged; existing tests for them are untouched.
This commit is contained in:
@@ -64,6 +64,13 @@ const UNUSABLE_REASON = Object.freeze({
|
||||
* planning-snapshot's current-phase field)
|
||||
*/
|
||||
STATE_UNREADABLE: 'state_unreadable',
|
||||
/**
|
||||
* A config.json exists but could not be read/parsed (EACCES/EIO/malformed JSON/…).
|
||||
* Distinct from a project that has not run any config-writing command yet: absence
|
||||
* returns the same non-answer, silently — only an exists-but-unreadable config.json
|
||||
* is corruption. (#3309, eighth #1879 site — planning-snapshot's config field)
|
||||
*/
|
||||
CONFIG_UNREADABLE: 'config_unreadable',
|
||||
} as const);
|
||||
|
||||
type UnusableReason = (typeof UNUSABLE_REASON)[keyof typeof UNUSABLE_REASON];
|
||||
@@ -78,6 +85,8 @@ const REASON_PROSE: Readonly<Record<UnusableReason, string>> = Object.freeze({
|
||||
'last_activity in STATE.md is present but unparseable as a date; stale_activity fell back to false (idle-stranded suppressed)',
|
||||
[UNUSABLE_REASON.STATE_UNREADABLE]:
|
||||
'STATE.md exists but could not be read; the current-phase label fell back to unavailable',
|
||||
[UNUSABLE_REASON.CONFIG_UNREADABLE]:
|
||||
'config.json exists but could not be read or parsed; the config field fell back to unavailable',
|
||||
});
|
||||
|
||||
// ─── Dedup state ──────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user