Skip to content

fix(sort): insertion_sort unsigned-index underflow; reseal 9 stale sort/wp18 seals - #6618

Merged
gHashTag merged 4 commits into
masterfrom
claude/fix-6609-sort-seals
Oct 5, 2026
Merged

gHashTag merged 4 commits into
masterfrom
claude/fix-6609-sort-seals

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #6609 (this is the coverage half; the GateScarab corpus-ratchet half landed in #6612, merged into this branch)

What was wrong in insertion_sort

The body was wrong. The test expectation was right. var j = i - 1; while (j >= 0 && values[j] > key) lowers to an unsigned usize index in the generated Zig. That makes j >= 0 always true, and j = j - 1 underflows as soon as a key has to move to slot 0. The body now tracks the free slot (var j = i; while (j > 0 && values[j - 1] > key)), the standard unsigned-safe form. sort_simple_case ({5,2,8,1,9} -> {1,2,5,8,9}) is what a correct insertion sort produces and is unchanged.

sort_basic_case was a given/when/then placeholder (sort(undefined), compared to a void result) that could not compile. It is now a real test with duplicates, a negative minimum that must move to slot 0, and an already-sorted tail.

Verification (Railway t27c lab, master 13e212a compiler)

  • t27c test-report specs/tri/sort/insertion_sort.t27: 2/2 pass (was 0/2)
  • tri seals drift --fix resealed TriCountingSort, TriHeapSort, TriInsertionSort, TriTimSort, their sort_* twins, and tools_Wp18GateSelfConsistentSelfTest
  • python3 tools/check_seal_coverage.py: OK: 1454 seals, 1310 hold, 144 known-broken (baseline unchanged, nothing baselined)

Files: one .t27, 9 generated seals, one docs/now entry. No foreign code.

🤖 Generated with Claude Code

…rt/wp18 seals

insertion_sort tracked j = i - 1 and looped while j >= 0, which on the
generated usize index is always true and underflows when a key reaches
slot 0. Track the free slot instead (j = i, stop at j > 0). Replace the
placeholder sort_basic_case, which could not compile, with a real test.
Both tests pass (t27c test-report 2/2). Seals regenerated on the Railway
t27c lab with master's compiler via tri seals drift --fix.

Refs #6609

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 21:31:39 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 38
PRs with All Checks Green 12
READY 9
FAILING 38
PENDING 0
NO CHECKS YET 0

These columns do not partition: 9 + 38 + 0 + 0 = 47, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ab873301be9c != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Closes #6609

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 21:50:53 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 38
PRs with All Checks Green 12
READY 10
FAILING 38
PENDING 0
NO CHECKS YET 0

These columns do not partition: 10 + 38 + 0 + 0 = 48, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ab873301be9c != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Closes #6609

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 21:57:40 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 37
PRs with All Checks Green 13
READY 11
FAILING 37
PENDING 0
NO CHECKS YET 0

These columns do not partition: 11 + 37 + 0 + 0 = 48, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ab873301be9c != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Closes #6609

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 22:06:26 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 37
PRs with All Checks Green 13
READY 12
FAILING 37
PENDING 0
NO CHECKS YET 0

These columns do not partition: 12 + 37 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ab873301be9c != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 16f15c8 into master Oct 5, 2026
25 of 26 checks passed
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.

master red after the queen batch merge (a4e68bae): 9 stale sort seals, insertion_sort tests fail, GateScarab type conflict

1 participant