Skip to content

Test case generation, publish failing reports, fix README counts - #2

Open
jackspiece wants to merge 4 commits into
mainfrom
a-plus-polish
Open

jackspiece wants to merge 4 commits into
mainfrom
a-plus-polish

Conversation

@jackspiece

Copy link
Copy Markdown
Owner

Fixes the three approved items from the A+ audit. Each change is a separate commit.

1. Case generation is testable (review-cases.cjs)

  • The 65,976-case loop moved unchanged from review-worker.cjs into review-cases.cjs as runCases(encode), which returns { cases, groups, failureCount, failures }. The worker keeps the SHA-256 pin check, the published smoke test and report writing, and calls runCases(context.BytesToTextBase16).
  • Report addition: harnessSha256.reviewCases fingerprints review-cases.cjs, which now generates the cases. Without it the report would stop fingerprinting the case generator. The report's seed is formatted from the exported SEED, so the seed is no longer written out in two files.
  • New test/review-cases.test.cjs runs all 65,976 cases against a local Buffer-based encoder, never the third-party target. It checks the case count, the group counts and their order against results/2026-09-11.json, and a SHA-256 digest of every generated input. The expected digest was computed independently: I mechanically extracted and ran lines 30-67 of verify.cjs at faacbef, the harness behind the recorded result. That commit's validator.cjs and verify.cjs hash to the result's harnessSha256 values.

2. A failing run publishes its report instead of hitting the 1 MiB cap

  • Before: the worker printed the whole report to stdout, and each of the 10 kept failures held the full input, expected and actual values. Failures on 65,536-byte inputs pushed worker output past the 1 MiB limit in bounded-process.cjs. verify.cjs then exited 2 and deleted the staged report, instead of exiting 1 as docs/reproduce.md documents.

  • Now: the worker prints only { cases, failureCount, report }. verify.cjs already publishes the staged file and ignores worker stdout. This short summary is what keeps the run under the cap, because the failure path writes nothing else to stdout or stderr.

  • Failure records are compact: case, group, inputLength, inputHead (first 32 bytes), expectedHead (first 64 characters), actualHead (first 64 characters or array entries) and error (first 200 characters). A returned value that is neither a string nor an array is still recorded as returned. The new format is described in docs/reproduce.md.

  • New tests:

    • A defect that appears only in long inputs: 36 failures, 10 records, JSON under 64 KiB.
    • Failures on the largest inputs that throw a 1 MiB message or return a string.

    Both fail against the old record format.

3. Dependabot

  • .github/dependabot.yml adds weekly github-actions version updates for the SHA-pinned actions. There is no package.json, so npm is not configured. check.yml is unchanged.

4. README test count and code map

  • The alt text and the code map now give the real count from node --test on this branch: 35 tests, 4 POSIX-only. That is 6 core checks, 12 faulty-encoder controls, 1 test of 512 generated valid encodings, 3 case-generation tests, 9 process-limit and CLI tests and 4 signal tests.
  • The code map adds review-worker.cjs, review-cases.cjs, bounded-process.cjs, source-record.json and test/. It describes verify.cjs as it works since Harden encoder review harness with bounded execution and signal cleanup #1, and notes that results/2026-09-11.json came from the harness at faacbef.
  • README and docs/method.md say the new tests run against a local reference encoder, not the external target. The statement that there is no fresh 65,976-case run is unchanged and still true.

Skipped

  • Hero PNGs. docs/assets/overview.png and overview-mobile.png still show "6 checker tests". Fixing them means re-rendering the artwork, and no tooling for that is available here, so they are untouched. Until they are re-rendered, the corrected alt text (35 tests) disagrees with the image.

