Skip to content

feat(galaxy): range selector — 1 month, 3 months, all time (gitmoot/gitmoot#2655) - #144

Merged
jerryfane merged 3 commits into
mainfrom
intern/2655-galaxy-range
Nov 15, 2026
Merged

jerryfane merged 3 commits into
mainfrom
intern/2655-galaxy-range

Conversation

@jerryfane

Copy link
Copy Markdown
Collaborator

Module half of gitmoot/gitmoot#2655: a Galaxy range selector with 1 month, 3 months and all time. Assignment: owner request via gitmoot (msg 484511), seat gitmoot-intern.

API

  • GET /api/graph?range=30d|90d|all. Missing, unknown or wrong-case values mean 30d, so clients that never send ?range= are unchanged.
  • DataSource.Graph(ctx, repo, rng GraphRange). Handlers always pass a canonical value from CanonicalGraphRange. FakeDataSource takes the range and returns its single-run graph for every range.
  • Graph.Truncated *GraphTruncation {shown,total} is optional and omitted when unset. The gitmoot server sets it when a wide range holds more runs than the UI can draw (see the server PR). It is never set for the default.

Web (web/dist/index.html)

  • Selector: a "range" select (1 month / 3 months / All time) under the repository select, in the same chip and style.
  • URL: /galaxy?range=90d|all, written with replaceState like the Runs page's ?reviewer= facet. Reload, deep links and Back/Forward (popstate) keep the range. The default stays /galaxy.
  • Loading:
    • A user-initiated load of a different repo or range shows the loading veil: "summoning three months…" or "summoning all of history…". Polls never show it.
    • A late response for a superseded selection is dropped, so a slow all-time load cannot overwrite a newer one-month view.
  • Repo list: it refills when the range changes, since a wider range has more repos, and keeps the current selection.
  • Note: under the selector, "updated every few minutes" for 3 months and all time; when the server truncated, "newest N of M runs · pick a repository for its full history".

Tests

  • New TestGraphRangeReachesDataSourceCanonical: the handler passes 30d, 90d and all through, and maps missing, empty, unknown, wrong-case and a duplicated range to the canonical value. The repo filter still reaches Graph alongside it.
  • go build, go vet and go test ./... pass; the page script parses (node --check on the inline script).
  • Browser checks against a live-DB copy are in the server PR.

gitmoot-intern added 2 commits November 15, 2026 06:56
…itmoot#2655)

GET /api/graph?range=30d|90d|all; missing or unknown means 30d, so the
default request is unchanged. DataSource.Graph takes a canonical GraphRange
(CanonicalGraphRange). Graph gains an optional Truncated {shown,total} for a
wide range the server capped.

Web: a range select under the repo filter, same style; ?range= in the URL
(replaceState, like the Runs ?reviewer= facet) so reload keeps it; the
loading veil shows for a user-initiated load of a different range; a late
response for a superseded selection is dropped; the repo list refills per
range and keeps the current selection; a note says 'updated every few
minutes' or 'newest N of M runs' when truncated.
@jerryfane

Copy link
Copy Markdown
Collaborator Author

Reviewer: gm-review-grok
Runtime: omp
Job: local-review-review-router-18e82346c71a7094-1

Decision: changes_requested
Summary: Reviewed the complete diff from cf68cc4 to exact head 8f8559c. Build, vet, and all Go tests passed. Actual-browser checks confirmed default behavior, range/repository filtering, reload persistence, Back/Forward restoration, truncation notes, and rejection of responses for a different current range. However, revisiting a previous selection makes its superseded requests eligible again: an older response overwrote newer data, and an older failure displayed an error after a successful replacement. Also found a nonblocking query-parser design issue affecting valid encoded URLs. The frozen prior-verdict file contains no verdicts or findings for PR #144.
Severity: P2

Findings

  • Distinguish superseded requests when a selection is revisited (P2)
    • body: The response guard compares only repo|range, so it cannot distinguish an old request from a replacement after A → B → A. In the browser, I delayed an all-time request, switched away and back, completed the newer all-time request with total=400, then completed the superseded request with total=300; the displayed note regressed to 300. A separate 90d → all → 90d scenario showed that rejecting the original 90d request displays 'could not load /api/graph' after the replacement already succeeded. The catch guard at line 1979 has the same defect. Track request/selection identity independently of parameter equality and guard success, failure, and delayed loading cleanup against superseded work.
    • evidence: web/dist/index.html:1950-1960,1976-1981; executed browser scenarios 'Reproducing superseded same-selection response race' and 'Reproducing obsolete request failure after successful replacement', using deferred graph fetch promises while operating the actual range select.
    • file: web/dist/index.html
    • line: 1960
  • Use decoded query parameters instead of another hand-written parser (P3)
    • body: The new parser copies the split-and-scan query handling but compares raw encoded values. Consequently, loading the valid URL /galaxy?range=%61ll selects 30d and rewrites the URL to /galaxy, whereas the API's r.URL.Query().Get("range") decodes that value to all. This breaks the stated agreement between URL and request canonicalization. The simpler shape is URLSearchParams.get('range') followed by the allowed-value check, rather than maintaining another raw query parser.
    • evidence: web/dist/index.html:1921-1932; api.go:717-718; executed browser navigation to /galaxy?range=%61ll observed URL /galaxy and selected range 30d.
    • file: web/dist/index.html
    • line: 1925

Tests Run

  • export PATH=/usr/local/go/bin:$PATH; go build ./... && go vet ./... && go test ./... -> success using Go 1.26.4; dashboard package tests passed, including graph_range_test.go and existing graph/workflow coverage.
  • go run ./cmd/gitmoot-dashboard-dev -addr 127.0.0.1:8099 -> successfully served the embedded production UI and API; stopped after review.
  • node heredoc using fetch and node:assert/strict -> passed graph API comparisons across missing, 30d, 90d, all, ALL, and 365d ranges for unfiltered, matching-repository, and absent-repository requests; passed SPA responses for /galaxy and both wide-range URLs. Initial order-sensitive comparison exposed existing map-order variation; comparison normalized by node ID passed.
  • Browser tab.select('#g-rangeFilter', ...), tab.select('#g-repoFilter', 'acme/webapp'), tab.reload(), tab.back(), and tab.forward() -> passed range/repository requests, replaceState persistence, reload, and cross-range Back/Forward restoration.
  • Browser deferred-fetch scenario with actual range controls -> passed rejection of a late 90d response while all was selected; confirmed user-change loading text and truncation notes.
  • Browser deferred-fetch A → B → A scenarios -> reproduced stale data replacing a successful newer response and an obsolete request failure displaying an error after replacement success.
  • Browser range-change fixture with a repository absent from the new range and a long repository name -> retained the selected repository; filter chip measured 284px and select measured 258px.
  • Browser navigation to /galaxy?range=%61ll -> reproduced incorrect canonicalization to /galaxy with 30d selected.
  • Browser navigation smoke across dashboard views -> exercised all navigation destinations; explicitly awaited mounted Overview, Charts, and Galaxy surfaces. No JavaScript exceptions observed; recorded request cancellations were SSE connections closed during navigation.

Raw runtime output was retained in local Gitmoot state and is not posted here.

…range= (gitmoot/gitmoot#2655 review)

Each fetch takes a sequence number; success, failure and the loading-veil
cleanup act only for the newest, so A → B → A can no longer let the first A's
late response overwrite the second, nor a superseded failure show an error
after its replacement succeeded. A poll is skipped while a request is in
flight. ?range= is read with URLSearchParams, so encoded values such as
range=%61ll agree with the server's decoded query.
@jerryfane
jerryfane merged commit 8210b96 into main Nov 15, 2026
2 of 3 checks passed
@jerryfane
jerryfane deleted the intern/2655-galaxy-range branch November 15, 2026 06:38
@jerryfane

Copy link
Copy Markdown
Collaborator Author

Reviewer: gm-review-grok
Runtime: omp
Job: local-review-review-router-18e82410691f9c3b-1

Decision: approved
Summary: Reviewed only 8f8559c..4d62885 and necessary surrounding consumers. Both prior findings are resolved at the root. Request sequence identity guards superseded success, failure, and delayed veil cleanup. Poll suppression preserves the active load and releases after success or failure; subsequent polls refresh data and clear failure veils. Encoded range URLs now canonicalize correctly. No new correctness or actionable design findings. Local build, vet, tests, and focused WebKit scenarios passed. No repository files changed.

Findings

  • Resolved: distinguish superseded requests when a selection is revisited (P2)
    • continues_uid: feat(galaxy): range selector — 1 month, 3 months, all time (gitmoot/gitmoot#2655) #144-f1
    • detail: Checked at the exact requested head using deferred fetches and the actual range selector. The newer all-time result remained 400 after the superseded result returned 300. The replacement 90d result remained 77 after the obsolete request rejected, without exposing an error veil. Invoking obsolete delayed cleanup while another selection loaded did not hide its veil. Repeated poll callbacks skipped pending work, obsolete completions did not release the newest request's guard, and polling resumed after success and network rejection. Current HTTP 503 and JSON parsing failures also recovered through subsequent successful polls.
    • evidence_locator: web/dist/index.html:1946-1984; executed browser scenarios 'Executing superseded success and failure regressions' and 'Exercising poll suppression recovery and veil cleanup'; final rendered surface: /tmp/omp-sshots-15cec7dc13c9b25f.png
    • file: web/dist/index.html
    • line: 1948
    • state: answered
  • Resolved: decode range query parameters with URLSearchParams (P3)
    • continues_uid: feat(galaxy): range selector — 1 month, 3 months, all time (gitmoot/gitmoot#2655) #144-f2
    • detail: Checked at the exact requested head. Browser navigation to /galaxy?range=%61ll selected All time, canonicalized to /galaxy?range=all, and issued /api/graph?range=all. URLSearchParams replaces the raw split-and-scan parser.
    • evidence_locator: web/dist/index.html:1922-1925; executed browser.open({name:'pr144', app:'own', url:'http://127.0.0.1:18099/galaxy?range=%61ll'}), followed by selector inspection and network request inspection; initial rendered surface: /tmp/omp-sshots-15cec78c5609b215.png
    • file: web/dist/index.html
    • line: 1924
    • state: answered

Tests Run

  • export PATH=/usr/local/go/bin:$PATH; go version; go build ./... && go vet ./... && go test ./... -> PASS; Go 1.26.4 linux/amd64; package tests passed.
  • export PATH=/usr/local/go/bin:$PATH; go test -run 'TestGraph' -v ./... -> PASS; TestGraphRangeReachesDataSourceCanonical passed.
  • /usr/local/go/bin/go run ./cmd/gitmoot-dashboard-dev -addr 127.0.0.1:18099 -> local embedded dashboard served successfully; stopped after browser verification.
  • browser.open({name:'pr144', app:'own', url:'http://127.0.0.1:18099/galaxy?range=%61ll'}) -> PASS; canonical URL, selected range, and graph request all used all.
  • WebKit browser: tab.select('#g-rangeFilter', ...) with deferred graph fetches -> PASS; superseded success could not replace 400 with 300, and obsolete rejection could not replace the successful 77 result with an error.
  • WebKit browser: invoke captured production poll callbacks and delayed cleanup callbacks during deferred requests -> PASS; polls skipped pending work, obsolete cleanup preserved the active veil, and refresh resumed after success or rejection.
  • WebKit browser: resolve current requests with HTTP 503 and invalid JSON, then complete subsequent polls successfully -> PASS; errors displayed, recovery updated data, and the veil became hidden with display:none. Final screenshot: /tmp/omp-sshots-15cec7dc13c9b25f.png.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Reviewer: gm-review-grok
Runtime: omp
Job: local-review-review-router-18e8249b184c2444-1

Decision: approved
Summary: Independently reviewed the full six-file diff from base cf68cc4 to exact head 4d62885. No unresolved correctness or introduced design findings. Both prior PR #144 findings are resolved and independently exercised. Build, vet, race-enabled tests, live API probes, and actual-browser scenarios passed. Runtime API checks used this module's FakeDataSource; historical database filtering belongs to the separate server implementation. No repository files changed.

Findings

  • Resolved: distinguish superseded requests when a selection is revisited (P2)
    • continues_uid: feat(galaxy): range selector — 1 month, 3 months, all time (gitmoot/gitmoot#2655) #144-f1
    • detail: Request sequence identity now guards success, failure, and delayed loading cleanup. Independent browser execution confirmed that an older same-selection result could not overwrite the replacement, obsolete failures could not expose an error or release the active request guard, and obsolete cleanup could not hide the current loading veil. Poll suppression and recovery after HTTP, JSON, and network failures also passed.
    • evidence_locator: web/dist/index.html:1946-1984 at 4d62885; executed browser scenarios 'Testing revisited-selection response ordering', 'Testing failure boundaries and polling recovery', and 'Verifying loading cleanup and repository retention'.
    • file: web/dist/index.html
    • line: 1946
    • state: answered
  • Resolved: decode range query parameters with URLSearchParams (P3)
    • continues_uid: feat(galaxy): range selector — 1 month, 3 months, all time (gitmoot/gitmoot#2655) #144-f2
    • detail: The raw query parser is replaced by URLSearchParams. Independent navigation to /galaxy?range=%61ll selected All time, canonicalized the URL to /galaxy?range=all, and requested /api/graph?range=all.
    • evidence_locator: web/dist/index.html:1922-1925 at 4d62885; executed browser scenario 'Loading decoded Galaxy range' and subsequent selector/network inspection.
    • file: web/dist/index.html
    • line: 1922
    • state: answered

Tests Run

  • PATH=/usr/local/go/bin:$PATH go build ./... -> success.
  • PATH=/usr/local/go/bin:$PATH go vet ./... -> success.
  • PATH=/usr/local/go/bin:$PATH go test -race -count=1 -v ./... -> success, including TestGraphRangeReachesDataSourceCanonical, FakeDataSource Galaxy coverage, workflow graph contracts, and server routing tests.
  • node --input-type=commonjs with stdin extracting the production Component script from web/dist/index.html and compiling it with new vm.Script(script) -> success.
  • go run ./cmd/gitmoot-dashboard-dev -addr 127.0.0.1:18099, followed by python3 urllib.request/json assertions -> ten GET /api/graph probes passed for default, 30d, 90d, all, encoded all, wrong-case, unknown, duplicate range, matching repo, and absent repo; graph links remained valid and unset truncation was omitted.
  • WebKit browser tab.goto(), tab.select(), tab.reload(), tab.back(), and tab.forward() against the local dashboard -> encoded URL decoding, range selection, repository retention, reload persistence, history restoration, and default/unknown-range canonicalization passed.
  • WebKit browser deferred-fetch scenarios exercising production fetchGalaxy() through the actual range selector -> superseded success/failure rejection, in-flight poll suppression, active-request guard preservation, HTTP 503/JSON/network failure recovery, stale delayed cleanup protection, and truncation-note rendering passed.
  • WebKit tab.screenshot({selector:'#g-filterWrap',format:'png'}) -> captured rendered repository/range controls at /tmp/omp-sshots-15ceca13eae6ea95.png.

Raw runtime output was retained in local Gitmoot state and is not posted here.

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