[luv-337] fix: route Gemini sessions by full UUID, not 8-char filename prefix#336
Conversation
…e prefix Gemini sessions linked from the dashboard project page were 404ing because `SessionFile.sessionId` was pulled from the filename regex match group (8-hex prefix), but the session detail route at `app/project/[name]/session/[sessionId]/page.tsx:42` rejects non-UUIDs and calls `notFound()`. The same sessions loaded fine from the hooks/activity table because hook stdin carries the full UUID directly. Fix: in `lib/gemini-projects.ts` `scanGeminiSessions()`, read the JSONL metadata header (line 1, ~1 KB) via a new async `readFirstLine` helper — mirrors the pattern in `lib/codex-projects.ts:46-62`. Parse `meta.sessionId` and validate against a local `UUID_RE`, then plumb the full UUID through `GeminiSessionMeta.sessionId` to both `getGeminiSessionsForCwd` and `getGeminiSessionsByEncodedName`. When the header is missing, malformed, or carries a non-UUID value, leave `sessionId` undefined so the row renders un-linked (`SessionsList` already handles this) rather than producing a clickable 404 link. New unit suite `__tests__/lib/gemini-projects.test.ts` pins all four behaviors (full-UUID propagation, malformed JSON, missing field, non-UUID value). Co-Authored-By: Claude Opus 4.7 <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 Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReads full UUID sessionId from each Gemini JSONL file’s first-line metadata header, validates it, populates GeminiSessionMeta.sessionId during scan, uses that value in session listing APIs, adds helpers for bounded-first-line reads and parsing, includes Vitest coverage for valid and edge cases, and updates CHANGELOG.md. ChangesGemini Session UUID Extraction
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 6: The changelog entry in CHANGELOG.md incorrectly references PR number
(`#337`); update that entry so the trailing PR suffix matches this PR (`#336`).
Locate the line that reads "Read full session UUID... (`#337`)" and replace the PR
number with (`#336`) to comply with the one-line entry format used throughout the
changelog.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fdaa9d9f-24e0-47ba-ac9b-f9c8a35f5b84
📒 Files selected for processing (3)
CHANGELOG.md__tests__/lib/gemini-projects.test.tslib/gemini-projects.ts
Summary
SessionFile.sessionIdcarried only the 8-hex prefix from the filename, but the session detail route atapp/project/[name]/session/[sessionId]/page.tsx:42rejects non-UUIDs and callsnotFound(). Hooks-section links worked because hook stdin carries the full UUID.lib/gemini-projects.tsscanGeminiSessions()now reads each JSONL's metadata header (line 1, ~1 KB) via a new asyncreadFirstLinehelper — same pattern aslib/codex-projects.ts:46-62— parsesmeta.sessionId, validates against a localUUID_RE, and plumbs the full UUID throughGeminiSessionMeta.sessionIdinto bothgetGeminiSessionsForCwdandgetGeminiSessionsByEncodedName.sessionId, the field staysundefinedso the row renders un-linked (SessionsListalready handles this) rather than producing a clickable 404.Test plan
bun run test:run __tests__/lib/gemini-projects.test.ts— 4 new cases pass (full-UUID propagation, malformed JSON, missing field, non-UUID value)bun run test:run— full unit suite (1577 tests) passesbun run test:e2e __tests__/e2e/hooks/gemini-integration.e2e.test.ts— 18 e2e tests passbunx tsc --noEmitcleanbun run lintclean (only pre-existing<img>warning)bun run dev→/projects→ click a Gemini-only project → click a session row → entries view loads (URL contains the full UUID, not the 8-char prefix)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests