FE-808: Broaden direct graph-tool proof beyond the A14 happy path#171
Conversation
PR SummaryLow Risk Overview Aligns agent workflows with Removes the redundant Reviewed by Cursor Bugbot for commit ede9c8e. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR advances FE-808’s “graph write contract” by persisting per-kind node ordinals (projected node codes), normalizing graph approval basis to explicit|implicit, tightening supersession/active-context projections, and aligning probe transcripts with Pi-derived LLM-visible context. It also adds a dev seed-fixture substrate (npm run seed) that loads consolidated fixtures through the CommandExecutor mutation boundary.
Changes:
- Persist
nodes.kind_ordinalwith per-(spec, plane, kind)monotonic allocation (node_kind_counters), expose projected node codes, and add selected-spec code → node id resolution. - Normalize graph basis semantics (
explicit|implicit), retireaccepted_review_set, and route tool/adapter paths through projected codes (no raw node ids in agent tools). - Introduce transcript projection + formatting modules and add a seed-fixture loader + tests, plus probe/report updates.
Reviewed changes
Copilot reviewed 104 out of 119 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/structured-exchange/project/request-review.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/request-choices.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/request-choice.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/request-answer.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/present-review-set.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/present-question.ts | Implement canonical projection for present_question. |
| src/structured-exchange/project/present-options.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/present-candidates.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/capture-review.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/capture-choices.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/capture-choice.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/capture-candidate.ts | Add intentional projection seam stub. |
| src/structured-exchange/project/capture-answer.ts | Add intentional projection seam stub. |
| src/structured-exchange/format/request-review.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/request-choices.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/request-choice.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/request-answer.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/present-review-set.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/present-question.ts | Implement markdown formatting for projected present_question. |
| src/structured-exchange/format/present-options.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/present-candidates.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/capture-review.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/capture-choices.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/capture-choice.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/capture-candidate.ts | Add intentional formatting seam stub. |
| src/structured-exchange/format/capture-answer.ts | Add intentional formatting seam stub. |
| src/session/session-transcript.ts | Replace bespoke transcript rendering with projection+formatter pipeline. |
| src/session/session-transcript.test.ts | Update transcript expectations to Pi-derived projection/markdown rendering. |
| src/session/project/transcript-context.ts | New Pi-derived transcript projection (filter to markdown-bearing content). |
| src/session/format/transcript.ts | New transcript markdown formatter. |
| src/rpc/handlers.test.ts | Update tests for commitGraph created-node result shape. |
| src/render/toon.ts | Add intentional TOON formatting substrate stub. |
| src/render/markdown.ts | Add shared markdown helpers for formatters. |
| src/probes/public-rpc-parity-proof.test.ts | Update transcript assertions to new tool-result headings. |
| src/probes/propose-graph-commit-proof.test.ts | Expand proof scenarios + adapt to created-node/code evidence. |
| src/graph/workspace-store.ts | Add selected-spec resolveNodeCode reader. |
| src/graph/spec-ownership.test.ts | Update node-id assertions + strengthen tool-schema specId guard checks. |
| src/graph/snapshot.ts | Add graph projections, node code resolver, kindOrdinal mapping, edge filtering. |
| src/graph/snapshot.test.ts | Extend tests for code metadata, kindOrdinal, active vs truth projections. |
| src/graph/seed-fixtures.ts | New consolidated seed-fixture loader + CLI (npm run seed). |
| src/graph/seed-fixtures.test.ts | New tests proving loader runs through command boundary and preserves clock/log. |
| src/graph/schema/nodes.ts | Add kind metadata, projected-code parse/format, and kindOrdinal on GraphNode. |
| src/graph/schema/edges.ts | Update basis semantics comment for `explicit |
| src/graph/README.md | Update topology/docs for new commitGraph planner and code/ordinal contract. |
| src/graph/project/reconciliation-needs.ts | Add intentional projection seam stub. |
| src/graph/project/overview.ts | Add intentional projection seam stub. |
| src/graph/project/neighborhood.ts | Implement neighborhood projection using projected codes. |
| src/graph/project/commit-result.ts | Add intentional projection seam stub. |
| src/graph/index.ts | Re-export projected-code helpers and new overview option types. |
| src/graph/format/reconciliation-needs.ts | Add intentional formatter seam stub. |
| src/graph/format/overview.ts | Add intentional formatter seam stub. |
| src/graph/format/neighborhood.ts | Implement neighborhood formatting for projected neighborhood. |
| src/graph/format/commit-result.ts | Add intentional formatter seam stub. |
| src/graph/command-executor/commit-graph-types.ts | New commitGraph input/result types (created node identity includes code). |
| src/graph/command-executor/commit-graph-batch.ts | New shared batch planner (validation, supersession cycle detection). |
| src/db/schema.ts | Persist kind_ordinal, add unique index, add node_kind_counters, update bases. |
| src/db/row-schemas.ts | Add typebox schemas for node_kind_counters. |
| src/db/README.md | Document new ordinal/counter storage contract. |
| src/brunch-tui.ts | Thread resolveNodeCode into runtime snapshots. |
| src/agents/contexts/node.ts | Switch node context rendering to projected neighborhood formatter. |
| src/agents/contexts/node.test.ts | Update expectations to projected codes in node context. |
| src/agents/contexts/graph.ts | Render graph context nodes/edges using projected codes. |
| src/agents/contexts/graph.test.ts | Add kindOrdinal in graph context fixtures. |
| src/.pi/extensions/structured-exchange/present-question.ts | Route tool through project + format seam for durable details/content. |
| src/.pi/extensions/graph/tool-schemas.ts | Update tool schemas to use projected codes (existingCode, nodeCode). |
| src/.pi/extensions/graph/review-set-proposal.ts | Make review-set translation basis: 'explicit' and remove per-item basis. |
| src/.pi/extensions/graph/index.ts | Resolve node codes in adapters; return STRUCTURAL_ILLEGAL (no throws) for bad codes. |
| src/.pi/extensions/graph/command-adapter.ts | Resolve existingCode → node id, format created nodes by code, export diagnostics formatter. |
| src/.pi/tests/structured-exchange-present-request.test.ts | Add test proving present_question uses shared project+format seam. |
| src/.pi/tests/review-set-proposal.test.ts | Assert review-set commits are explicit and don’t leak per-item basis fields. |
| src/.pi/tests/prompting.test.ts | Update prompt context fixtures for kindOrdinal + snapshots API addition. |
| src/.pi/tests/graph-tools.test.ts | Update schemas + adapters tests for projected codes and created-node result shape. |
| package.json | Add npm run seed. |
| memory/SPEC.md | Update FE-808 evidence claims and test coverage references. |
| memory/PLAN.md | Mark FE-808 done; add dev seed-fixtures frontier; archive notes. |
| memory/cards/graph-tool-resilience--graph-write-contract.md | Delete completed scope card. |
| drizzle/meta/_journal.json | Record new migration. |
| drizzle/0001_aspiring_orphan.sql | Add node_kind_counters + nodes.kind_ordinal + unique indexes. |
| docs/archive/PLAN_HISTORY.md | Archive FE-808 closeout notes. |
| docs/architecture/probes-and-transcripts.md | Update transcript.md description. |
| AGENTS.md | Document “intentional topology stubs” convention. |
| .fixtures/seeds/bilal-port/README.md | Update seed fixture location and consolidated contract docs. |
| .fixtures/seeds/bilal-port/_port-script.ts | Update port script to consolidated contract + self-validation through loader. |
| .fixtures/runs/propose-graph-commit/2026-06-04-retry-diagnostics/transcript.md | Add new probe transcript artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-retry-diagnostics/session.jsonl | Add new probe session artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-retry-diagnostics/report.json | Add new probe report artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-existing-code-ref/transcript.md | Add new probe transcript artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-existing-code-ref/session.jsonl | Add new probe session artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-existing-code-ref/report.json | Add new probe report artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-ambiguity-no-overcommit/transcript.md | Add new probe transcript artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-ambiguity-no-overcommit/session.jsonl | Add new probe session artifact. |
| .fixtures/runs/propose-graph-commit/2026-06-04-ambiguity-no-overcommit/report.json | Add new probe report artifact. |
| .agents/skills/ln-review/SKILL.md | Add deletion-guard guidance for intentional topology stubs. |
| .agents/skills/ln-plan/references/earned.md | Add deletion-guard guidance for intentional topology stubs. |
| .agents/skills/ln-judo-review/SKILL.md | Add deletion-guard guidance for intentional topology stubs. |
| .agents/skills/ln-build/SKILL.md | Add deletion-guard guidance for intentional topology stubs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CREATE TABLE `node_kind_counters` ( | ||
| `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
| `spec_id` integer NOT NULL, | ||
| `plane` text NOT NULL, | ||
| `kind` text NOT NULL, | ||
| `next_ordinal` integer DEFAULT 1 NOT NULL, | ||
| FOREIGN KEY (`spec_id`) REFERENCES `specs`(`id`) ON UPDATE no action ON DELETE no action | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE UNIQUE INDEX `node_kind_counters_spec_plane_kind_unique` ON `node_kind_counters` (`spec_id`,`plane`,`kind`);--> statement-breakpoint | ||
| ALTER TABLE `nodes` ADD `kind_ordinal` integer NOT NULL;--> statement-breakpoint | ||
| CREATE UNIQUE INDEX `nodes_spec_plane_kind_ordinal_unique` ON `nodes` (`spec_id`,`plane`,`kind`,`kind_ordinal`); No newline at end of file |
8a9ab43 to
be0b42b
Compare
03a8137 to
3304114
Compare
Amp-Thread-ID: https://ampcode.com/threads/T-019e92bc-e43a-727f-8acf-0213915029ff Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019e92bc-e43a-727f-8acf-0213915029ff Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019e92bc-e43a-727f-8acf-0213915029ff Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019e92bc-e43a-727f-8acf-0213915029ff Co-authored-by: Amp <amp@ampcode.com>
Restructure .fixtures/seed-specs/ into .fixtures/seeds/bilal-port/ with
vendored Bilal originals under _originals/, the throwaway port script, and
one consolidated <slug>.json per spec ({spec, nodes, edges}).
Fix the port script's basis mapping: epistemicStatus no longer maps to the
invalid 'accepted_review_set' basis (forbidden per GRAPH_MODEL.md). Bilal
authored each item directly, so every ported node is 'explicit'; the
epistemic flavor is preserved in source text instead.
Add src/graph/seed-fixtures.ts: a loader that commits each consolidated
fixture through CommandExecutor (createSpec + one explicit commitGraph
batch) so graph clock / change log / lsn stay coherent. Lives in graph/
(not db/) to respect the db/ <- graph/ dependency direction. Exposed via
'npm run seed'; covered by src/graph/seed-fixtures.test.ts.
Amp-Thread-ID: https://ampcode.com/threads/T-019e91ee-aa39-73d2-a346-a0ae1e55e3b9
Co-authored-by: Amp <amp@ampcode.com>
The port script now runs each assembled seed through seedFixture against a throwaway in-memory DB before writing <slug>.json, reusing the exact structural validation commitGraph enforces (planCommitGraph: node kind/plane/detail + edge category/stance/ref/cycle checks). A seed that would not commit cleanly aborts the run instead of producing an unloadable fixture. Amp-Thread-ID: https://ampcode.com/threads/T-019e91ee-aa39-73d2-a346-a0ae1e55e3b9 Co-authored-by: Amp <amp@ampcode.com>
Capture the landed seed-fixture substrate (consolidated {spec,nodes,edges}
contract, src/graph/seed-fixtures.ts loader, npm run seed, self-validating
port scripts) and the two enhancement ideas as backlog: (1) enrich
Bilal-port graphs through Brunch from the original briefs to recover
thesis/goal structure, (2) port + enhance the legacy product fixtures.
Notes manual-testing.md seed-doc drift for the doc-reconciliation track.
Amp-Thread-ID: https://ampcode.com/threads/T-019e91ee-aa39-73d2-a346-a0ae1e55e3b9
Co-authored-by: Amp <amp@ampcode.com>
3304114 to
ede9c8e
Compare
| ALTER TABLE `nodes` ADD `kind_ordinal` integer NOT NULL;--> statement-breakpoint | ||
| CREATE UNIQUE INDEX `nodes_spec_plane_kind_ordinal_unique` ON `nodes` (`spec_id`,`plane`,`kind`,`kind_ordinal`); No newline at end of file |

Summary
Hardens direct graph-tool behavior beyond the first happy path: stable graph handles, persisted kind ordinals, explicit/implicit basis normalization, reference resolution, supersession cycle protection, and probe-backed graph resilience checks.
Verification
Covered by graph command/tool, projection, seed-loader, and probe fixture tests; latest top-of-stack verification passed via
npm run verify.