Skip to content

fix: align test_mapping assertion_type with Gaze's assertion-type set - #28

Merged
jflowers merged 3 commits into
zero-dot-force:mainfrom
jflowers:fix/align-assertion-types
Nov 19, 2026
Merged

jflowers merged 3 commits into
zero-dot-force:mainfrom
jflowers:fix/align-assertion-types

Conversation

@jflowers

Copy link
Copy Markdown
Contributor

Aligns test_mapping's assertion_type with Gaze's own vocabulary before v0.2.0 is published. Refs #7.

Problem

Spec 004 took its assertion vocabulary from snake-eyes: equality, comparison, membership, error_check, plus "" for 19 standard matchers it left unclassified (toBeUndefined, toBeNull, toBeTruthy, toHaveLength, toHaveBeenCalled, snapshots, …). That vocabulary isn't Gaze's:

  • Gaze's porting contract (docs/porting/taxonomy-reference.md § Assertion Types) and its JSON report schema's assertion_type enum (internal/report/schema.go) both list exactly equality, error_check, nil_check, diff_check, custom. Our comparison, membership and "" aren't in that list.
  • Gaze's adapter computes AssertionDetectionConfidence as the share of rows with a non-empty type (internal/adapter/quality.go classificationConfidence), so every "" row lowered it.
  • Gaze's Go-native detector never emits ""; unknown forms become custom.

Change

Each form now gets the kind Gaze's Go detector assigns to its testify equivalent (classifyTestifyCall + mapKindToType):

Kind Forms
equality previous equality forms, plus ordered relations (Greater/Less), toContain/toMatch/assert.match (Contains/Regexp), toBeTruthy/toBeFalsy/assert.ok/bare assert() (True/False), toHaveLength (Len), toBeInstanceOf/toBeTypeOf (IsType), toHaveProperty, toBeNaN
error_check unchanged, plus assert.ifError (NoError)
nil_check toBeNull, toBeUndefined, toBeDefined (Nil/NotNil)
diff_check toMatchSnapshot, toMatchInlineSnapshot (go-cmp Diff)
custom mock occurrence/count matchers, toSatisfy, assert.fail, and any unknown matcher

Negation, .resolves. and .rejects. behave as before. Detection, pairing and side_effect_type inference are unchanged: inference only branches on error_check, and no existing test's side_effect_type changed.

Spec first (e026231): amends specs/004-test-mapping/ in place (spec.md, data-model.md §2–4/§7, contract, and a note on research R6) and adds OpenSpec change align-assertion-types. The test that compares matchers.ts against the data-model tables row by row passes on the amended tables.

Result on this repo's own tests

Before After
Rows outside Gaze's set 389 (324 "", 43 membership, 22 comparison) 0
Gaze classificationConfidence 91 100

Gates

  • npx biome check src/ tests/: pass
  • npm run build: pass
  • npx vitest run --coverage: 1,501 passed; 95.06% statements, 89.86% branches (unchanged)

One pre-existing timing risk: on the first coverage run, pipeline.test.ts › "collects node:assert assertions through the pipeline in both bootstrap modes" took 5.39s against vitest's default 5s timeout and failed. It passed in isolation and on a full rerun. That test's duration is unrelated to this change, but it could make CI flaky.

Constitution check

I Protocol Fidelity PASS · II Detection Accuracy PASS · III TypeScript-Native N/A · IV Testability PASS · V Analysis Safety PASS (details in the proposal)

Follow-ups

  • snake-eyes emits comparison, membership, identity and generic, so it has the same mismatch with Gaze.
  • Gaze's own docs/protocol.md describes assertion_type as an open string, while its taxonomy reference and report schema use the closed five values.

Before merge

  • uf.review-council: all reviewers APPROVE

🤖 Generated with Claude Code

jflowers and others added 3 commits November 19, 2026 15:03
Amends specs/004-test-mapping (spec, data-model, contract, R6 note)
and adds OpenSpec change align-assertion-types. The kind set becomes
Gaze's equality / error_check / nil_check / diff_check / custom,
routed by parity with Gaze's Go-native testify routing; "" and the
comparison/membership kinds are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-types 1.1, 1.2)

assertion_type is now exactly Gaze's equality / error_check / nil_check
/ diff_check / custom, routed by parity with Gaze's Go-native testify
routing. toBeNull/toBeUndefined/toBeDefined → nil_check, snapshots →
diff_check, ordered/containment/truthiness/type/length matchers →
equality, assert.ifError → error_check, mock occurrence/count forms,
toSatisfy, assert.fail and unknown matchers → custom. No row carries
an empty type, so Gaze's assertion-detection confidence counts every
recognized assertion. On this repo: 0 rows outside Gaze's set (was
389), detection confidence 91 → 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jflowers added a commit to jflowers/reading-stone that referenced this pull request Nov 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Council Verdict: APPROVE WITH ADVISORIES

Council approved with advisories — unresolved HIGH/CRITICAL findings require human judgment before merge.

Reviewers: divisor-adversary, divisor-architect, divisor-curator, divisor-guard
Iterations: 1

Input: origin/main@c6e64d7ea02b9d2dbe52df913ed0db53400e558a...fix/align-assertion-types@1ea3234

Dispatch Provenance

Run Agent Source Requested Resolved parent Reported
614838c5 divisor-adversary advisor Muse-Spark-Open-816B-A42B-NVFP4 — Muse-Spark-Open-816B-A42B-NVFP4
d9ae7600 divisor-architect advisor Muse-Spark-Open-816B-A42B-NVFP4 — Muse-Spark-Open-816B-A42B-NVFP4
1c3326b9 divisor-curator advisor Muse-Spark-Open-816B-A42B-NVFP4 — Muse-Spark-Open-816B-A42B-NVFP4
121006d7 divisor-guard advisor Muse-Spark-Open-816B-A42B-NVFP4 — Muse-Spark-Open-816B-A42B-NVFP4

Divisor Adversary (APPROVE)

No findings.

Divisor Architect (APPROVE WITH ADVISORIES)

  • 1 LOW finding omitted (see inline comment).

Divisor Curator (APPROVE)

No findings.

Divisor Guard (APPROVE)

No findings.


This review was generated by /uf.review-council (AI-assisted).

@@ -133,12 +133,12 @@ As the pipeline, I infer which side-effect type each assertion observes — trac
**Assertion detection**

- **FR-007**: The pipeline MUST collect assertions from each paired test's callback subtree (including nested function expressions within it; hooks and describe-scope statements excluded): (a) `expect(...)` chains on which a matcher method is invoked — one row per matcher invocation — and (b) `node:assert` / `node:assert/strict` calls (`assert(...)`, `assert.ok`, `assert.equal`, `assert.throws`, and siblings), recognized through the file's import/require declarations whose module specifier is exactly `node:assert`, `node:assert/strict`, or `assert` — matched syntactically in both checker and parse-only modes (node:assert admits no in-root re-export, so the specifier table is the complete resolution; the binding forms are pinned in the data model, Section 4.2). An `expect(...)` with no matcher invocation is not an assertion. The complete matcher / assert-form classification table MUST be pinned as normative data in this feature's data model, with every standard vitest/jest matcher and `node:assert` function routed to a kind or explicitly to none.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW] FR-007 still pins "routed to a kind or explicitly to none" — stale after the closed-set amendment

FR-007 (line 135) requires the classification table to route "every standard vitest/jest matcher and node:assert function ... to a kind or explicitly to none." The closed kind set is now never-empty — Gaze's five values (equality, error_check, nil_check, diff_check, custom), with the total miss path routing to custom — so "explicitly to none" describes the removed empty-string-unclassified semantics and contradicts FR-001, FR-008, and data-model Section 4. The same phrase also appears in the MatcherTable row at line 161. Suggested wording for both: "routed to a kind" (the miss path is total and lands on custom).

@jflowers
jflowers marked this pull request as ready for review November 19, 2026 21:49
@jflowers
jflowers merged commit 90255c9 into zero-dot-force:main Nov 19, 2026
2 checks passed
jflowers added a commit to jflowers/reading-stone that referenced this pull request Nov 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jflowers added a commit to jflowers/reading-stone that referenced this pull request Nov 19, 2026
…dot-force#28)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jflowers
jflowers deleted the fix/align-assertion-types branch November 19, 2026 22:03
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