Repository navigation
contract: per-class lane layout, chosen at compile time and resolved through ClassView - #1839
Conversation
…es it lane_codec: EpiLaneSpec (width, code space, never-touched code, value and presence offsets) declared by the consumer as EpiLaneClass::SPEC, built with checked() so an invalid layout fails to compile. ONNX/TFLite annotations map through CodeSpace::from_zero_point. ClassView::epi_lanes names the same constant for a classid; None = undeclared, and a writer refuses. thought_layers_probe: write_epi is generic over the class layout and refuses when the ClassView declares none or another one. 9-bit lanes still use ndarray codec9's never_touched; a test pins that the contract rule and the codec agree on all 512 codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPWTwovjYJEUMuGPb4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPWTwovjYJEUMuGPb4
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…; bind once The presence plane is not optional: every lane has a presence bit, and a lane is absent when its presence bit is 0 and its value is 0, at 8 and 9 bits alike. NanCode (None, SymMin) is removed and the presence offset is required. A 9-bit lane must be Sym. The probe binds a class to its layout once (bind_lanes checks the ClassView and returns a LaneBinding<L>); writes take the binding and do not look the class up again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPWTwovjYJEUMuGPb4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPWTwovjYJEUMuGPb4
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c393f651fb
ℹ️ 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".
| let v_end = self.values + self.lanes as u16; | ||
| let p_end = self.presence + self.presence_bytes(); |
There was a problem hiding this comment.
Prevent offset overflow before validating slab bounds
When validate() is called at runtime with an offset near u16::MAX, these additions overflow before the bounds checks run. For example, a Bits8/Sym spec with values: 65535, presence: 96, and lanes: 16 returns Ok(()) in an optimized build, despite lying outside the 512-byte row; reading a value through that accepted spec then panics. Debug builds instead panic during validation rather than returning SpecError::OutOfSlab. Widen the arithmetic or use checked addition so invalid offsets are consistently refused.
Useful? React with 👍 / 👎.
#1837 made a sparse write skip absent lanes, but over a fixed lab layout. This replaces that layout with one each class declares at compile time. The ClassView resolves it once per class.
Contract:
lane_codec(new, zero-dep, additive)EpiLaneSpecholds:Sym/Asym);EpiLaneClass::SPEC, built withchecked(), so an invalid layout fails to compile (acompile_faildoctest pins this).$null, UNKNOWN) when its presence bit is 0 and its value is 0. This holds at 8 and 9 bits alike, and it is the only absent code.codec9).Sym.QuantizeLinear/ TFLite annotations choose the code space throughCodeSpace::from_zero_point(zero point 0 =Sym).ClassView::epi_lanes(class)names the same constant for a classid. The defaultNonemeans undeclared, and binding refuses, asepistemic_readingalready does.Probe
ThoughtTables::bind_lanes::<L>(view, class)checks the ClassView once. It returns aLaneBinding<L>, orRefusal::LaneLayoutwhen the class declares no layout or a different one.write_epi(&binding, …)does not look the class up again.OnceLockset when the registry loads.LazyLockdoesn't fit, because its initializer cannot take the view.EpiLane9::never_touched, and a test checks that the contract rule andcodec9agree on all 512 codes.Tests
-D warnings) andcargo fmt --checkare clean;Open
Mapping the 32-bit row classid to
ClassView's u16ClassIdis left to the caller; the probe takesClassIdas an argument instead of doing bit math on the key.Board:
.claude/board/entries/2026-10-28-lane-layout-from-classview.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01XAqKMPWTwovjYJEUMuGPb4