Retire the parts of the record's model that nothing writes - #614
Merged
Merged
Conversation
Removes the Review label, the edge labels REVERIFIES, GRADES, KEEPS, SHARPENS, EVALUATES and INVALIDATED_BY, and the endpoint pairs no verb writes: MOTIVATES Decision->Question and Decision->Computation, SUPERSEDES Decision->Computation, CLOSES Decision->Gate, BASED_ON Decision->Review, GATES Gate->Computation, PRODUCES Task->Computation and Task->Artefact, and CONCERNS/MENTIONS Note->Review. Removes the retracted property: the per-label hide_retracted RLS policy that provisioning installed, and the retracted filters in the HAL read functions (migration 0020). Removes "undecided" from ClaimProps.kind. Removes the reads of these shapes: reverifiedBy and the "Re-checked by" view, analysisRevision (why <analysis> keeps its live-edge walk), and the review kind in why and search. Removes UnitOfWork.set/setEdge, the NodePropsChanged and EdgePropsChanged changes, snapshotPriorValues, and the TenantGraph methods only they called. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWZHuy7xJbVqxyLipnvwdY
danbarua
enabled auto-merge (squash)
October 1, 2026 01:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes everything in the record's model that no verb writes: the
Reviewlabel, six edge labels, nine endpoint pairs, theretractedproperty and its RLS policy,"undecided"as a claim kind, and the reads and the property-change path that only served them.What was removed, item by item
Reviewlabel. Removed fromNODE_LABELS,NODE_TYPES(prefixREV),NodePropsByLabel,SEARCHABLE_TEXTandReviewPropsinpackages/core-db/domain.ts; provisioning no longer creates the label. Thereviewkind is gone fromLABEL_BY_KIND,WalkedKind, thewhyexplainers and theexplanationschema, fromsearch's handle type, and from the CLIwhyview.labkit_get_label_for_handleno longer mapsREV.REVERIFIES,GRADES,KEEPS,SHARPENS,EVALUATES,INVALIDATED_BY. Removed fromEDGE_LABELS,EDGE_SCHEMAand thewhyphrase table.packages/core-domain/write/*.ts; no live write produces any of them, so all nine are removed:pose --fromandopenEnquirytake aNoteRef(asking.ts:37,:187).shared.ts:255) or a Criterion (counting.ts:207), and SUPERSEDES only a Claim, Criterion or Decision.stopping.ts:118) or work (stopping.ts:220).protectingisref("work"), which is a Task (counting.ts:98).work.ts:45,shared.ts:176-177,:243).NODE_LABELS, so they go with the label.retractedand"undecided". Provisioning no longer installs<label>_hide_retractedor enables row-level security on label tables. Migration0020_hal_reads_drop_review_and_retracted(frombun run db:generate:custom) replaceslabkit_get_label_for_handle,labkit_get_entity_as_halandlabkit_get_collection_as_halwith their latest bodies minus theretracted IS NULLfilters and theREVprefix.ClaimProps.kindis"exploratory" | "confirmatory".reverifiedBy, the REVERIFIES query inwhySupportedand the "Re-checked by" view.analysisRevisionas a whole: its query, schema, report type and read-surface method. Only its first-run branch was reachable, sowhy <analysis>keeps that output (is: "a first run"and the live-edge walk) and losesreport. The CLI and MCPwhydescriptions no longer say "what it revised" or list "review".UnitOfWork.setandsetEdge, which had no callers. With them goNodePropsChangedandEdgePropsChanged(fromGraphChange, the zod change schemas,applyDelta,touchedInand thetouchingfilter),snapshotPriorValues, and the fourTenantGraphmethods only they called:setNodeProperty,nodePropertiesOf,edgePropertiesOf,setEdgeProperties.Kept
packages/core-domain/read/checks.ts(retracted(v), behindwithdrawn: trueandno-standing-verdict). It readsDecision -SUPERSEDES-> Claim, whichwrite/shared.ts:254writes, and the S-3c anddomain-sessionwithdrawn-verdict tests exercise it. Despite its name, it does not read theretractedproperty.retractedArtefactsinread/story.ts. It is computed from superseded findings, and S-11e depends on it.Beyond the brief
Removing
setEdgeleavesEdgePropsChangedandTenantGraph.setEdgeProperties/edgePropertiesOf/nodePropertiesOf/setNodePropertywith only test callers. Following the brief's rule that a persistence test is not a caller, they are removed, and so istests/persistence/edge-properties.test.ts. That file's fixture named #440, which is closed.Not done:
scripts/db/project-museum.ts~/labkit-museum-events.jsonholds 2Reviewnodes, 1 REVERIFIES, 1 KEEPS, 2 EVALUATES, 2 INVALIDATED_BY and 4NodePropsChangedchanges, and the script'sVERB_WORDmaps NARROWS to SHARPENS. The script can no longer project that file. This PR leaves the script untouched. Deleting the script or keeping the museum is a decision for Dan.Follow-ups
bun run db:generatewithschema.tsunchanged emitsDROP POLICY "labkit_event_tenant_isolation"andDROP TABLE "labkit_event". This is drift between the snapshot and the schema that was already there; the generated file was discarded. The next realschema.tsedit will include that DROP TABLE.drizzle/0002and0007create 13 per-label sequences (public.labkit_review_natural_id_seqamong them). Nothing has used them since the workspace sequence replaced them, and no migration drops them.why <analysis>still answers "a first run", which no longer contrasts with anything.Evidence
Tests, full
bun testwritten to a file:The 12 fewer tests are: 7 in
edge-properties.test.ts, 1 inevents-are-deltas.test.ts(property set in place), 2 retracted-node tests inapp-web/tests/api.test.ts, and theReviewcase of the two tests that loop overNODE_LABELS. Of the further 8 after the rebase, #612 removed 9 tests and added 1.bun run check:quick: all 25 passed, before and after the rebase.bun run bonsai:recordinto a fresh--db:OK: the live event stream and graph state are exactly what the scripts produce, commit hashes and clocks aside.andOK: record built (…), replay clean.No tracked file changed.CLI (
bun run cli:build,LABKIT_DB_URLunset, every call with--db), on the Bonsai record:whyon the first handle of every kind, exit 0 for each: Q_1, LOE_2, EU_3, EV_3, CLM_6, DEC_8, CRIT_4, CEVAL_7, GATE_16, ART_3, COMP_5 ("a first run because", 11 lines), TASK_14, and NOTE_408. NOTE_408 is a note written on Q_1 that mentions Q_1 and GATE_16;whylists both mentions andsearch "a note on"finds it.labkit dump(1140KB) thenlabkit restore --intoa new directory, thenwhyon the same 13 handles in the restored record: exit 0 for each, with the same first lines.🤖 Generated with Claude Code
https://claude.ai/code/session_01FWZHuy7xJbVqxyLipnvwdY