Skip to content

test(downgrader): cover rejectsNull and null branch checks in 3.1 to 3.0 nullable merge - #90

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-luckgz
Oct 24, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/project-thread-luckgz

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 24, 2026

Copy link
Copy Markdown
Member

Requested by dinwwwh · project thread

Test-only. Stryker on main left mutants alive in the checks #87/#88 added to the 3.1 to 3.0 nullable merge. This adds expectations to the existing tests in tests/v3.1-to-v3.0.test.ts; main already gives the right output for each one.

  • anyOf of a $ref to a type: "null" target and null stays anyOf. This covers rejectsNull letting "null" through.
  • anyOf of a $ref to a type: ["object", "string"] target and null becomes oneOf. This covers the array type case of rejectsNull.
  • A typed branch with oneOf beside null is not merged and becomes a oneOf pair. This covers oneOf in NOT_NULLABLE_KEYWORDS.
  • A null branch with a description is not treated as only null, so the anyOf stays as it is. This covers the key count in isOnlyNullSchema.

I applied each of those four mutations by hand. All of them pass the tests on main and fail with this change.


Generated by Claude Code

…3.0 nullable merge

Stryker left these checks from #87/#88 untested: a `$ref` to a `type: "null"`
target or an array `type`, a typed branch with `oneOf`, and a null branch with
extra keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnRgKQZ6Maz5HiVMYr9twz
@dinwwwh dinwwwh self-assigned this Oct 24, 2026
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing claude/project-thread-luckgz (f04c471) with main (8ad5613)

Open in CodSpeed

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — test-only addition to the 3.1→3.0 behavior suite; no source changes.

  • oneOf branch guard — adds { type: 'string', oneOf: [...] } to the typed branch loop, pinning that oneOf in NOT_NULLABLE_KEYWORDS keeps the pair as oneOf instead of merging to nullable.
  • Non-trivial null branch — asserts { type: 'null', description: 'd' } is not treated as only-null, so the anyOf stays put (covers the key count in isOnlyNullSchema).
  • Array type rejects null — adds pet({ type: ['object', 'string'] }) expecting oneOf; this is the only test exercising that an array type without "null" rejects null.
  • type: 'null' does not reject — adds pet({ type: 'null' }) expecting the pair to stay anyOf.

I verified the coverage is not theater: all 84 tests pass, uncheck (oxlint/oxfmt/tsc) is clean on the changed file, and hand-applying each of the four claimed mutations to packages/downgrader/src/v3.1-to-v3.0.ts makes the corresponding new expectation fail (removing 'oneOf' from NOT_NULLABLE_KEYWORDS; widening isOnlyNullSchema's length === 3 to >= 3; forcing the rejectsNull array branch to reject nothing; dropping && type !== 'null' from the string branch). The source was restored — working tree is clean.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit ae7568d into main Oct 24, 2026
11 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.

2 participants