docs: add NDJSON event schema specification#80
Conversation
Formalizes the CLI NDJSON event contract documented in cli::events into docs/specs/event-schema.md. Covers envelope format, lifecycle, progress, result, error, and generation task event types. Checks off plan item 11.2.1.
Greptile SummaryThis PR formalizes the CLI NDJSON event contract in
Confidence Score: 5/5Safe to merge — the backend.rs changes are correct, the spec accurately documents the current wire format, and the new integration tests exercise the failure path end-to-end. All previously-flagged issues (ownership timing, pretty-printing, double-emit, backendCode missing from failed-status) are addressed by this diff. The spec explicitly acknowledges which envelopes are not yet wired to CLI commands, removing the spec-vs-code mismatches from the earlier review. The only remaining gap is that the integration tests don't assert the No files require special attention; the Important Files Changed
Reviews (21): Last reviewed commit: "docs: clarify planned result event field..." | Re-trigger Greptile |
|
@greptile-ai re-review |
- Remove envelope-based lifecycle/progress/result/error sections (emit_* functions have no call sites in CLI code) - Document openloop run, pull, status, enhance JSON output - Note failed event gap and completed event suppression - Move envelope format to 'Defined but Unused' informational section
…vents" This reverts commit 79f3e2f.
- backend status/start/stop/restart: emit lifecycle events in JSON mode - run: emit error events for validation failures in JSON mode The envelope-based event functions (emit_lifecycle, emit_progress, emit_result, emit_error) now have actual call sites in CLI commands.
Backend status/start/stop/restart --json now emits one NDJSON line with lifecycle envelope fields (v, ts, kind, phase, message) merged into the status object. Previously emitted two outputs: a lifecycle event followed by pretty-printed JSON, breaking NDJSON parsers.
…n absent) - Remove serde_json::to_value(&status) which leaked serde-tagged state field alongside phase, causing potential contradictions - Use serde_json::json!() to construct clean lifecycle objects - port is always present: integer for Healthy, null otherwise - status field no longer leaks into lifecycle output
emit_error() + return Err() caused double stderr: NDJSON error line then human-format error from mod.rs::run(). Let mod.rs handle errors.
- Result Events: restore envelope format (not yet wired), point to Generation Task Events for current bare JSON behavior - Progress/Result/Error: add notes that envelope formats are defined but not yet wired to CLI commands - Notes: clarify only lifecycle events use envelope format today
|
@greptile re-review the latest commit |
|
@greptile re-review the latest commit |
|
@greptile re-review the latest commit |
|
@greptile re-review the latest commit |
Summary
Adds
docs/specs/event-schema.mdformalizing the CLI NDJSON event contract fromcli::eventsmodule.Covers:
v,ts,kind)starting,healthy,stopped,failed)pctanddetail)code,recoverable,suggestion)submitted,queued,running,downloading,completed,cancelled,failed)Checks off plan item 11.2.1.