Repository navigation
Pin the auth mount gate to its behaviour, not one spelling of the guard - #10307
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 288f00339e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| before = body[: match.start()] | ||
| if before.count("{") - before.count("}") != 1: | ||
| continue |
There was a problem hiding this comment.
Account for enclosing unbraced control statements
When the candidate guard is nested under an unbraced control statement, such as if (ready) if (!active || !mounted) return null;, the brace count is still one, so this helper accepts it as a component-level guard. If ready is false while active is false, the guard is skipped and the component can render, leaving this auth-route contract green despite the regression; determining scope solely from brace depth does not establish that the guard executes unconditionally.
Useful? React with 👍 / 👎.
| elif source[index] in "\"'`": | ||
| quote, stop = source[index], index + 1 | ||
| while stop < end and source[stop] != quote: | ||
| stop += 2 if source[stop] == "\\" else 1 | ||
| out[index + 1 : stop] = " " * max(0, stop - index - 1) | ||
| index = min(stop + 1, end) |
There was a problem hiding this comment.
Blank regular-expression literals before scanning guards
When the component contains a regex literal such as /if (!active) return null;/ but no executable inactive guard, _blanked leaves that literal untouched and _inactive_returns_null interprets its contents as code. The test therefore passes while an inactive mount renders; regex bodies need to be excluded alongside comments and quoted strings before the textual parser searches for guards.
Useful? React with 👍 / 👎.
Repo tests (CPU)is red onmainat99a83f6a6anda2a4143ce, and so on PRs branched from them, on one test out of 15,899:#10237 is right, and it did not open the auth routes
That PR gave
SettingsDialogMounta second surface, so the single lazy-mount flag became two:The auth gate is untouched.
!activestill short-circuits, so an inactive mount still renders nothing, which is the whole of what this test is named for. What changed is the lazy-mount bookkeeping beside it, and the assertion happened to quote both halves as one string.The other two assertions in this test still match byte for byte:
<SettingsDialogMount active={active && ready} />and<CredentialBootstrapGate active={!isAuthFlowRoute}>. So the chain the test actually cares about, auth route toactive={false}to nothing rendered, is intact at every link.The change
Assert that
SettingsDialogMountreturns null whenever it is not active, without naming the rest of the condition.Two details are deliberate:
SettingsDialogMountbody.SettingsDialogLoadingabove it also carriesif (!active) return null;, so an unscoped search would still pass with this guard deleted outright.|| ...is accepted after!activeand&& ...is not. The return has to happen on every inactive render, not just some, and&&would let an inactive mount render.This is the same shape as #10267, #10231, #10289 and #10297: an assertion written as one exact literal over something that was never fixed. This file had already reached that conclusion twice on its own, once as "Lock the count, not the spelling, so a rename does not falsely fail" and once as "Lock the behaviour, not one spelling of it, so either form passes". This assertion is the one that did not get the treatment.
Verified by breaking it
Eight edits to
settings-dialog-mount.tsx, each run against the test, next to what a plain re-sync of the literal to today's guard would give:!activehalf droppedbecomes&&`, so inactive can still renderactiveThe first four rows are the point. A re-sync goes red on any of them, none of which touches the auth routes, and the next one is as likely as #10237 was. The last four confirm the test still fails for every way the gate can actually break, including the guard being deleted while the identical line in
SettingsDialogLoadingstays put.tests/studio: no other test changes. No source changes.