Skip to content

docs(1283): name the edge exception, refresh the contract memo, pin the synth exclusion - #1353

Merged
github-actions[bot] merged 5 commits into
mainfrom
docs/issue-1283-contract-sweep
Aug 5, 2026
Merged

docs(1283): name the edge exception, refresh the contract memo, pin the synth exclusion#1353
github-actions[bot] merged 5 commits into
mainfrom
docs/issue-1283-contract-sweep

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Three corrections found by verifying #1283's acceptance criteria against main
rather than against the issue's comment history. All three are cases where a
document or a test asserts coverage that the code does not have — which is the
same defect #1283 was filed about, so leaving them in place while closing the
issue would have been self-refuting.

1. docs: the log-as-truth claim was still unqualified in four places

The #1309 sweep for AC1 corrected PHILOSOPHY.md's Append-only substrate note
and the write-log-as-truth memo. Four other live passages still told readers
that edges are a materialized projection of the log as shipped fact:

file claim
docs/user/LIMITATIONS.md "the view-flip that makes beliefs / edges a materialized projection of the log shipped under #265"
docs/design/feature-doc-linker.md "ingest_log is the source of truth, materialised tables (beliefs, edges, …) are derived" — under a header reading Status: implementation shipped
docs/concepts/HARNESS_INTEGRATION.md "Bit-level reproducible — write log replay reconstructs every state"
docs/concepts/PHILOSOPHY.md "Replay the write log on the same code; you get the same result"

The last one is the sharpest: PHILOSOPHY.md stated the unqualified form in its
determinism commitments 156 lines above its own caveat. The pointer now sits
with the claims it qualifies.

2. docs(design): the contract memo said the recompute does not exist

write-log-as-truth.md still read "Until that recompute exists, points 3 and 4
below are also edge-incomplete"
. That went stale when #1336 merged.

It also omitted the rowid-exclusion rationale, which is the load-bearing half of
the 2026-08-01 ruling: the writer orders on (created_at, rowid), that rowid
is implicit under id TEXT PRIMARY KEY, VACUUM may renumber it, and it
survives no rebuild — which is why the ratified key is the log's ULID rather
than anything read off the belief table. git grep rowid over that memo
previously returned nothing.

The replacement states what shipped without implying more: aelf spine verify
covers TEMPORAL_NEXT only, reproduces ~93.7% against a ~95.0% ceiling under
the current writer, and reports the gap rather than closing it. Points 3 and
4 stay edge-incomplete.

Deliberately not done: adding aelf spine verify to docs/user/COMMANDS.md.
spine is registered with help=argparse.SUPPRESS and SLASH_COMMANDS.md names
it among the hidden operator subcommands; no other hidden verb is documented
there. Surfacing it would contradict that standing policy, so the command is
documented in the design memo where the contract lives.

3. test(spine): the synth exclusion was pinned to a symbol, not a value

Amended constraint (1) names a valuesource_kind = 'legacy_unknown'
chosen over the ULID-prefix detector because that one dropped 51.8% of the log.
The guarding test planted its fixture row with source_kind=SYNTH_SOURCE_KIND,
the same symbol spine_recompute.py:139 reads, so changing what the constant
resolves to left the assertion green while the exclusion stopped matching any row
on disk.

Adds a test asserting the shipped value and plants the fixture with the literal.

Verified by mutation rather than by inspection — renaming
INGEST_SOURCE_LEGACY_UNKNOWN's value to legacy_unknown_RENAMED:

before:  20 passed
after :  FAILED test_synth_source_kind_is_the_literal_the_contract_names
         FAILED test_synth_rows_supply_no_ordering_key
         2 failed, 18 passed

Both fail where previously neither would have.

Scope

Docs and one test. No behaviour change, no defaults moved, no published number
touched. The remaining #1283 criteria — populating derived_edge_ids, pinning
the detector thresholds, and the gap meter's constraint (2) — are being carved as
named leaf issues under #1157 per the operator ruling, and are not in this PR.

Summary by Sourcery

Clarify that edges are not currently log-derived while beliefs are, and pin the synthetic source-kind exclusion to the literal contract value.

Documentation:

  • Update determinism and source-of-truth documentation to state that edges are written outside the log and are the standing exception to log-based reconstruction.
  • Revise the write-log design memo to record the ratified edge contract, the actual writer ordering key, and the scope and limitations of the aelf spine verify recompute tool.
  • Clarify feature-doc linker and limitations docs to distinguish the ratified log-derived edges contract from the currently shipped implementation.

Tests:

  • Add a test that pins the synthetic source-kind constant to the literal value named in the edge contract, and adjust the spine recompute fixture to use that literal so regressions are caught.

@robotrocketscience robotrocketscience added the author-idnn PR authored by session idnn label Aug 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@robotrocketscience, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d7b7fd9-81f0-4189-a2f2-252a4bc46cfd

📥 Commits

Reviewing files that changed from the base of the PR and between 777868b and 61d96fd.

📒 Files selected for processing (8)
  • docs/concepts/ARCHITECTURE.md
  • docs/concepts/COMPARISON.md
  • docs/concepts/HARNESS_INTEGRATION.md
  • docs/concepts/PHILOSOPHY.md
  • docs/design/feature-doc-linker.md
  • docs/design/write-log-as-truth.md
  • docs/user/LIMITATIONS.md
  • tests/test_spine_recompute_1283.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR-size soft cap

This PR is over the advisory size threshold:

  • 46 changed lines (limit: 200)
  • 8 changed files (limit: 3)

Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated attn:merge-conflict cycles (see #602). When practical, split into smaller PRs that each touch a focused surface.

This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the size:override label and this comment will be removed on the next push.

@sourcery-ai

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

Aligns documentation and tests with the actual shipped behavior of edges and the write-log contract by explicitly carving out edges as an exception to log-as-truth claims, refreshing the write-log contract memo with the ratified edge recompute contract and writer ordering details, and pinning the spine synth exclusion test to the literal source_kind value rather than the constant symbol.

File-Level Changes

Change Details Files
Clarify that edges are the standing exception to the write-log-as-truth / determinism guarantees and that current log-derived claims apply only to beliefs, not edges. docs/concepts/PHILOSOPHY.md
docs/concepts/HARNESS_INTEGRATION.md
docs/design/feature-doc-linker.md
docs/user/LIMITATIONS.md
Refresh the write-log-as-truth design memo to describe the ratified edge contract, actual writer ordering, and the shipped read-only recompute tool without overclaiming coverage. docs/design/write-log-as-truth.md
Pin the spine recompute synth exclusion to the literal source_kind value named in the contract instead of the constant symbol, and ensure tests fail on value drift.
  • Add a test asserting that SYNTH_SOURCE_KIND resolves to the literal string 'legacy_unknown' to guard the contract.
  • Change the synth-row fixture in the existing test to use the literal 'legacy_unknown' value instead of SYNTH_SOURCE_KIND so the test exercises the on-disk value.
  • Verified behavior by mutating the constant value and observing the new tests fail while previously they would have passed.
tests/test_spine_recompute_1283.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:Garsecg:2026-08-05T16:11:59Z]

…nqualified

The #1309 sweep for #1283 AC1 corrected PHILOSOPHY.md's Append-only
substrate note and the write-log-as-truth memo, but four other live
passages still told readers that edges are a materialized projection of
the log as shipped fact. That is the exact overreach #1283 exists to
correct: every edge is written outside the log, so a replay reconstructs
beliefs and not the graph.

PHILOSOPHY.md stated the unqualified form in its determinism commitments
156 lines above its own caveat; the pointer now sits with the claims it
qualifies.
The memo still read 'Until that recompute exists', which went stale when
#1336 merged. It also omitted the rowid-exclusion rationale, which is the
load-bearing half of the 2026-08-01 ruling: the writer orders on
(created_at, rowid), that rowid is implicit under 'id TEXT PRIMARY KEY',
VACUUM may renumber it and it survives no rebuild — which is why the
ratified key is the log's ULID.

States what shipped rather than implying more: 'aelf spine verify' covers
TEMPORAL_NEXT only, reproduces ~93.7% against a ~95.0% ceiling under the
current writer, and reports the gap rather than closing it. Reaching the
98.70% structural ceiling needs the unfunded writer change, so points 3
and 4 stay edge-incomplete.

The pre-v2.0 'historical memo' header now notes that the ratified edge
contract it carries is current.
Amended constraint (1) of #1283 names a value — source_kind =
'legacy_unknown' — chosen over the ULID-prefix detector because that one
dropped 51.8% of the log. The test guarding it planted its fixture row
with the same symbol the recompute reads, so changing what the constant
resolves to left the assertion green while the exclusion stopped
matching any row on disk.

Adds a test asserting the shipped value, and plants the fixture with the
literal so the row looks like the #263 migration rows it stands in for.
Verified by mutation: renaming the constant's value now fails both,
where before it failed neither.
@robotrocketscience
robotrocketscience force-pushed the docs/issue-1283-contract-sweep branch from 4412d86 to c48de5b Compare August 5, 2026 16:12
The sweep qualified four passages but left three that make the same
claim, including one in its own primary target: write-log-as-truth.md's
opening contract paragraph names "the typed graph" as a materialized
view over the log, fifty-seven lines above the implementation-status
note that contradicts it. A reader of "## The contract" never reaches
the qualifier.

The other two are the concepts docs, both unqualified and both more
load-bearing than the ones already fixed. ARCHITECTURE.md asserts every
retrieval result is bit-identical given the same write log and code --
but L3 is a typed-edge walk, so retrieval output is also a function of
the edges table, which the log does not cover; two stores with identical
logs can return different L3 results. Its enrichment-boundary block then
lists "derived edges" among outputs stored with provenance, when
derived_edge_ids is NULL on every row. COMPARISON.md is user-facing and
says to tear the DB down and rebuild from the log alone, one row above
selling the typed graph as the conflict-handling mechanism.

Also points the 93.68% at #1356, which is funded to change the
denominator. Writing a figure already scheduled to move, without naming
its successor, is the same staleness this PR exists to fix.

The historical/ v2 memos (v2_view_flip, v2_replay, v2_derivation_worker)
carry the same claim at its origin and are deliberately left alone --
they are marked historical and describe intent at the time.
Two defects in the new docstring, neither affecting behaviour.

"The prefix/density detector" is a compound label that appears in no
source and conflates two different rejected rules with two different
numbers: the ULID-prefix date-cluster detector dropped 51.8% of the log,
while "ULID prefix disagrees with ts by more than a day" is the 34.75%
one. Density was explicitly never a rule. The PR body gets this right;
only the docstring was loose. Also records the denominator, since 51.8%
is over the whole ~139.6k-row log rather than the ~60.5k rows the rule
sees per belief -- re-deriving it at the rule's site gives a different
number and reads as a defect that is not there.

"Every other test here plants its fixture row with the same symbol" was
one test, and this PR converts it, so the sentence describes a condition
it removes. Restated as what the fixture does and why.

Adds the caveat that this assertion is a contract pin rather than a
behavioural test -- it would hold even if the recompute were broken. The
behavioural catch is the fixture literal, and that distinction is worth
stating where someone might otherwise read the pin as coverage.
@robotrocketscience

Copy link
Copy Markdown
Owner Author

Review — verified, two commits pushed to this branch

Three claims independently checked, all three hold. Two defects found and fixed here rather than handed back; one scope call left for you.

What I verified

The mutation claim reproduces exactly. Baseline 20 passed; renaming INGEST_SOURCE_LEGACY_UNKNOWN's value to legacy_unknown_RENAMED fails exactly the two tests named, no more and no fewer. More importantly I ran the question the claim rests on: the pre-PR test file under the same mutation is 19 passed, zero failures. Your justification holds.

It is stronger than the PR body says. With the pre-PR test file and the mutation applied I ran the whole suite — nothing anywhere in ~7,200 tests caught it. The tautology was total, not merely local to this file.

The figures all trace to a source, and the right variant is used. There are two circulating pairs for the #1283 headline: 93.7%/7.4% and 94.7%/7.3%. This PR uses 93.7%/7.4%, which is correct — the other was retracted by the owner in a dedicated #1283 comment ("Corrected figures for the log-derived ruling"), the defect being that its baseline re-sorted the belief table instead of reading edges WHERE type = 'TEMPORAL_NEXT', so a flaw in the recompute could cancel itself out. ~95.0% and 98.70% both check out against their originating comments.

