test(embed): make the session-canonicalize IT actually exercise the beforeLoad guard - #533
Conversation
…eforeLoad guard The fixture seeded a single external harness session, which made it the newest, so the boot warm-resolve adopted it before the picker ever opened. Seed a newer external session so the one under test stays unadopted and selecting it sends a raw harness id into /panel/$sessionId. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe E2E test seeds newer and raw external sessions. It verifies initial listing, selective removal after warm resolution, and navigation to the raw external session’s adopted canonical route. ChangesSession canonicalization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This is a localized test-only change that improves coverage of the session canonicalization guard without changing product behavior, so no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
session-canonicalize.it.test.tswas fake coverage: it passed with thebeforeLoadguard inpanel.$sessionId.tsxdeleted. So the guard it names had no coverage, and the test duplicated whatwarm-session-resolve.it.test.tsalready proves. Found by revert-checking it while closing out #339.Why it was vacuous
It seeded exactly ONE external harness session, which made it also the newest.
__root.tsx:177sortssessions.listbyupdatedAtdescending and warm-resolves the top row at boot — andsessions.resolveon an unadopted native id adopts it. By the time the picker opened, the list returned the canonicalconciv_*id and the raw harness id was gone from the UI entirely. The guard never ran.Why the guard is genuinely reachable
nativeOnlyMeta(session-rows.ts:189) lists a never-adopted harness session under its raw native id, and the picker'sactivatenavigates with whatever id the option carries. So selecting an unadopted session drives/panel/$sessionIdwith a raw harness id and the guard fires — a real user action through the UI, no seeding.The fix is to stop the session under test from being the newest, so warm-resolve adopts a different one and leaves it unadopted.
Mechanism confirmed directly
Probe against a guard-removed build, at click time:
The newer session is adopted into a
conciv_*row by boot warm-resolve; the older one is still listed under its raw id; selecting it drives the route with that raw id. With the guard, the panel ends on/panel/conciv_*; without it, it sits on the raw id.The test now asserts that precondition explicitly (read-only via
sessions.list) rather than assuming it.One assertion had to change
The old
until(href.startsWith('/panel/conciv_'))is trivially true with two sessions — the warm session's own route already satisfies it — so keeping it would have re-introduced the exact vacuity being fixed. It now waits for the href to contain the canonical id of the external session under test, found by readingsessions.listfor aconciv_*row with that title — a row that only exists because the guard resolved the raw id.Revert-check
sourcesContentshows nobeforeLoad;grep -c "beforeLoad: async" dist/…→ 0) → 1 failed.--repeat-each=5→ 5 passed.Test-only change; no changeset. Full embed suite:
105 passed.🤖 Generated with Claude Code
Summary by CodeRabbit