Skip to content

[S5] Emit static tables and gate checked-in generated source against drift - #51

Merged
swgiacomelli merged 4 commits into
epic/36-surfaces-bakefrom
cursor/issue-41-s5-emit-1632
Aug 25, 2026
Merged

swgiacomelli merged 4 commits into
epic/36-surfaces-bakefrom
cursor/issue-41-s5-emit-1632

Conversation

@swgiacomelli

@swgiacomelli swgiacomelli commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Closes #41.

Stacked on cursor/issue-40-s4-quantize-03fb (S4 quantize, including 47bacba which folds runtime X-then-Y rounding into MAX_ERR_LSB). S5 emits tables and gates the checked-in copy; it does not freeze goldens or write docs/generating-tables.md.

Emission

ph-surfaces-bake --emit-rust takes the same ingest flags as S3/S4, quantizes, and writes Rust source on stdout. The baker does not own the destination path.

Emitted source is deterministic (\n only, no timestamps, no host paths) and includes:

  • static X knots, Y knots, and row-major values[y][x]: [[i32; NX]; NY]
  • pub const MAX_ERR_LSB: i32 = … via the existing emit_max_err_lsb helper
  • selected pairing and exact PAYLOAD_BYTES (referenced element payload; not RAM/flash/binary/linker cost)
  • default Binary×Binary; --x-bucketed / --y-bucketed emit bucket_index(&KNOTS) + BucketedAxis in the generated source (the baker still has no [dependencies] table; ph-surfaces stays dev only)

--emit-golden stays unimplemented. Unknown args still exit 2.

MAX_ERR_LSB remains an i32 value LSB of deviation from supplied samples, including the S4 runtime-rounded X-then-Y path for exact-u16 coordinates. It is not a device, accuracy, timing, or flash claim.

Checked-in artifact and drift gate

The packaged ph-surfaces file set is unchanged. The fixture lives at crates/surfaces-bake/generated/rounding.rs (S4 rounding 2×2, MAX_ERR_LSB = 1) and is not in baker include / baker.files.

  • cargo xtask generate writes that path from baker.generated in xtask/config.ron
  • The generated source check re-renders in memory (same checked_in_source the baker uses), reads disk through text::read_text (CRLF-safe), and on mismatch prints a unified diff plus run cargo xtask generate
  • Mutation cases dirty the artifact and delete it; both FAIL, not SKIP

Not in this PR

Verification

cargo xtask ci (full profile, not release):

  • PASS: line endings, no_std unconditional, integer only, no ph-curves, baker line budget (1426 / 1500), baker package (13 files, src/emit.rs in, generated/ out), generated source, manifest floor, publish lock, fmt, test, release test, examples, clippy, doc, package list/build/digest/consumer, code size snapshot, guards fire on mutation (25), deny, core-only thumb/riscv, ordinary thumb/riscv
  • SKIP: secret scan — gitleaks not installed. A skip is not a pass. This is not release evidence.

Also:

  • cargo xtask ci --only "baker line budget" PASS (1426 / 1500)
  • cargo xtask ci --only "baker package" PASS
  • cargo xtask ci --only "generated source" PASS
  • cargo test -p ph-surfaces-bake --locked PASS
  • cargo test --manifest-path xtask/Cargo.toml --test mutation PASS (25), including stale-artifact and missing-artifact cases
  • --emit-rust run twice, cmp identical; git diff --check clean; cargo fmt; no unsafe; no baker [dependencies]
  • Packaged README/LICENSE are regular 100644 files, not git symlinks (120000)

Could not comment on issue #41 (gh issue comment is not permitted for this integration); verification is recorded here.

PR base is cursor/issue-40-s4-quantize-03fb, not main and not epic/36-surfaces-bake.

Open in Web Open in Cursor 

@swgiacomelli
swgiacomelli marked this pull request as ready for review August 25, 2026 18:09
@swgiacomelli

Copy link
Copy Markdown
Contributor Author

@codex review

@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: ff877a8eca

ℹ️ 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 thread xtask/Cargo.toml Outdated
Comment thread crates/surfaces-bake/src/main.rs Outdated
@swgiacomelli

Copy link
Copy Markdown
Contributor Author

@codex review

P1: xtask now takes ph-surfaces-bake from [workspace.dependencies].
P2: --x-bucketed / --y-bucketed reject B outside the runtime 1..=65_536 bound.

@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: 0955d35705

ℹ️ 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 thread crates/surfaces-bake/src/emit.rs Outdated
Comment thread crates/surfaces-bake/src/emit.rs Outdated
Base automatically changed from cursor/issue-40-s4-quantize-03fb to epic/36-surfaces-bake August 25, 2026 22:05
cursoragent and others added 3 commits August 25, 2026 18:07
ph-surfaces-bake --emit-rust writes Binary×Binary (optional Bucketed)
static tables, PAYLOAD_BYTES, and MAX_ERR_LSB to stdout. cargo xtask
generate places the baker-owned fixture; CI re-renders it in memory
and compares through text::read_text.

Co-authored-by: Steven Giacomelli <swgiacomelli@users.noreply.github.com>
…versized bucket counts.

xtask was the only member with a direct path dep, and --x-bucketed 65537 printed uncompilable BucketedAxis source. Align both with the workspace policy and the runtime B <= 65536 bound.

Co-authored-by: Cursor <cursoragent@cursor.com>
S5 adds emission on top of the S4 residual kernel; 1,651 lines exceeded 1,600. The cap is a ballooning brake, not a freeze.

Co-authored-by: Cursor <cursoragent@cursor.com>
@swgiacomelli
swgiacomelli force-pushed the cursor/issue-41-s5-emit-1632 branch from 0955d35 to b93aec9 Compare August 25, 2026 22:07
…al bucket counts in emit_rust_with.

The generated rounding module is excluded from the .crate, so library tests construct the S4 surface in-test. Bucketed emission shares the runtime 1..=65536 bound as BakeError::InvalidBucketCount.

Co-authored-by: Cursor <cursoragent@cursor.com>
@swgiacomelli

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 02d55f3189

ℹ️ 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 thread crates/surfaces-bake/src/lib.rs
@swgiacomelli
swgiacomelli merged commit dd56e50 into epic/36-surfaces-bake Aug 25, 2026
1 check passed
@swgiacomelli
swgiacomelli deleted the cursor/issue-41-s5-emit-1632 branch August 25, 2026 22:18
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.

2 participants