aelf spine verify matches its description: read-only (read_only=True, three SELECTs), TEMPORAL_NEXT only (WHERE type = ? bound to EDGE_TEMPORAL_NEXT), exits 0 unconditionally and prints the gap. "A gap meter, not a rebuild" is exactly the shipped framing. The argparse.SUPPRESS rationale for keeping it out of COMMANDS.md is sound — one small imprecision, spine is already named in that file's hidden-subcommand list, so what you declined was documenting the verb, not the command.

Fixed in b65aacee — the sweep was incomplete

The sweep qualified four passages and left three making the same claim. The sharpest is in this PR's own primary target: write-log-as-truth.md:9, the opening contract paragraph, names "the typed graph" as a materialized view over the log — 57 lines above the implementation-status note that contradicts it, and attached to a different numbered list. A reader of ## The contract never reaches the qualifier. This PR edits three lines in that file and leaves the one that names the graph.

The other two are user-facing and load-bearing:

  • ARCHITECTURE.md:7 — "Every retrieval result is bit-identical given the same write log and the same code." Strictly stronger than the HARNESS_INTEGRATION.md line you corrected, because L3 is a typed-edge BFS lane: retrieval output is also a function of the edges table, so two stores with identical ingest_log content can return different L3 results. Line 23 in the same file lists "derived edges" among outputs "stored as deterministic content with provenance", when derived_edge_ids is NULL on every row.
  • COMPARISON.md:13 — "tear the DB down and rebuild from this log alone", one row above the table selling CONTRADICTS/SUPERSEDES/RESOLVES as the conflict-handling mechanism. That composition is exactly the reading your thesis says a careful reader will take as edge coverage.

By this PR's own argument — leaving them in place while closing the issue would be self-refuting — these belonged in the sweep, so I added them rather than filing a follow-up. Revert the concepts-doc hunks if you scoped to four deliberately; it puts the PR further over the advisory size cap, and that is your call, not mine.

I also pointed the 93.68% at #1356, which is funded to correct that denominator. Publishing a number already scheduled to move, without naming its successor, is the same staleness this PR exists to fix.

Deliberately not touched: the historical/ v2 cluster (v2_view_flip.md:15, v2_replay.md:27, v2_derivation_worker.md:22) carries the claim at its mechanism-level origin, but those are marked historical and record intent at the time. Flagging rather than editing.

Fixed in 61d96fdb — two docstring defects

"The prefix/density detector" is a compound label appearing in no source, and it conflates two different rejected rules with two different numbers: the ULID-prefix date-cluster detector is the one that dropped 51.8% of the log; "prefix disagrees with ts by more than a day" is the 34.75% one. Density was explicitly never a rule — benchmarks/ingest_log_ulid_clusters.py:38-40 says so. Your PR body gets this right; only the docstring was loose. I also recorded the denominator, because 51.8% is over the whole ~139.6k-row log while the rule runs per-belief over ~60.5k rows — re-deriving it at the rule's site yields a different number and reads as a defect that isn't there.

"Every other test here plants its fixture row with the same symbol" was one test, and the second hunk converts it — so the sentence describes a standing condition this PR removes.

One thing worth naming rather than leaving implicit: of the two newly-failing tests, only test_synth_rows_supply_no_ordering_key is a behavioural catch. test_synth_source_kind_is_the_literal_the_contract_names is a bare value pin that would hold even if the recompute were entirely broken. It is the right tool for the amended constraint, but the substantive protection is the fixture literal. Added as a caveat in the docstring.

State

tests/test_spine_recompute_1283.py 20 passed. Discretion grep clean. Both commits signed. Over to you on the concepts-doc scope call — otherwise this is good to go and I'll drive it to merge.

@robotrocketscience robotrocketscience added the ready-to-merge Trigger merge-train: FF main to this PR's head label Aug 5, 2026
@github-actions
github-actions Bot merged commit 61d96fd into main Aug 5, 2026
28 checks passed
@github-actions github-actions Bot removed the ready-to-merge Trigger merge-train: FF main to this PR's head label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

merge-train: merged 61d96fdmain via FF push.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:Garsecg:2026-08-05T22:49:13Z]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:review Needs review (PR open, awaiting reviewer) author-idnn PR authored by session idnn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant