Skip to content

fix: preserve v4 package compatibility and mock usage diagnostics - #1123

Draft
omermorad wants to merge 10 commits into
masterfrom
fix/v4-release-regressions
Draft

omermorad wants to merge 10 commits into
masterfrom
fix/v4-release-regressions

Conversation

@omermorad

@omermorad omermorad commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

The aborted 4.2.0 candidate breaks declaration checking when consumers mix supported 4.x package versions: updating only Core breaks Unit 4.1.2, and updating Unit while keeping either doubles adapter at 4.1.2 also fails. Preserve the published named builder and mock-override contracts while inferring enhanced builders from TestBed. Unit does not reexport the four Fluent implementation types; consumer helpers can emit reusable declarations without importing those names.

Also fix two runtime regressions:

  • Redundant-mock warnings now track the selected override when qualified lookup uses bare-token fallback, while retaining metadata-specific cache identity.
  • Jest and Vitest again deep-mock objects returned through enumerable getter/setter pairs. Wrapping is lazy, preserves descriptors and stable mock identity, and avoids evaluating getters or invoking setters during construction. Permanent tests cover replacement values, setter round trips, configurable/nonconfigurable accessors, and getter spies.

Validation:

  • Earlier builder fixes passed build/lint, 262 package tests, 24 release-script tests, all ten packed E2E consumers on Node 26, and twenty strict packed-package compatibility combinations with declaration emission/consumption.
  • Accessor regression tests failed before the fix. With the fix, Jest's 31 tests and Vitest's 33 tests plus type checks pass; both adapter builds and lint pass.
  • The compatibility matrix uses TypeScript 5.2.2 with Node10 resolution and TypeScript 6.0.3 with NodeNext, both with skipLibCheck disabled. The former avoids a Vitest NodeNext diagnostic already present in the published baseline.

Unresolved release findings:

  • Existing TestBed subclasses with explicitly typed legacy static factory overrides still fail TS2417 against enhanced factory return types. Permanent regression fixtures now cover both solitary and sociable failures. The matrix reports every combination and fails the release gate: locally 12 checks pass and 8 candidate-Unit checks fail TS2417, including aligned candidate adapters. The public API decision remains pending.
  • The separately reported composition cycle/boundary edge still requires resolution.

Publication remains paused. This PR changes no package versions or release tags; existing 4.2.0 tags remain untouched. The historical E2E harness is developed separately in #1125; a green historical suite does not establish compatibility for contracts absent from that suite.

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.82353% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.64%. Comparing base (8732773) to head (355e8a0).

Files with missing lines Patch % Lines
packages/doubles/vitest/src/mock.static.ts 96.87% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1123      +/-   ##
==========================================
+ Coverage   93.02%   93.64%   +0.62%     
==========================================
  Files          27       29       +2     
  Lines         645      708      +63     
  Branches      117      124       +7     
==========================================
+ Hits          600      663      +63     
  Misses         27       27              
  Partials       18       18              
Flag Coverage Δ
core.unit 97.00% <100.00%> (+0.15%) ⬆️
di.injectionjs 100.00% <ø> (?)
di.inversify 87.73% <ø> (ø)
di.nestjs 87.25% <ø> (ø)
doubles.jest 100.00% <100.00%> (ø)
doubles.vitest 97.82% <96.87%> (+0.76%) ⬆️
unit 84.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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