← Back to Pull requests

fix: report leftover uses of stripped types instead of an unknown error with --add-deprecation-warnings #3274

Closed
unknown closed this pull request without merging on Nov 30, 2026 04:30 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 23:56 UTC
Author

Fixes #3013

With --strip-deprecated and --add-deprecation-warnings, a public API that still uses a @deprecated type was reported as JSII9997: Unknown error: Could not find type in same assembly: <fqn>, and the JSII3999 that tells the user what to fix was lost. The deprecation warnings injector ran on the assembly after the stripped type had been removed from it, and findType2() threw on the reference.

The build already fails on that JSII3999, and no warning can be made for a type that is no longer in the assembly. So the assembler now skips the deprecation warnings when stripping reported an error. The diagnostics are the same as with --strip-deprecated alone. When stripping reports no error, nothing changes: the warnings are made as before.

I kept the fix in the assembler instead of making findType2() tolerate missing types, so it still catches a real inconsistency in the injector (test/transforms/internals/deprecation-warnings.test.ts).

preview/v7.1 copies the current behavior on purpose (the @TODO(NEXT) for #3013 in src/compiler.ts). There the same check would go next to !assembler.typeModelFailed.

Tests: the test in test/deprecated-remover-edge-cases.test.ts that documented the internal error now asserts that the diagnostics equal those of --strip-deprecated alone and contain no unknown error. A new test checks that the warnings are still made (compiledWithDeprecationWarnings, .warnings.jsii.js) when no public API uses a stripped type. Without the change in src/assembler.ts the first test fails.

yarn jest test/deprecat test/transforms test/compiler: the change adds no failures. On my Windows machine 17 tests in those suites fail on main without this change as well (fixture symlinks and project references).

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

Diff: 247 lines (+185 / -62) across 3 files Reviewer: mrgrain Review duration: 274m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 247 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.330
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3274"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 38.9% (MEDIUM) · Higher = larger blast radius
38.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.8% · Safe to merge
16.8%