Verification

  • node --test test/*.test.cjs locally on Node 22.23.3 (Windows): 35 tests, 31 pass, 4 skipped (the POSIX-only signal tests). CI runs all 35 on Node 24 (Ubuntu).
  • The digest test fails if the seed changes. It also fails if two seeded lengths are swapped, a change that leaves every group count the same.
  • Both compact-report tests fail against the record format in the first commit.
  • Local end-to-end run (not committed): scratch copies of the harness, outside the repo, with the source pin replaced by the hash of synthetic encoder bundles I wrote. No third-party code was downloaded or executed, and the repository's own tests never bypass the pin.
Synthetic encoder main this branch
correct exit 0, report exit 0, report
wrong first digit at ≥ 4,096 bytes exit 1, 1.67 MB report exit 1, 16.8 KB report
wrong first digit at 65,536 bytes exit 2, "exceeded its 1 MiB combined output budget", no report exit 1, 16.8 KB report
throws an input-dump message at 65,536 bytes exit 2, no report exit 1, 10.4 KB report
  • Before the record-format change, the reports from the refactor commit were deep-equal to main's for the correct and the ≥ 4,096 encoders. That covers every field, key order and the failure records, apart from checkedAt, elapsedSeconds and harnessSha256 (the worker hash changes and reviewCases is added).
  • Not done: a fresh 65,976-case run against the real Bytes 0.1.9 bundle. That run belongs in an isolated environment, as docs/reproduce.md advises.

🤖 Generated with Claude Code

jackspiece and others added 4 commits October 13, 2026 16:18
The 65,976-case loop in review-worker.cjs could only run after the
SHA-256 pin check, so no test or CI job ever exercised it. Move it
unchanged into review-cases.cjs as runCases(encode), returning
{ cases, groups, failureCount, failures }. The worker keeps the pin
check, smoke test and report writing, and calls
runCases(context.BytesToTextBase16).

The report now also fingerprints review-cases.cjs in harnessSha256,
since that file generates the cases. The seed in the report is
formatted from the exported SEED, so it cannot drift from the
generator.

The new test runs all 65,976 cases against a local Buffer-based
encoder without the third-party target. It checks the case count,
the group counts and their order against results/2026-09-11.json,
and a SHA-256 digest of every generated input. The digest was
computed independently from the generator lines of verify.cjs at
faacbef, the harness that produced that result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each of the 10 kept failure records held the full input, expected and
actual values, and the worker echoed the whole report to stdout. One
failing 65,536-byte case serializes to about 0.9 MB, so a few long
failures pushed the worker past the 1 MiB output limit in
bounded-process.cjs. verify.cjs then exited 2 and deleted the staged
report, instead of exiting 1 with a published report as
docs/reproduce.md documents.

The worker now prints only { cases, failureCount, report } to stdout.
verify.cjs already publishes the staged file and ignores worker
stdout. Failure records keep the case number, group and input length,
plus the first 32 input bytes, the first 64 expected characters, the
first 64 returned characters or array entries and up to 200
characters of an error message. A returned value that is neither a
string nor an array is still recorded as returned.

The new tests cover a defect that appears only in long inputs, and
failures on the largest inputs that throw a 1 MiB message or return
a string. Both fail against the old record format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workflow pins actions to full commit SHAs, but nothing proposed
updates to those pins. Check .github/workflows weekly. There is no
package.json, so npm is not configured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hero alt text still said six tests exercise the checker, and the
code map described verify.cjs as it was before PR #1. State the real
count from node --test: 35 tests (6 core checks, 12 faulty-encoder
controls, 1 test of 512 generated valid encodings, 3 case-generation
tests, 9 process-limit and CLI tests, 4 POSIX-only signal tests).

The code map now covers verify.cjs, review-worker.cjs,
review-cases.cjs, bounded-process.cjs, validator.cjs,
source-record.json and test/. It notes that results/2026-09-11.json
came from the harness at faacbef: the report's recorded harness
hashes equal validator.cjs and verify.cjs at that commit.

README and docs/method.md also describe the case-generation tests,
which run against a local reference encoder rather than the
external target.

The hero PNGs still show "6 checker tests" and need re-rendering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hacktron-app

hacktron-app Bot commented Oct 13, 2026

Copy link
Copy Markdown

Hacktron Security Check - Skipped

Reason: Code Review is not active for this organization

Start a free trial (no credit card required), subscribe, or add a payment method from organization billing settings

Go to: https://app.hacktron.ai/national-college-of-business-and-arts/billing

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T08:22:41.504365Z 86e2a39 PR opened
🔒 Security Review ✅ Completed 2026-10-13T08:24:21.818615Z 86e2a39 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 86e2a391fd

ℹ️ 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".

test("a correct encoder passes every declared case, with the recorded inputs and groups", () => {
const inputs = crypto.createHash("sha256");
const result = runCases(bytes => {
inputs.update(`${JSON.stringify(bytes)}\n`);

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 Preserve negative zero in the input digest

If the case generator accidentally changes the declared [-0] case to [0], this regression test still passes because JSON.stringify([-0]) produces [0]; the case and group counts remain unchanged as well. Since the digest is intended to lock every generated input to the recorded harness, encode negative zero distinctly or add a direct Object.is assertion for that case.

Useful? React with 👍 / 👎.

@jackspiece jackspiece changed the title A+ polish: test case generation, publish failing reports, fix README counts Test case generation, publish failing reports, fix README counts Nov 15, 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