feat(core): headless core contract — RunResult / RunReporter / CancelToken / error taxonomy (#363) #364
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.65) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 330 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #364"
general
weight: 0.35
bosd
First step of #363: the typed headless core contract, so Fluvo's capabilities can be driven by consumers other than the terminal (a server process, an automation layer, a GUI) without re-implementing orchestration or scraping the CLI's human-facing output.
This PR adds the vocabulary only — no command changes behaviour. Migrating
assess/compareto returnRunResultand report viaRunReporter, and the later import-engine retrofit, are follow-on work on the same issue.What's here —
fluvo.lib.coreRunResult+ReconStats— one typed outcome for every capability, carrying the reconciliation counters the e2e suite already asserts (created + failed + unaccounted == total). The identity is a write-path property: read-only capabilities leave the counters at their reconciled default and report findings through their own result types.RunErrorcaptures a typed, serialisable error record so a result can cross a process/protocol boundary.RunReporterprotocol +NullReporter— progress reporting decoupled fromrich. The core callson_phase/on_progress/on_message; adapters (a rich reporter for the CLI, a notification reporter for a server, a queue/stream reporter for a UI) live with their consumer, not in the core.coreimports nothing presentation-specific.CancelToken— an externally settable, thread-safe stop signal (threading.Event-backed), replacing "the only way to stop is Ctrl+C on the main thread". Any thread maycancel(); a worker checkscancelled/raise_if_cancelled()between units of work.FluvoErrortaxonomy —InputError,ConnectError(named so it never shadows the built-inConnectionError),SourceReadError,NothingToDoError,OperationCancelledError— so no consumer has to read aNonereturn as "fatal".exit_codecarries the CLI adapter's default mapping.CompareErrornow subclassesFluvoError(still aRuntimeError, so existingexcept CompareErrorhandlers are unaffected).Design note surfaced while writing it
The reconciliation identity is a write-path invariant. An early draft let a read-only run put "rows looked at" in
total, which breaks the identity (total=500with empty buckets ≠ reconciled). Corrected: read-only runs leaveReconStatsat zero; any row counted-but-not-written belongs in an explicit bucket. There's a regression test for exactly this.Checks
tests/test_core.py— 23 tests (identity, status, cancel across threads, taxonomy, protocol conformance). Full suite green.