fix(microsoft-foundry): replace unsafe non-null assertion in subscription lookup#62742
fix(microsoft-foundry): replace unsafe non-null assertion in subscription lookup#62742oliviareid-svg wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryReplaces the unsafe non-null assertion on Confidence Score: 5/5Safe to merge — the fix is a focused, correct defensive guard with no functional regressions. The change is a one-line safety improvement: the non-null assertion is replaced by an explicit null check with a descriptive error. TypeScript narrows the type correctly after the guard, the existing subs[0]! on line 87 remains valid (guarded by subs.length === 1), and there are no P0 or P1 findings. All remaining considerations are P2 or lower. No files require special attention.
|
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Source inspection gives a high-confidence path: with multiple enabled subscriptions, a custom or mocked prompter returning an id outside the list makes current main assign Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the provider-local guard with the regression test, classify the changelog bullet under Unreleased Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: with multiple enabled subscriptions, a custom or mocked prompter returning an id outside the list makes current main assign Is this the best way to solve the issue? Yes for the code fix. The explicit guard is the narrowest maintainable provider-local fix and is safer than falling back to another Azure subscription; the changelog placement and real behavior proof still need cleanup. Full review comments:
Overall correctness: patch is correct What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 7468e071ddc3. |
…tion lookup subs.find() can return undefined if the selected subscription ID does not match any entry. The non-null assertion (!) suppresses the TypeScript error but causes a runtime crash when accessing tenantId on undefined. Replace with an explicit null check and descriptive error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f3f75d4 to
208c108
Compare
|
Maintainer pass update:
Prepared head pushed: |
Summary
auth.tsusessubs.find((sub) => sub.id === selectedId)!with a non-null assertionTypeError: Cannot read properties of undefined (reading 'tenantId')!assertion with explicit null check and descriptive errorTest plan
🤖 Generated with Claude Code