fix: report leftover uses of stripped types instead of an unknown error with --add-deprecation-warnings #3274
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
mrgrain
Fixes #3013
With
--strip-deprecatedand--add-deprecation-warnings, a public API that still uses a@deprecatedtype was reported asJSII9997: Unknown error: Could not find type in same assembly: <fqn>, and theJSII3999that 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, andfindType2()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-deprecatedalone. 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.1copies the current behavior on purpose (the@TODO(NEXT)for #3013 insrc/compiler.ts). There the same check would go next to!assembler.typeModelFailed.Tests: the test in
test/deprecated-remover-edge-cases.test.tsthat documented the internal error now asserts that the diagnostics equal those of--strip-deprecatedalone 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 insrc/assembler.tsthe 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 onmainwithout 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