docs(research): plan AI client receipt and lineage corrections

This commit is contained in:
Boki 2026-10-27 16:50:41 -04:00
parent fe3fd55610
commit 14b28a3428
6 changed files with 84 additions and 4 deletions

View file

@ -0,0 +1,13 @@
# RP15 — Preserve research CLI recovery receipts after journal failure
Parent E12. Priority P1 / High recovery defect. Complexity S. Dependency A03. Owner continuation authorizes this correction.
Verified baseline: `scripts/examples/research-cycle.ts` preserves an accepted resource in `ResearchCycleStopped.event` when journal persistence fails, but its executable catch prints only the message. A no-network subprocess probe runs the actual CLI, accepts one hypothesis, fails the second journal write, and exits with only an intent in the journal and no accepted IDs in output. Evidence: `/tmp/stock-bot-cycle-journal-probe/`. A subsequent `journal.close()` failure can also mask the primary error.
Scope: emit structured recovery evidence from the existing stopped event at the CLI boundary. Preserve exact accepted resource/revision IDs, operation, input, key and resource identity. Keep exit status nonzero and stop subsequent admissions. Cleanup failures must not suppress the primary recovery evidence. Do not label unacknowledged work accepted. Keep successful output compatible and fresh/exclusive journal creation unchanged. No automatic replay, silent fallback journal, client framework, credential output or backend/financial changes.
Ownership: agent owns `scripts/examples/research-cycle.ts`, `scripts/test/research-cycle.test.ts` and one small subprocess preload fixture if needed. Root owns docs/manifest, combined gates and commits. Parallel with RP16, which owns the client and its tests. Independent review required.
Acceptance/tests: run the actual executable with deterministic no-network fetch and journal faults after server acceptance; assert exact recovery event in stderr, empty success output, exit 1, original intent retained and no later mutation. Cover write/sync failure and a simultaneous close failure; ordinary pre-admission errors must not invent receipts or reveal the credential. Existing callable receipt/cancellation and successful workflow tests remain green.
Gates: research-cycle/client tooling suites, subprocess recovery regressions, authored types, scoped lint/formatting, root repository check. No browser suite required for a CLI-only change. Existing untrusted-candidate isolation and research authorization stay unchanged.

View file

@ -0,0 +1,13 @@
# RP16 — Accept automatic lineage in AI strategy publication
Parent E12. Priority P1 / High workflow defect. Complexity S. Dependencies A03 and R01. Owner continuation authorizes this correction.
Verified baseline: `ResearchClient.publishVersion` requires the response parent to equal its default null input. `StrategyCatalogService.publishVersion` instead assigns the latest version when no explicit parent is supplied. A real PostgreSQL probe with a provisioned research-agent credential confirms the first publication succeeds, the second and same-key retry return valid 201 receipts with the first version as parent, and exactly two rows exist, while the client rejects both receipts. Evidence: `/tmp/stock-bot-rp16-baseline.log`. The earlier service-credential probe was invalid because this client requires agent-created records; it is not regression evidence.
Scope: validate an explicit non-null parent exactly; accept and retain the server-assigned lineage when null requests automatic selection. Preserve schema/UUID, candidate origin, family and package hash checks, captured body and receipt key. Document null semantics beside the method. No extra lookup, catalog policy change, automatic retry, auth expansion or financial change.
Ownership: agent owns `scripts/research-client.ts` and `scripts/test/research-client.test.ts`. Root owns the real-agent regression in `test/postgres/ai-research-workflow.test.ts`, shared validation/docs and commits. Parallel with RP15; independent review required.
Acceptance/tests: first publication accepts null lineage; later default/null publication accepts the actual earlier version ID. Explicit parent mismatch still fails. Wrong family/origin/hash/invalid parent shape still fails. A repeated exact receipt recovers the same version even after a later publication becomes latest; it sends identical body/key, creates no duplicate and never executes candidate code. Verify these normal paths through real authorized routes and PostgreSQL with the existing fixture.
Gates: focused client/cycle tooling tests, authored types, scoped lint/formatting, root repository check, real PostgreSQL AI workflow tests. No browser change or browser suite needed. Preserve backend lineage and all existing authorization rules.