ogar-elk: observe the bake as a borrowed lens; drop the serialization surface - #256
Conversation
The joins are pre-bake. Reconciling independently authored sources is the work that must finish BEFORE anything is baked, because the bake is what freezes the answer into positions. That makes this crate a stage, not a layer -- and two things in it were written as if it were a layer. - Remove the `serde` feature and all three Serialize/Deserialize derives. A join validator that can serialize its verdict invites someone to ship the verdict instead of the bake. There is now no serialization surface at all, not behind a feature, not optionally. The crate has zero dependencies again. - `ClassAddr` was documented as "the ABI-shaped address a baked row already carries." It is not; it is the join key the joiner has already agreed on for the two sides it joins. What a baked row carries is a matter of position, resolved by the class, and this crate is finished long before that question is asked. The old wording invited exactly the leak the doc now names. The types themselves stay: types exist before the bake, and a join needs a key and a directed edge. What the crate doc now states explicitly is that nothing it defines survives the bake -- if one of these types appears in a post-bake read path, that is the leak. 8 tests green, clippy clean.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c2cdcd12-b4c7-4ba9-acf9-ff7d267070ba) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fad558d09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| //! **Nothing this crate defines survives the bake** — afterwards there are | ||
| //! only classes, and a class is resolved by position, not by a type declared | ||
| //! here. If one of these types ever appears in a post-bake read path, that is | ||
| //! the leak, and it is this doc that says so. |
There was a problem hiding this comment.
Update the discovery map with the new stage boundary
The repository's living topology index still describes ogar-elk as operating over ABI-shaped addresses in a consumer layer (docs/DISCOVERY-MAP.md:1772-1800), directly contradicting this new pre-bake-only contract. A future integrator following that canonical index could therefore pass these types into the post-bake path that this documentation now calls a leak; update the existing discovery entry alongside this contract change.
Useful? React with 👍 / 👎.
ogar-elkis the observation of what a bake entails — it runs on the farside of the bake, not before it. Two commits: the second corrects the first,
which had the stage backwards.
The framing
"The joins are pre-bake" means the joining is somebody else's work, finished
upstream — resolving a CURIE, deciding two labels name one concept, reconciling
which source says what. The bake freezes the result into positions. ELK then
observes that spine. The first commit on this branch read the ruling as "so
this crate is the pre-bake joiner" and wrote a doc heading saying
Where this runs: BEFORE the bake, never after. That is the opposite of trueand would have sent the next reader the wrong way.
Getting the stage right forces the shape
An observation over a bake borrows what the bake already holds:
ClosureowningHashMap<ClassAddr, Vec<ClassAddr>>Spine<'a>— a lens over a sorted&'a [Subsumption]from_asserted(impl IntoIterator<Item = …>)Spine::over(&[…])supers_ofwalks an owned mapparents_of= equal-range binary search returning a subslice of the caller's dataextendedclones the whole mapwith_overlay— a second borrowed sliceThe map was a second copy of an adjacency
Bake::tripleshad already laid outin order, and a second copy is a second thing that can be wrong. Asking "what
would this merge do" now costs a lens, not a copy of the spine.
parents_are_a_borrowed_window_not_a_copyasserts pointer identity against thesource slice — so "borrowed, not copied" is checked, not claimed.
The sortedness precondition is load-bearing
An unsorted slice makes the binary search miss parents, which reads as
"not entailed" — the one failure this crate must not have.
overdebug-asserts it (the bake emits sorted);
try_oververifies in release andreturns
Nonerather than sorting a copy, because sorting would mean owning.The serialization surface is gone
The
serdefeature and all threeSerialize/Deserializederives are removed— not behind a feature, not optionally. A validator that can serialize its
verdict invites someone to ship the verdict instead of the bake.
[dependencies]is empty.What the remaining
HashSetisThe walk's frontier — the answer being accumulated, bounded by the answer's
size. Named as such in the doc so it is not mistaken for the copy that was
removed.
Not a duplicate of the bake's own check
ogar_obo::BakeStats::is_a_cyclesreports cycles inside one baked core. R3asks what a further set of axioms would do to a spine already baked — the
question you can only ask once you have the bake to ask it about.
Verification
cargo test -p ogar-elk— 10 passed, 0 failed (was 8; added theborrowed-window and sortedness tests)
cargo clippy -p ogar-elk --all-targets— cleanserdereferences remain in the crate