← Back to Pull requests

fix: emit JSII2100 for a "@jsii struct" directive on a non-interface #3300

Open
unknown opened this pull request with 245 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 30, 2026 08:00 UTC
Author

Fixes #2942

JSII2100 (jsii-directive/struct-on-non-interface) was registered but nothing emitted it. Its message is about the @jsii struct directive, and Directives has a struct field for it ("Whether the node has the @jsii struct directive set"). Both came with #42, but the parser only learned ignore, so @jsii struct has always been reported as an unknown directive (JSII2999).

This finishes the directive:

| Source | Before | After |
|---|---|---|
| /* @jsii struct / export class Klass {} (also an enum or a member) | JSII2999 unknown directive | JSII2100 |
| /* @jsii struct / export interface IConfig { readonly a: string } | JSII2999, and not a struct (its name starts with I) | a struct, same assembly and diagnostics as with @struct |
| /* @jsii struct / export interface IConfig { method(): void } | JSII2999 | JSII7001 at the directive, as with @struct |
| /* @struct / export class Klass {} | JSII7001 | unchanged |

I chose this over removing JSII2100: configureCategories throws Unrecognized diagnostic code for a code it doesn't know, so a project that configures JSII2100 in jsii.diagnostics would stop building. If you would rather remove the code anyway, I can change the PR.

Tests: test/diagnostics/jsii-directive.test.ts documented that JSII2100 is never emitted. It now checks the rows above. Without the change in src/, 5 of the new tests fail.

yarn jest: the change adds no failures. On my Windows machine, 130 tests (fixture symlinks, project references, paths) fail on main without this change as well. Lint passes.

---

Disclosure: implemented with Claude Code (model Claude Opus 5.5): code, tests and this description.

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

🤖 Generated with Claude Code

Diff: 245 lines (+183 / -62) across 3 files Reviewer: mrgrain Review duration: 2861m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 245 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.329
Real PR Conversation Timeline
1 comments
"Review active on #3300"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% 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: 46.7% · Lower = rushed or shallow review
46.7%
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: 20.7% · Safe to merge
20.7%