fix(rules): apply test-contract C1/C3 to ruby/js/java/groovy/assembly (#2853) - #2966
Merged
Merged
Conversation
#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
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.describe "x" do,before(:each),let(:u),expect(, minitestassert_*/refute_*,def setup). Ruby has no runtimeassert(C1 n/a). Prose like# contextand the nounassertionsno longer fire.describe/expectto\s*\(; reduce bare runtimeassertto the chai chainassert.<x>(Node/console.assertis safety's); keepjest/mocha/vitest/cy./beforeEach/afterEachand the already contract-shaped(?<!\.)\b(?:it|test)\s*\(.\bcy\.anchored so it can't matchtransparency..assert\w*\(→assert\w{1,40}\(— keeps JUnitassertEquals(, drops the JLS/power-assert runtimeassert(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).(?i)bare prose menudescribe|expect|assert(and the linkerASSERT(guard, safety's); keep the nasmtestcasemacro + call-anchoredit(.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.../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 thetest/safetyfamily 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 runtimeassertfrom 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 withbefore → aftercounts; 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