feat: add repo browser source view#583
Conversation
roborev: Combined Review (
|
860ef47 to
2bc2a01
Compare
6d7303e to
816d598
Compare
roborev: Combined Review (
|
2bc2a01 to
df74f6f
Compare
816d598 to
7e2a5ca
Compare
df74f6f to
f0796b6
Compare
roborev: Combined Review (
|
7e2a5ca to
fb8cdad
Compare
roborev: Combined Review (
|
f0796b6 to
4fc4351
Compare
fb8cdad to
c0f2afd
Compare
roborev: Combined Review (
|
4fc4351 to
05f959f
Compare
c0f2afd to
aa81cbf
Compare
roborev: Combined Review (
|
05f959f to
cd6a9ae
Compare
aa81cbf to
4705f94
Compare
roborev: Combined Review (
|
cd6a9ae to
4087f8b
Compare
a8de124 to
92a12e4
Compare
roborev: Combined Review (
|
4087f8b to
28baf8e
Compare
92a12e4 to
d8b1abf
Compare
|
This change is part of the following stack: Change managed by git-spice. |
28baf8e to
b6a3d24
Compare
b004650 to
e3409aa
Compare
roborev: Combined Review (
|
fe384eb to
0544c65
Compare
d790905 to
c23067b
Compare
0544c65 to
3463598
Compare
c23067b to
7fd211e
Compare
Maintainers need the repo browser to be usable from a routed app surface, not just exposed as backend and store primitives. This branch composes the first full read-only browser screen around the shared file tree, route state, markdown preview, and selected-file history so reviewers can evaluate the interaction as one coherent unit. The view keeps source browsing separate from PR diff state while reusing the existing file tree and docs markdown renderer. Route parsing preserves provider-aware repository identity and selected ref/path state so later command-palette and contextual entry points can deep-link into the same surface. Validation: cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit src/lib/stores/router.test.ts src/lib/features/repo-browser/repoBrowserViewState.test.ts; node node_modules/vite-plus/bin/vp run ui-package-check; node node_modules/vite-plus/bin/vp run frontend-package-check; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; git diff --check. Ephemeral dev API smoke verified refs/tree/blob for kenn-io/middleman main; Playwright Chrome automation timed out locally after the API and frontend route returned successfully. Generated with Codex Co-authored-by: Codex <codex@openai.com>
The source browser route encodes Source mode by omitting the mode parameter, so route sync must treat a missing value as an explicit source selection instead of preserving stale local preview state. The full-stack e2e fixture now points acme/widgets at the local seeded clone so the visible repo browser page can be exercised through the real HTTP API and SQLite data rather than only mocked store calls. Validation: go test ./internal/testutil -shuffle=on; node node_modules/vite-plus/bin/vp fmt --check frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte frontend/tests/e2e-full/repo-browser.spec.ts --no-error-on-unmatched-pattern --threads=1; node node_modules/vite-plus/bin/vp run frontend-package-typecheck; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Markdown preview links can carry heading anchors through the shared docs renderer. The repo browser reused that renderer but dropped the anchor callback, so in-repo links to another heading could switch documents without targeting the intended section. This mirrors the docs workspace one-shot anchor handoff while keeping source-browser routing focused on the selected file and preview mode. Validation: node node_modules/vite-plus/bin/vp fmt --check frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte frontend/tests/e2e-full/repo-browser.spec.ts --no-error-on-unmatched-pattern --threads=1; node node_modules/vite-plus/bin/vp run frontend-package-typecheck; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo-browser markdown links can be opened directly or clicked from an already rendered document, so anchor state has to survive both the initial URL hash and the asynchronous blob load for cross-document navigation. The seeded e2e repo now includes an anchored Markdown guide so the full-stack browser test proves the renderer callback, route hash seed, real blob API, and scroll behavior together. Validation: go test ./internal/testutil -shuffle=on; node node_modules/vite-plus/bin/vp fmt --check frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte frontend/tests/e2e-full/repo-browser.spec.ts --no-error-on-unmatched-pattern --threads=1; node node_modules/vite-plus/bin/vp run frontend-package-typecheck; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Branch and tag routes can name a ref without carrying a resolved commit SHA. Sending that name back as ref_sha made unpinned routes look pinned and could confuse stale-ref handling. URL-derived refs now omit ref_sha unless the route has a real SHA, and the store reconciles named branch/tag routes with the API refs before loading tree/blob data. Validation: go test ./internal/testutil -shuffle=on; node node_modules/vite-plus/bin/vp fmt --check frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte frontend/tests/e2e-full/repo-browser.spec.ts packages/ui/src/stores/repo-browser.svelte.ts --no-error-on-unmatched-pattern --threads=1; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit ../packages/ui/src/stores/repo-browser.svelte.test.ts; node node_modules/vite-plus/bin/vp run frontend-package-typecheck; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
The ref route fix needs full-stack coverage for URLs that name a branch without a resolved SHA. The repo-browser e2e now opens that route through the real server and asserts the API flow does not send the branch name as ref_sha or mark the resolved ref stale. Validation: node node_modules/vite-plus/bin/vp fmt --check frontend/tests/e2e-full/repo-browser.spec.ts --no-error-on-unmatched-pattern --threads=1; node node_modules/vite-plus/bin/vp run frontend-package-typecheck; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo browser route loads can overlap when navigation changes while the initial file selection is still resolving, so the component now ignores stale load completions before they mutate selection or URL state. Repository Markdown previews also opt out of automatic external image loads while docs mode keeps its existing behavior. External Markdown images render as explicit links, and repo-local images continue to flow through the asset endpoint. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo browser markdown links with fragments must leave the fragment in the URL, otherwise refreshes and shared links reopen the file at the top instead of the clicked heading. Route updates now carry the anchor in the same navigation that opens preview mode. Validation: (cd frontend && ../node_modules/.bin/vp test); node node_modules/vite-plus/bin/vp run ui-package-check; node_modules/.bin/vp exec svelte-mcp svelte-autofixer ./frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte --svelte-version 5; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo browser markdown fragments need to survive the real router path, not only the component callback boundary. The router now strips fragments before parsing query parameters, and route-driven path synchronization no longer pushes stale URLs after async file loads complete. The repo-browser full-stack spec now proves clicked markdown fragments stay in the URL and that untrusted external markdown images render as links instead of external image loads. Validation: (cd frontend && ../node_modules/.bin/vp test src/lib/features/repo-browser/RepoBrowserFeature.test.ts src/lib/stores/router.test.ts ../packages/ui/src/routes.test.ts); (cd frontend && ../node_modules/.bin/vp test); node node_modules/vite-plus/bin/vp run ui-package-check; (cd frontend && ../node_modules/.bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts); go test ./internal/testutil -shuffle=on; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo browser markdown navigation can change the URL fragment without changing the selected file, especially through browser Back and Forward. The router needs to keep that fragment in route state, and the component needs to treat route anchors as one-shot scroll inputs so hash-only navigation still reaches the requested heading. Async file selection also needs a local generation guard so a slower markdown navigation cannot push an older path after a newer selection wins. Markdown asset URLs now use immutable commit refs to match the hardened asset API below this branch. Validation: cd frontend && ../node_modules/.bin/vp test src/lib/features/repo-browser/RepoBrowserFeature.test.ts src/lib/stores/router.test.ts ../packages/ui/src/routes.test.ts; node_modules/.bin/vp exec svelte-mcp svelte-autofixer frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte --svelte-version 5; cd frontend && ../node_modules/.bin/vp test; node node_modules/vite-plus/bin/vp run ui-package-check; cd frontend && ../node_modules/.bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts; git diff --check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Branch and tag routes can gain a resolved SHA after the first repo load. That SHA is useful in the URL, but treating it as route identity causes a second full repository load for the same logical ref. Keep SHA-sensitive route identity for direct commit browsing while allowing symbolic branch and tag routes to update their resolved SHA without reloading the source view. Validation: vp exec svelte-mcp svelte-autofixer ./frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit src/lib/features/repo-browser/RepoBrowserFeature.test.ts; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; node node_modules/vite-plus/bin/vp run frontend-package-check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
The repo-browser route effect should react to route changes, not to local selection mutations. After removing SHA-only reloads, markdown link navigation exposed that local file selection could retrigger the effect against the old route and select the previous file back before the URL update landed. Read the current selected path and view mode untracked inside the route effect so user-driven file changes can complete and push their route update without being reverted by stale route state. Validation: vp exec svelte-mcp svelte-autofixer ./frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit src/lib/features/repo-browser/RepoBrowserFeature.test.ts; cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit; node node_modules/vite-plus/bin/vp run frontend-package-check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Branch routes gain a resolved SHA after the initial repo-browser load, and that URL replacement crosses the real App/router boundary. The previous component test proved the local effect behavior but did not protect against duplicate repo/tree loads through route parsing and rerendering. Add a full-stack Playwright regression that opens a symbolic branch route without path/ref_sha, waits for the resolved URL, and asserts the browser performed only one refs load and one tree load. Validation: cd frontend && node ../node_modules/vite-plus/bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; cd frontend && node ../node_modules/vite-plus/bin/vp test run; node node_modules/vite-plus/bin/vp run frontend-package-check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo-browser route changes need to look like repository navigation to host integrations, including markdown URL fragments. The feature also should not reload the same repo/ref immediately after a user ref selection pushes the matching route. Update route event mapping to preserve hashes and mark repo-browser as repos, and pre-seed the feature load key when ref selection has already loaded the target state. Validation: node node_modules/vite-plus/bin/vp exec svelte-mcp svelte-autofixer frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte --svelte-version 5; cd frontend && node ../node_modules/vite-plus/bin/vp test run --project unit src/lib/stores/router.test.ts src/lib/features/repo-browser/RepoBrowserFeature.test.ts ../packages/ui/src/routes.test.ts ../packages/ui/src/stores/repo-browser.svelte.test.ts; node node_modules/vite-plus/bin/vp run frontend-check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Record the resolved selected-ref route key before self-replacing no-ref repo browser routes, so the router update does not trigger a second repository load after the initial file selection.
Update the repo browser feature test client to match the store behavior that reads file metadata and blobs through the resolved tree commit instead of mutable branch or tag refs.
Repo browser routes need to distinguish a self-replaced resolved SHA from a later route where the same branch or tag name points at a different commit. Keeping all resolved SHAs in the route key after load prevents stale tree/blob/history state while preserving the no-extra-load self-replacement path. The markdown renderer also needs to classify external URLs after the same control-character normalization used by the unsafe URI checks. Otherwise repo preview images with obfuscated http(s) destinations can bypass the external-image toggle or be stripped inconsistently by sanitization. Validation: ./node_modules/.bin/vp exec svelte-mcp svelte-autofixer frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte; ./node_modules/.bin/vp run frontend-check; cd frontend && ../node_modules/.bin/vp test run --project unit. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repo-browser route reload fixes need full-stack coverage because duplicate or missing loads only fully show up across the router, browser API, and local clone-backed repository state. Add Playwright coverage for no-ref default route replacement, user ref selection route updates, and mounted same-branch navigation with a different requested SHA so future changes cannot regress these route/data-flow boundaries while component tests still pass. Validation: cd frontend && ../node_modules/.bin/vp exec -- playwright test --config=playwright-e2e.config.ts repo-browser.spec.ts --project=chromium --project=firefox; ./node_modules/.bin/vp run frontend-check; cd frontend && ../node_modules/.bin/vp test run --project unit. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repository markdown previews reused Docs/Kata short-id autolinks, so numeric references such as #123 rendered as inert Kata links instead of navigating to the repository issue or PR. Thread the selected repository identity into the docs markdown renderer and reuse the shared provider item-reference renderer for repo previews. Docs mode keeps Kata short-id behavior because the provider item extension is only installed when a repo context is present. Validation: cd frontend && ../node_modules/.bin/vp test run --project unit src/lib/api/docs/markdown.test.ts src/lib/features/repo-browser/RepoBrowserFeature.test.ts; ./node_modules/.bin/vp exec svelte-mcp svelte-autofixer frontend/src/lib/features/repo-browser/RepoBrowserFeature.svelte. Generated with Codex Co-authored-by: Codex <codex@openai.com>
The GitHub App E2E browser helper reported success before the fake browser had finished following the manifest callback redirect. CI could close the local callback server while that final request was still in flight, producing intermittent connection-refused failures in unrelated tests. Keep the helper synchronous so openBrowser only returns after the scripted browser work is complete, and surface helper failures through runCLI instead of detached goroutine assertions. Validation: go test ./cmd/middleman-github-app -run TestListFlagsSelectedInstallMissingRepos -shuffle=on; go test ./cmd/middleman-github-app -shuffle=on. Generated with Codex Co-authored-by: Codex <codex@openai.com>
Repository previews reuse provider item reference parsing, but raw HTML/code blocks need the same tokenizer guard as Kata links. Without it, contributor markdown such as <code>#12</code> could be rewritten into a generated provider item anchor. Add the regression at the docs markdown boundary because repo previews call through that renderer with repo context. Validation: cd frontend && ../node_modules/.bin/vp test run --project unit src/lib/api/docs/markdown.test.ts -t 'does not turn repo references inside raw code'; cd frontend && ../node_modules/.bin/vp test run --project unit src/lib/api/docs/markdown.test.ts ../packages/ui/src/utils/markdown.test.ts src/lib/features/repo-browser/RepoBrowserFeature.test.ts; ./node_modules/.bin/vp run frontend-check. Generated with Codex Co-authored-by: Codex <codex@openai.com>
7fd211e to
e0619b7
Compare
With the API and store boundary in place, maintainers need an actual code-reading workspace rather than another summary-card drilldown. This PR assembles the source view around ref and path navigation, the reusable file tree, source and Markdown rendering, and selected-file commit history.
Repository content is untrusted and refs can move, so the view keeps raw bytes and asset decisions behind backend preflight contracts while still giving reviewers a usable, forge-like repository browser.