Skip to content

ogar-elk: observe the bake as a borrowed lens; drop the serialization surface - #256

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/elk-prebake-stage
Aug 7, 2026
Merged

ogar-elk: observe the bake as a borrowed lens; drop the serialization surface#256
AdaWorldAPI merged 1 commit into
mainfrom
claude/elk-prebake-stage

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Aug 7, 2026

Copy link
Copy Markdown
Owner

ogar-elk is the observation of what a bake entails — it runs on the far
side 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 true
and 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:

before after
Closure owning HashMap<ClassAddr, Vec<ClassAddr>> Spine<'a> — a lens over a sorted &'a [Subsumption]
from_asserted(impl IntoIterator<Item = …>) Spine::over(&[…])
supers_of walks an owned map parents_of = equal-range binary search returning a subslice of the caller's data
extended clones the whole map with_overlay — a second borrowed slice

The map was a second copy of an adjacency Bake::triples had already laid out
in 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_copy asserts pointer identity against the
source 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. over
debug-asserts it (the bake emits sorted); try_over verifies in release and
returns None rather than sorting a copy, because sorting would mean owning.

The serialization surface is gone

The serde feature and all three Serialize/Deserialize derives 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 HashSet is

The 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_cycles reports cycles inside one baked core. R3
asks 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-elk10 passed, 0 failed (was 8; added the
    borrowed-window and sortedness tests)
  • cargo clippy -p ogar-elk --all-targets — clean
  • zero serde references remain in the crate

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.
@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment on lines +33 to +36
//! **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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@AdaWorldAPI
AdaWorldAPI merged commit 6093465 into main Aug 7, 2026
2 checks passed
@AdaWorldAPI AdaWorldAPI changed the title ogar-elk: drop the serialization surface, name the pre-bake stage ogar-elk: observe the bake as a borrowed lens; drop the serialization surface Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant