Skip to content

fix: three functional regressions (SSR crash, /review 404, capture)#11

Merged
nokternol merged 4 commits into
mainfrom
fix/bug-fixes-mar-07
Mar 8, 2026
Merged

fix: three functional regressions (SSR crash, /review 404, capture)#11
nokternol merged 4 commits into
mainfrom
fix/bug-fixes-mar-07

Conversation

@nokternol

Copy link
Copy Markdown
Owner

Summary

  • Bug 1 (SSR crash): +layout.ts load now catches errors from api.me() so a cookie-less SSR request returns { user: null } instead of crashing. api.ts guards window.location.href behind typeof window !== 'undefined'.
  • Bug 2 (/review 404): Implements the /review page that lists open PRs. IndexCache gains findByBranch; the inflight endpoint cross-references the cache and includes id when matched, enabling "Open chat →" links.
  • Bug 3 (capture): api.summarise() is now non-fatal via .catch(() => ({ summary: '' })). A LLM failure no longer blocks the GitHub branch + PR creation.

Test plan

  • npm run check — all 7 gates green (Biome, tsc×2, svelte-check, tests×2, build)
  • New test: layout.test.ts — 401 from /auth/me resolves to null user
  • New test: capture page — summarise 500 → capture still navigates to /chat/:id
  • New tests: review/page.test.ts — empty state, items without id, items with id (Open chat link)
  • New tests: content.test.ts — inflight includes id when branch matches cache
  • New test: index-cache.test.tsfindByBranch returns correct entry
  • Storybook: Routes/Review — three stories (Empty, Items without chat link, Items with chat links)
  • CI quality-gate and Docker image builds pass

🤖 Generated with Claude Code

nokternol and others added 4 commits March 8, 2026 16:36
If /api/chat/summarise returns an error, the capture flow falls back
to an empty summary and proceeds to create the GitHub branch + PR.
Previously a summarise failure would surface as "Something went wrong"
and leave the user with nothing created.

Adds a test proving capture navigates to /chat/:id even when
summarise returns 500.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…list

Three related changes that together fix the broken in-flight PR links:

1. IndexCache.findByBranch — new method to look up a cache entry by
   branch name, enabling cross-referencing with GitHub's open PR list.

2. GET /api/content/inflight — now calls findByBranch for each PR and
   includes the cache entry's id when a match exists. Entries created
   via /api/capture will always match; direct-push PRs will not.

3. /review route — new SvelteKit page that lists open PRs from the
   inflight endpoint. When an id is present, renders an "Open chat →"
   link to /chat/:id. Previously the header badge linked to /review
   which returned a 404.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two changes that together stop the app from crashing on every
server-side render before the user has a session cookie:

1. api.ts req() — guard window.location.href behind
   typeof window !== 'undefined'. The 401 handler was crashing the
   Node SSR process because window does not exist server-side.

2. +layout.ts load — wrap api.me() in .catch(() => null). The SSR
   request to /auth/me carries no session cookie, so it always returns
   401. Without the catch, SvelteKit's SSR threw on every cold load;
   the layout now renders the sign-in screen instead.

Adds a layout test that asserts a 401 from /auth/me resolves to
{ user: null } rather than throwing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a pull_request trigger so the quality gate (Biome, tsc, svelte-check,
tests, build, audit) runs on every PR, not only after merging to main.
Docker image builds are gated with `if: github.event_name == 'push'` so
they continue to run only on main — GHCR push credentials are not needed
on branch runs.

Without this, CI could not be read before merge, making it impossible to
satisfy the node-establish-gates CI Completion Requirement on a protected
branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nokternol nokternol merged commit fa0713a into main Mar 8, 2026
3 checks passed
@nokternol nokternol deleted the fix/bug-fixes-mar-07 branch March 8, 2026 16:52
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.

1 participant