4 Commits

Author SHA1 Message Date
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