Skip to content

Consume the profile-settings deep link on the route, not on component construction - #6096

Merged
habdelra merged 1 commit into
mainfrom
claude/eager-curie-vq501r
Sep 13, 2026
Merged

Consume the profile-settings deep link on the route, not on component construction#6096
habdelra merged 1 commit into
mainfrom
claude/eager-curie-vq501r

Conversation

@habdelra

Copy link
Copy Markdown
Contributor

The flake

Acceptance | operator mode tests > account popover: a deep link arriving logged out waits for login, then opens the modal fails intermittently on host shard 9, on commits unrelated to it. The check-run annotation is always the same assertion:

Element [data-test-settings-modal] exists
Expected: Element [data-test-settings-modal] exists
Result:   Element [data-test-settings-modal] does not exist

The app is logged in by then and the request is still in the URL — the modal just never opens.

Why

?openProfileSettings was read once, in SubmodeLayout's constructor. The param is moved by the router; the component is mounted and unmounted by the authentication gate. Neither actor knows about the other, and the request can be lost at two separate points:

  • The redirect drops it. The index route's model hook redirects whenever the URL carries no operatorModeState — exactly the deep link's URL shape. That redirect aborts the transition before Route#setup has written the param onto the controller, then rebuilds the param set from the router's own cache, which never learned the value. The request is gone from the controller and the URL together.
  • Route#setup puts it back. Every transition rewrites each declared param onto the controller from its captured values, so a transition that captured the param before it was consumed resurrects it afterwards — which is how the modal can open and the param still be left in the URL.

Which one bites depends on where the render that constructs the layout falls between them. On the logged-out arrival path the session churns (logout → login → route refresh → redirect), so that ordering moves with load and with the shard's module order, which is itself not stable between runs.

The change

The route consumes the request at fixed points in the transition instead:

Point Reads Why
model() params ahead of the redirect that would otherwise drop it. It has to read params, not the controller — Route#setup does not write this transition's params onto the controller until after model() resolves
the redirect drops the param explicitly, so the router cannot rebuild it from its cache after the modal has opened
setupController the controller runs immediately after Route#setup's write-back, so a transition that captured the param before it was consumed cannot put it back

All three sit after the logged-in gate, so a logged-out arrival still leaves the request in the URL to outlive the login form, and the post-login route refresh brings it back with a session to act on. Consumption stays idempotent and still nulls the param, so a dismissed modal does not reopen on the model refresh every schedulePersist() triggers.

The scheduleOnce('afterRender') dance in SubmodeLayout goes away with it — it existed to work around writing state the same render pass had already read, which the route does not have to do.

A [profile-deep-link] channel (test-gated, alongside the existing [login-diag] / [start-phase] ones) records whether each arrival was acted on or held for the login form, so a future failure names which of the two it was rather than being silent.

Tests

A new case covers an arrival with the layout already mounted — an in-app navigation rather than a cold boot, which a constructor read can never see. It is a genuine guard, not decoration:

Result
New test against main's source failsElement [data-test-settings-modal] does not exist, the same assertion and message CI reports
New test with this change passes
account popover module 11/11
Full Acceptance | operator mode tests file 26/26, 0 fail

Types and lint clean. Run against a locally booted stack (base, skills, /test/, /node-test/, live prerender).

🤖 Generated with Claude Code

https://claude.ai/code/session_01GNSdVEE6LxfSjJ2Nv7aczY


Generated by Claude Code

… construction

`?openProfileSettings` was read once in `SubmodeLayout`'s constructor, which
raced two things the component has no relationship to.

The index route's model hook redirects whenever the URL carries no
`operatorModeState` — exactly the deep link's URL shape. That redirect aborts
the transition before `Route#setup` has written the param onto the controller,
and rebuilds the param set from the router's own cache, which never learned the
value; the request is dropped from the controller and the URL together.
Separately, every transition's `setup()` rewrites each declared param onto the
controller from its captured values, so a transition that captured the param
before it was consumed puts it straight back.

Which of those bites depends on where the render that constructs the layout
falls between them, and the layout is mounted and unmounted by the
authentication gate — so on the logged-out arrival path it moved with shard
order and load, and `account popover: a deep link arriving logged out waits for
login, then opens the modal` failed intermittently on CI shard 9.

The route now consumes it at fixed points in the transition instead: in
`model()` from `params` (the controller is not written until after `model()`
resolves) ahead of the redirect, and in `setupController` after `setup()`'s
write-back. The redirect drops the param explicitly so the router cannot
rebuild it. A `[profile-deep-link]` channel records whether each arrival was
acted on or held for the login form.

The new regression test covers an arrival with the layout already mounted,
which the constructor read could never see; it fails without this change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GNSdVEE6LxfSjJ2Nv7aczY
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T01:32:12.052792Z f4d6ca9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4d6ca925b

ℹ️ 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".

Comment thread packages/host/app/routes/index.gts
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   2h 3m 5s ⏱️
4 743 tests 4 729 ✅ 14 💤 0 ❌
4 758 runs  4 744 ✅ 14 💤 0 ❌

Results for commit f4d6ca9.

Realm Server Test Results

    1 files    214 suites   1h 18m 36s ⏱️
2 842 tests 2 842 ✅ 0 💤 0 ❌
2 881 runs  2 881 ✅ 0 💤 0 ❌

Results for commit f4d6ca9.

Copy link
Copy Markdown
Contributor Author

[Claude Code 🤖] CI is green on f4d6ca92 and one status needs a human.

All 69 check runs are success or skipped, including Host Tests (9, 16) — the shard this flake lives on:

Host 4 743 tests, 4 729 ✅, 14 💤, 0 ❌
Realm Server 2 842 tests, 2 842 ✅, 0 ❌
Matrix Playwright, Software Factory, Boxel CLI, Lint all green

For contrast, the run that prompted this fix reported 0 ❌ 1 🔥 on the same shard, that error being this test.

percy/-cardstack-host reports "1 visual change needs review" and is the only thing keeping the combined status red. That is Percy's approval gate rather than a failed test — it stays in error until someone approves the build, the same way it did on #6093 before it resolved to "Visual review approved". I can't clear it: approving a visual diff is a human judgement call, and percy.io is outside this session's egress policy, so I can't even view the diff to say what changed.

Worth knowing when you look at it: this diff contains no template or CSS changes at all — it deletes a constructor from submode-layout.gts and adds route logic, so a genuine rendering delta would be surprising.

Nothing else is outstanding; the Codex finding is answered on its thread.


Generated by Claude Code

@habdelra
habdelra requested a review from a team September 13, 2026 06:54
@habdelra
habdelra merged commit 97462d7 into main Sep 13, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants