Repository navigation
fix(git-panel): log route answers 503 for discovery outages - #12933
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] b6583cf |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the pre-existing That harness's What this change shipsInventory (8 items) — 8 justifiedIntent: stop a failed commit-history read from rendering as an empty history (issue #10892, log-route half) — a FIX.
Sibling routes counted and verified against the description's table: [FIRST-PRINCIPLES-REVIEWED] b6583cf |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Outage notice isn't visually scoped to history: blind reader couldn't reconcile the green "clean" pill or the blank body below with the red error. Watch
Suggestions
[UX-REVIEWED] b6583cf |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
3caf94e to
e02107e
Compare
…mpty history
`GET /api/project/git/log` turned every nonzero `rev-parse --git-dir` into
`200 {"repo": false, "commits": []}`, so a sandbox refusal, spawn failure,
timeout or corrupt repository metadata rendered as "no history" in the Git
panel. The status route already classifies discovery through `_probe_git_dir`
and only Git's own `fatal: not a git repository` verdict is absence.
Backend: the log route now uses the same `_probe_git_dir` probe (LC_ALL=C so
the English verdict matches) and a shared `_is_not_a_repo_verdict` predicate,
lifted out of the status route so both routes carry one classification
contract. Not-a-repo or a vanished directory -> `repo: false`; any other probe
failure -> `503 {"code": "git_log_unavailable"}` beside the existing
`git_log_filter_refused` branch. A nonzero `git log` after a successful probe
stays `repo: true, commits: []` (unborn HEAD).
Frontend: GitPanel renders `git_log_unavailable` as the untitled localized
log notice (mirrors `git_status_unavailable`) and no longer shows the
"No changes or commits to display." empty state while the log route has
failed. Capture harness `capture-git-log-unavailable.mjs` shoots the state.
Closes #10892
e02107e to
b6583cf
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved after verified readiness: passed, PR Readiness success on this head, mergeable, no open change requests. [operator: bolichen97 batch review 2026-09-23]
…mpty history (kirodotdev#12933) `GET /api/project/git/log` turned every nonzero `rev-parse --git-dir` into `200 {"repo": false, "commits": []}`, so a sandbox refusal, spawn failure, timeout or corrupt repository metadata rendered as "no history" in the Git panel. The status route already classifies discovery through `_probe_git_dir` and only Git's own `fatal: not a git repository` verdict is absence. Backend: the log route now uses the same `_probe_git_dir` probe (LC_ALL=C so the English verdict matches) and a shared `_is_not_a_repo_verdict` predicate, lifted out of the status route so both routes carry one classification contract. Not-a-repo or a vanished directory -> `repo: false`; any other probe failure -> `503 {"code": "git_log_unavailable"}` beside the existing `git_log_filter_refused` branch. A nonzero `git log` after a successful probe stays `repo: true, commits: []` (unborn HEAD). Frontend: GitPanel renders `git_log_unavailable` as the untitled localized log notice (mirrors `git_status_unavailable`) and no longer shows the "No changes or commits to display." empty state while the log route has failed. Capture harness `capture-git-log-unavailable.mjs` shoots the state. Closes kirodotdev#10892
What
GET /api/project/git/lognow classifies repository discovery the way the status route does. Only Git's ownfatal: not a git repositoryverdict (or a project directory that vanished) answers200 {"repo": false, "commits": []}. Every other failedrev-parse --git-dirprobe -- sandbox refusal, spawn failure, dubious ownership, permission failure, timeout/kill, corrupt repository metadata -- answers503 {"error": "Couldn't read the commit history.", "code": "git_log_unavailable"}.The Git panel renders that code as the untitled, localized log notice (mirroring
git_status_unavailable) and no longer shows the "No changes or commits to display." empty state while the log route has failed.Why
The log route collapsed every nonzero probe into the not-a-repository answer, so an outage rendered as an empty history. The status route was fixed in #10794 (and #11982 added the filter-driver refusal to both routes) but left this branch; the panel therefore drew an empty commit list over a log nobody read, indistinguishable from a brand-new repository. Issue #10892's second item (labelling stale status data after a failed refresh) is already on
main-- the header hides branch/ahead-behind understatusErrorand the status notice names the stale-history clause -- so this PR owns the remaining log-route half.How
Backend (
src/kiro_crew/dashboard/handlers/files.py):_is_not_a_repo_verdict(probe_stderr)-- the one classification contract. The status route's inlineany(... startswith("fatal: not a git repository"))moved into it unchanged; the log route now calls the same predicate._runuses_probe_git_dir(base, _env)(bounded stderr,capture="stderr") instead of a bare_run_git_boundedstdout probe, withLC_ALL=C/LANGUAGE=Cadded to its env so the English verdict matches, exactly as the status route pins it.{"repo": False, "commits": []}; any other nonzero ->{"_log_unavailable": True}, answered as503 git_log_unavailablebeside the existinggit_log_filter_refusedbranch, after the same_project_directory_absentre-check the status route performs (a directory deleted between the isdir gate and the spawn is absence, not an outage).log_rc != 0 -> {"repo": True, "commits": []}(unborn HEAD exits 128 there; settled in fix(git-panel): stop drawing a clean pill over a status we never read #11982) and therev-parse --short HEADhandling.Every git route in
files.py, and how each classifies a discovery failure after this change:GET /api/project/git/status_probe_git_dir+_is_not_a_repo_verdictrepo: false; else503 git_status_unavailable(unchanged)GET /api/project/git/log_probe_git_dir+_is_not_a_repo_verdictrepo: false; else503 git_log_unavailable(this PR)GET /api/project/git.gitand readsHEAD.gitfound ->repo: false; unreadable HEAD ->repo: truewith no branch (decorative label; degrades by design, out of scope)GET /api/project/treerev-parse --git-dirrepo: falseand a full filesystem walk (the listing still renders from the filesystem, so no user-visible collapse; out of scope)GET /api/file/diffsubprocess.run(... check=True)status: "not_git"("there is no baseline" is a statement about the file; documented in-line; out of scope)Frontend (
website/src/components/GitPanel.tsx):logUnavailable = gitErrorCode(logError) === 'git_log_unavailable'-> untitledErrorNoticewith the existingcomponents.gitPanel.log_failedcopy (no new i18n key), mirroring thestatusUnavailablebranch. Uncoded log failures keep their titled rendering.!logError: "no commits to display" beside a notice saying history could not be read presents an outage as an empty history.Docs:
docs/system-specs/modules/learn-cron-dashboard.mdgit-panel route paragraph now documentsgit_log_unavailable, the shared predicate, and the empty-state suppression.Tests
Backend,
test/test_project_git_status_log.py, newTestGitLogDiscoveryBoundary(12 cases): explicit not-a-repository verdict incl. non-UTF-8 stderr (assertsLC_ALL=C,LANGUAGE=C, stderr captured / stdout discarded); real non-repository directory; path text containing "not a git repository" does not claim absence (503); sandbox refusal (sandboxed_spawn_argvraises); spawnOSError; stderr overflow kill (-9, proc killed and waited); probe timeout (-9); corrupt.git/configwith real Git (probe exits 128 withbad config line, asserted not to be the verdict -> 503); unborn repository stays200 {"repo": true, "commits": []}; directory vanished after probe failure ->repo: false; and the shared predicate's truth table.Frontend,
website/src/test/GitPanel.test.tsx, newGitPanel log route outageblock: the coded 503 renders one untitled notice with the localized copy (server sentence absent), keeps the clean pill, suppresses the empty state and the Commits header, keeps Refresh live, and hands the agent a report carryinggit_log_unavailable; an uncoded log failure keeps its titled rendering.Run locally by path: the two changed test files (71 backend, 29 frontend, all green). Static gates: black baseline gate, isort, flake8, mypy, comment-history gate,
tsc -b --force, eslint on changed files -- all exit 0. Full suites run in CI.Screenshots
Real built SPA served by
website/scripts/capture-git-log-unavailable.mjs(committed) with the status route fixtured clean and the log route fixtured503 git_log_unavailable. The harness asserts norole=dialogis open,0notice titles,0empty-state matches, the clean pill present and Refresh enabled before each shot.Dark:
Light:
Pattern harvest
Rule candidate: when two sibling routes probe the same external boundary (here Git repository discovery), the verdict predicate lives in ONE named helper both call; an inline copy in one route is where the second route's classification silently drifts. Also: a UI empty state must be gated on the data source that would fill it having actually answered --
isClean && no commitsis only "nothing to show" when the log query succeeded.Not generalizable: the exact
fatal: not a git repositorystring match and theLC_ALL=Cpin are Git-specific; thelog_rc != 0 -> repo: truecarve-out exists only because an unborn repository exits 128 ongit log.Other
GET /api/project/treeandGET /api/file/diffkeep their own discovery handling (table above); both degrade to a rendered listing / "no baseline" rather than to a false empty history, so they are outside this issue's collapse.git_log_unavailableis additive to the 503 body contract.Closes #10892