fix(typescript-fetch): compile runtime.ts with noUncheckedIndexedAccess #25657
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 488 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.370
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25657"
general
weight: 0.35
thekhegay
Fixes #25643.
Since 7.26.0 the generated
runtime.tsof typescript-fetch does not compile in a project that enablesnoUncheckedIndexedAccess. TheContent-Dispositionparsing added in #24957 and #24974 reads regex capture groups by index without a guard, and under this option every indexed access has the typestring | undefined. Consuming projects compile the generated clients with their own compiler options, so the update broke the build of such projects.Changes
1. fix: guard the three accesses in
typescript-fetch/runtime.mustache, as suggested in the issue, and regenerate the 25 typescript-fetch samples. The guarded groups always participate in a successful match, so the behaviour does not change.2. test: add the type-check project
samples/client/petstore/typescript-fetch/tests/unchecked-indexed-access. It compiles every sampleruntime.tswithstrictandnoUncheckedIndexedAccess. It follows the model oftests/isolated-declarationsfrom #25277 and runs in the samepreteststep oftests/default, so the existing "Samples TS clients" workflow covers it.I kept the new check separate from
tests/isolated-declarations, because the README of that project says the option is disabled there on purpose, to keep the test focused on declaration emission.PR checklist
I built the CLI module with its dependencies, skipping the Java tests, and regenerated the
bin/configs/typescript-fetch-*samples only. The change adds no generator option, so the generator docs are unchanged.cc @wing328
cc @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim @thekhegay
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes the typescript-fetch
runtime.tsso it compiles in projects that enablenoUncheckedIndexedAccess. TheContent-Dispositionparsing added in 7.26.0 read regex capture groups without a guard, breaking the build of consuming projects that compile the generated client with this compiler option. The guarded groups always participate in a successful match, so parsing behavior is unchanged; all 25 sample runtimes were regenerated.Testing
runtime.tswithstrictandnoUncheckedIndexedAccess, wired into the existingtests/defaultpretest step so CI covers it. The samples-typescript-fetch-client workflow now also watches the new test directory,tests/isolated-declarations, and generatedruntime.tsfiles directly.<sup>Written for commit d85c5e1dc2f59adfd66a5095d93ca3e6510bd5fe. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25657?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->