6 Commits

Author SHA1 Message Date
YeonGyu-Kim
ce352f4750 docs(#172): correct action-field inventory claim (4 → 3 verbs) + regression guard
Pinpoint #172: SCHEMAS.md v1.5 Emission Baseline documentation inaccuracy
discovered during cycle #98 probe.

The Phase 1 normalization targets section claimed:
  "unify where `action` field appears (only in 4 inventory verbs)"

But reality is only 3 inventory verbs have `action`:
  - mcp
  - skills
  - agents

list-sessions uses `command` instead (the documented 1-of-13 deviation
already captured elsewhere in v1.5 baseline).

This is a doc-truthfulness issue (same family as cycles #76, #79, #82).
Active misdocumentation leads downstream consumers to assume 4-verb
coverage when building adapters/dispatchers.

Changes:
1. SCHEMAS.md: 'only in 4 inventory verbs' → 'only in 3 inventory verbs: mcp, skills, agents'
2. Added regression test `v1_5_action_field_appears_only_in_3_inventory_verbs_172`
   - Asserts mcp/skills/agents HAVE action field
   - Asserts help/version/doctor/status/sandbox/system-prompt/bootstrap-plan/list-sessions do NOT have action field
   - Forces SCHEMAS.md + binary to stay synchronized

Test added:
- `v1_5_action_field_appears_only_in_3_inventory_verbs_172` (8 negative cases + 3 positive cases)

Tests: 227/227 pass (+1 from #172).

Related: #155 (doc parity family), #168c (emission baseline).
Doc-truthfulness family: #76, #79, #82, #172.
2026-04-23 08:32:59 +09:00
YeonGyu-Kim
e1b0dbf860 docs(#168c Task 3): add v1.5 Emission Baseline per-verb shape catalog to SCHEMAS.md
Phase 0 Task 3 of the JSON Productization Program: per-verb emission inventory.

Documents the actual binary behavior as of v1.5 (post-#168c fix, pre-Phase 1
shape normalization). Reference artifact for consumers building against v1.5,
not a target schema.

Catalog contents:
- 12 verbs using 'kind' field (help, version, doctor, mcp, skills, agents,
  sandbox, status, system-prompt, bootstrap-plan, export, acp)
- 1 verb using 'command' field (list-sessions) — Phase 1 normalization target
- 3 error-only verbs in test env (bootstrap, dump-manifests, state)
- Standard error envelope: {error, hint, kind, type} flat shape
- 9 machine-readable error kinds from classify_error_kind

Emission contract locked by:
- Task 1 (#168c routing fix, cycle #89)
- Task 2 (no-silent guarantee test, cycle #90)
- This catalog (human-readable reference, cycle #91)

Consumer guidance + Phase 1 normalization targets documented.

Phase 0 progress:
- Task 1 Stream routing fix
- Task 2 No-silent guarantee test
- Task 3 Per-verb emission inventory
- Task 4 pending: CI parity test

Refs: #168c, cycle #91, Phase 0 Task 3
2026-04-23 06:36:01 +09:00
YeonGyu-Kim
4c9a0a9992 docs: SCHEMAS.md — critical P0 fix: mark as target v2.0, not current v1.0 (#166 filed+closed)
SCHEMAS.md was presenting the target v2.0 schema as the current binary contract.
This is the source of truth document, so the misdocumentation propagated to every
downstream doc (USAGE.md, ERROR_HANDLING.md, CLAUDE.md all inherited the false
premise that v1.0 includes timestamp/command/exit_code/etc).

Fixed with:
1. CRITICAL header at top: marks entire doc as v2.0 target, not v1.0 reality
2. 'TARGET v2.0 SCHEMA' headers on Common Fields section
3. Comprehensive Appendix: v1.0 actual shape + migration timeline + v1.0 code example
4. Links to FIX_LOCUS_164.md + ERROR_HANDLING.md for v1.0 reality
5. FAQ: clarifies the version mismatch and when v2.0 ships

This closes the fourth P0 doc-truthfulness instance (4/4 in family):
- #78 USAGE.md: active misdocumentation (fixed #78)
- #79 ERROR_HANDLING.md: copy-paste trap (fixed #79)
- #165 CLAUDE.md: boundary collapse (fixed #81)
- #166 SCHEMAS.md: aspirational source doc (fixed #82)

Pattern is now crystallized: SCHEMAS.md was the aspirational source;
three downstream docs (USAGE, ERROR_HANDLING, CLAUDE) inherited the false v2.0-as-v1.0
claim. Fix the source (SCHEMAS.md), which eliminates the root cause for all four.
2026-04-23 05:21:07 +09:00
YeonGyu-Kim
f05bc037de docs(#250, #251): Align SCHEMAS.md with actual binary, downgrade #250 to scope-reduced
Cycle #46 follow-up to cycle #45's #251 implementation. Closes #250's
implementation urgency by aligning docs with reality.

SCHEMAS.md Updates:
For each of the 4 session-management verbs, added:
1. Status marker (Implemented or Stub only)
2. Actual binary envelope (shape produced by the #251-fixed binary)
3. Aspirational (future) shape (original SCHEMAS.md content, preserved as target)
4. Gap notes where the two diverge

Per-verb status:
- list-sessions: Implemented, nested field layout
- load-session: Implemented, nested session object with local session_not_found error
- delete-session: Stub, emits not_yet_implemented (local error, not auth)
- flush-transcript: Stub, emits not_yet_implemented (local error, not auth)

ROADMAP.md Updates:
- #251 marked CLOSED: Full status with commit ref, test counts.
- #250 marked SCOPE-REDUCED: Option A resolved by #251, Option C moot,
  only Option B (doc alignment) remains as future cleanup.

Why this matters:
Every code change should close its documentation loop. #251 landed on
the branch, but SCHEMAS.md still described aspirational shapes without
marking which were implemented. Claws reading SCHEMAS.md would have
assumed full conformance and hit surprises. Now the document tells the
truth about which verbs work, which are stubs, and why.

Related:
- #251 implementation on feat/jobdori-251-session-dispatch branch
- #250 scope-reduced to Option B (field-name harmonization)
- #145/#146 parser fall-through fix precedent
2026-04-23 01:28:33 +09:00
YeonGyu-Kim
97c4b130dc feat: #164 Stage B prep — add cancel_observed field to TurnResult
#164 Stage B requires exposing whether cancellation was observed at the
turn-result level. This commit adds the infrastructure field:

Changes:
- TurnResult.cancel_observed: bool = False (query_engine.py)
- _build_timeout_result() accepts cancel_observed parameter (runtime.py)
- Two timeout paths now pass cancel_event.is_set() to signal observation (runtime.py)
- bootstrap command includes cancel_observed in turn JSON (main.py)
- SCHEMAS.md documents Turn Result Fields with cancel_observed contract

Usage:
  When a turn timeout occurs, cancel_observed=true indicates that the
  engine observed the cancellation event being set. This allows callers
  to distinguish:
    - timeout with no cancel → infrastructure/network stall
    - timeout with cancel observed → cooperative cancellation was triggered

Backward compat:
  - Existing TurnResult construction without cancel_observed defaults to False
  - bootstrap JSON output still validates per SCHEMAS.md (new field is always present)

Test results: 182 passing, 3 skipped, zero regression.

Related: #161 (wall-clock timeout), #164 (cancellation observability protocol)
ROADMAP continues #164 with Stage C (test coverage for cancellation + turn envelope).
2026-04-22 19:44:47 +09:00
YeonGyu-Kim
40c17d8f2a docs: add SCHEMAS.md — field-level JSON contract for clawable CLI surfaces
Documents the unified JSON envelope contract across all 13 clawable-surface
commands. Extends the parity work (#171) to the field level: every command
that accepts --output-format json must emit predictable field names,
types, and optionality.

Common fields (all envelopes):
  - timestamp (ISO 8601 UTC)
  - command (argv[1])
  - exit_code (0/1/2)
  - output_format ('json')
  - schema_version ('1.0')

Error envelope (exit 1, failure):
  - error.kind (enum: filesystem|auth|session|parse|runtime|mcp|delivery|usage|policy|unknown)
  - error.operation (syscall/method name)
  - error.target (resource path/name)
  - error.retryable (bool)
  - error.message (platform error text)
  - error.hint (optional: actionable next step)

Not-found envelope (exit 1, not a failure):
  - found: false
  - error.kind (enum: command_not_found|tool_not_found|session_not_found)
  - error.message, error.retryable

Per-command success schemas documented for 13 commands:
  list-sessions, delete-session, load-session, flush-transcript,
  show-command, show-tool, exec-command, exec-tool, route, bootstrap,
  command-graph, tool-pool, bootstrap-graph

Why this matters:
- #171 enforced that commands have --output-format; #172 enforces that
  the JSON fields are PREDICTABLE
- Downstream claws can build ONE error handler + per-command jq query,
  not special-casing logic per command family
- Field consistency enables generic automation patterns (error dedupe,
  failure aggregation, cross-command monitoring)

Related:
- ROADMAP #172 (field-level contract stabilization, Gaebal-gajae priority #1)
- ROADMAP #171 (parity audit CI automation — already landed)
- #164 Stage B (cancellation observability — adds cancel_observed field)
- #164 Stage A (already done — adds stop_reason field to TurnResult)

Fixture/regression testing:
- Golden JSON snapshots: tests/fixtures/json/<command>.json (future)
- Consistency test: test_json_envelope_field_consistency.py (future)
- Versioning: schema_version='1.0' for current; bump to 2.0 for breaking changes
2026-04-22 19:13:04 +09:00