Skip to content

fix(rules): apply test-contract C1/C3 to ruby/js/java/groovy/assembly (#2853) - #2966

Merged
squid-protocol merged 2 commits into
mainfrom
fix/2853-test-contract-c1c3-residue
Sep 11, 2026
Merged

fix(rules): apply test-contract C1/C3 to ruby/js/java/groovy/assembly (#2853)#2966
squid-protocol merged 2 commits into
mainfrom
fix/2853-test-contract-c1c3-residue

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

#2853 deferred the #2852 test-contract corollaries for five languages the crucible then "could not measure." At the pinned v1.2.0 corpus all five now have files, so this resolves it as a pure engine change — the same shape PR #2923 used for the sibling deferrals #2832/#2833.

  • ruby (C3): anchor every everyday word to its rspec/minitest form (describe "x" do, before(:each), let(:u), expect(, minitest assert_*/refute_*, def setup). Ruby has no runtime assert (C1 n/a). Prose like # context and the noun assertions no longer fire.
  • javascript (C3/C1): anchor bare describe/expect to \s*\(; reduce bare runtime assert to the chai chain assert.<x> (Node/console.assert is safety's); keep jest/mocha/vitest/cy./beforeEach/afterEach and the already contract-shaped (?<!\.)\b(?:it|test)\s*\(. \bcy\. anchored so it can't match transparency..
  • java + groovy (C1): assert\w*\(assert\w{1,40}\( — keeps JUnit assertEquals(, drops the JLS/power-assert runtime assert(cond) (safety's), and bounds the run so a long word-char stream with no ( can't catastrophically backtrack (a latent ReDoS the new contract-test coverage surfaced; safety's rule already claims the guard, mass conserved).
  • assembly (C3/C1): drop the (?i) bare prose menu describe|expect|assert (and the linker ASSERT( guard, safety's); keep the nasm testcase macro + call-anchored it(.

Verification

  • test_test_contract_2852.py (+5 CASES/COUNTS, java/groovy added to the C1 test) + the 5 strict suites: 476 passed.
  • tests/extraction/ + tests/core_engine/: 8354 passed, 0 failed.
  • signal_contract_audit.py --ci: no new findings. Pinned ruff 0.16.0: no new findings; 5 engine files format-clean.
  • Each new regex probe-tuned against ../language-crucible/data/<lang>/ before locking.

Golden rebless (this PR)

Both masters regenerated per-leg. bless_scope.py (both legs): 24 diffs, 0 topological, all substantive, confined to the test/safety family exactly as the contract's Bless-scope note predicts — Unit Test Assertions (7) + Testing Exposure (1) direct; Error & Exception Exposure (11) + safety_score (4) + avg_safety_score (1) are normalized-relative shifts (a file's exposures are relative to its total magnitude; the C1 fix moves the dropped runtime assert from test to safety). Pipeline reprice: javascript 5→0, ruby 2→0, assembly 284→275, groovy 954→954, java 0→0. No files newly parsed or excluded.

Docs

docs/test_rule_contract.md: the five audit rows moved from "→ #2853"/"conforms-by-absence-of-evidence" to validated with before → after counts; the deferred-residue bullet rewritten as landed-in-#2853.

Label: rosetta:rebless-owed — keyword-rosetta corpus re-bless PR after merge.

Closes #2853

🤖 Generated with Claude Code

squid-protocol and others added 2 commits September 11, 2026 13:52
#2853 deferred the #2852 test-contract corollaries for five languages the
crucible could not then measure. At the pinned v1.2.0 corpus all five now
have files, so apply the fixes (same shape as PR #2923 for #2832/#2833):

- ruby (C3): anchor every everyday word to its rspec/minitest form
  (describe/context -> description string or `do`, it/specify -> string,
  before/after -> hook call/`do`/:each/:all, let/subject -> `(`/`{`,
  expect -> `(`, minitest assert/refute -> `assert_<name>`/`assert(`,
  setup/teardown -> `def`). Ruby has no runtime assert, so assert* stays
  test's. Prose (`# context`, the noun `assertions`) no longer fires.
- javascript (C3/C1): anchor bare describe/expect to `\s*\(`; reduce bare
  runtime `assert` to the chai chain `assert.<x>` (Node/console.assert is
  safety's); keep jest/mocha/vitest/cy./beforeEach/afterEach and the already
  contract-shaped `(?<!\.)\b(?:it|test)\s*\(`; `\bcy\.` anchored so it can't
  match `transparency.`.
- java + groovy (C1): `assert\w*\(` -> `assert\w{1,40}\(` -- keeps the JUnit
  `assertEquals(` framework form, drops the JLS/power-assert runtime
  `assert(cond)` (safety's), and bounds the run so a long word-char stream
  with no `(` can't catastrophically backtrack (a latent ReDoS the new
  contract-test coverage surfaced).
- assembly (C3/C1): drop the `(?i)` bare prose menu describe/expect/assert
  (and the linker `ASSERT(` guard, safety's); keep the nasm `testcase` macro
  and call-anchored `it(`.

Pipeline reprice (comment-stripped, golden-relevant): javascript 5->0,
ruby 2->0, assembly 284->275, groovy 954->954 (no bare power-assert in
corpus), java 0->0.

Tests: add ruby/js/java/groovy/assembly CASES + COUNTS to
test_test_contract_2852.py (java/groovy also added to the C1
runtime-guard-is-safety's test); refresh the assembly strict row + its
collision test. docs/test_rule_contract.md: five audit rows moved to
"validated"; the deferred-residue bullet rewritten as landed-in-#2853.

Golden-master rebless owed (scoring-layer change: `verification`).

Closes #2853

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rUcYDAzYYCgrLdHyKBT9G
The #2853 test-rule fixes drop the comment/prose and runtime-assert residue
for ruby/javascript/assembly (groovy/java unchanged in corpus), repricing the
`verification` signal. Both golden masters regenerated per-leg in isolated
venvs against language-crucible @ v1.2.0.

bless_scope.py (both legs): 24 diffs, 0 topological, all substantive and
confined to the `test`/`safety` signal family exactly as the contract's Bless
scope note predicts -- Unit Test Assertions (7) + Testing Exposure (1) direct;
Error & Exception Exposure (11) + safety_score (4) + avg_safety_score (1) are
the normalized-relative shifts (a file's exposures are relative to its total
magnitude, and the C1 fix moves the dropped runtime `assert` from test to
safety). Movement lands on ruby/rails, brew's .rb, vscode's .js and react .js
(.rb/.js files nested in mixed-language project dirs); NO files newly parsed
or excluded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rUcYDAzYYCgrLdHyKBT9G
@squid-protocol squid-protocol added the rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge label Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review September 11, 2026 18:03
@squid-protocol
squid-protocol merged commit 21accf7 into main Sep 11, 2026
41 of 42 checks passed
@squid-protocol
squid-protocol deleted the fix/2853-test-contract-c1c3-residue branch September 11, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test contract C3 residue: bare-word menus in languages the crucible cannot measure (ruby, javascript, java/groovy runtime assert forms)

1 participant