Repository navigation
feat(web): read-only queue and job views - #6
Merged
Merged
Conversation
Per varmq spec/openapi.yaml 1.0.0 (/queues, /queues/{id}/jobs).
- api: ListQueues, ListJobs. Queue ID path-escaped as one segment.
404/405 = no queue data (older varmq), not error.
- fleet: FetchQueues from every unit, GroupQueues by Queue ID. One
copy kept, never summed; read copy beats error copy. On = units
reporting it. FetchJobs falls back to next unit on 404/error.
- web: /queues list + /queues/{id} job page (state tabs, paging,
<details> per job: payload, times, attempts, last error). Read live
on GET, same guards as actions: current snapshot, this env's lease,
same source. No poller on job page.
- fleettest fake serves spec-shaped queue fixtures.
No CLI view: vartop has no worker list command to mirror.
varmq spec b9b5801 drops Job.last_error for errors[]{attempt, at,
error}, oldest first, last 10. Job page lists each failed attempt with
its time; summary keeps the final error.
Unit order is not fixed, so the jobs read may go to b, not a. Old assertion failed ~half the runs.
Conflict: render.go funcmap; keep queuesURL, jobsURL and domID. Follow P2 heading change (#7, h2 styles now on h1): - queue.html: queue ID h2 -> h1, keeps page-title style. - queues.html: hidden h1 "Queues", like dashboard/grid.
Drop local Job, JobError, QueueCounts, QueueTotals copies for contract.JobRecord, JobError, JobCounts, JobTotals, JobState. Keep QueueSummary: /queues wire entry (ID, error, optional counts), no contract type for it. Counts now int64.
As .workers since #7: rows stack at <= 640px, cells labelled via data-label, no sideways scroll. Queue ID breaks only when it cannot fit whole. Failed count red only when > 0.
Jobs answer has no total; a full page last in its state linked to an empty one. Hide Next when the count read with the page says it ends.
Instances on one host share an instance name; both got the first unit's label in "Reported by". Endpoint key is exact; instance match is the fallback for balanced units.
State tabs as count cards with state dots. Each job a card: ID, attempts pill, time, final error on one line. Open job: timeline, one block per failed attempt, payload beside them on wide screens. Pager as buttons.
One panel, two-line row per job: ID + short time, then final error (failed) or one-line payload + attempts. Header shows range and state count (1–50 of 10000). Full time in title and <time datetime>.
Timeline: inline SVG per step (enqueued, started, finished/failed), state colored; step not reached hollow. State tabs sticky on scroll; one compact row on phones.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Read-only queue and job views on varmq queue routes (goptics/varmq#173, merged):
GET /queues,GET /queues/{id}/jobs?state&offset&limit. Job types fromgithub.com/goptics/varmq/contractv0.1.0 (zero-dep module, nothing else from varmq). Merged with main (#7 a11y fixes).Request flow on page load:
contract.JobRecord,JobError,JobCounts(int64),JobTotals,JobState. Local onlyapi.QueueSummary:/queueswire entry (ID, error, optional counts/totals); contract has no type for it.1–50 of 10000); short times (clock today, day this year, else date) with full time intitleand<time datetime>; timeline steps as inline SVG icons (enqueued, started, finished or failed), hollow when not reached.errors[], oldest first, max 10): attempt no.,<time>, text. Job summary shows final error.h1(sr-only "Queues"; Queue ID on job page), queues table stacks at <= 640px withdata-label, state tabsaria-current,<time datetime>, payload<pre tabindex="0">.QueueInspector) named in a note. Worker views unchanged.Not covered
Evidence
internal/api/queues_test.go: Queue ID escaping ({,},/), 404/405 fallback, payload bytes kept as sent,errorsdecode.internal/fleet/queues_test.go: grouping does not sum, unsupported instances, error copies, jobs fallback to next instance.internal/web/queues_test.go: both pages against fake varmq, incl. Queue ID with/, errors list oldest first.go vet ./...,go test -race ./...pass./queues,/queues/{id}at 375px dark and 800px light, fake fleet.feat/job-records-inspector, 2 instances on one Redis queueorders/eu(Queue ID with/). List, failed tab,errors, paging checked; found + fixed: same-host instances (same instance name) both labelledinstance-1in "Reported by".detect-changesvs main: shared symbols touched areroutes(+2 routes),parseTemplates(+2 sets),Page(+2 nil-able fields); callers covered by tests.Merge Danger
Door: two-way
Additive: new routes, templates, nav link, one zero-dep module. Revert removes it cleanly.
Blast Radius: web
/queuestab sends one/queuesrequest per instance per poll interval.QueueInspector.Screenshots (before / after)
Fake fleet, 3 instances: instance-1 and instance-3 share two queues; instance-2 older varmq (no queue routes). Images on branch
pr-assets/queue-views.Dashboard nav, 375px, dark: new "Queues" link.
Dashboard nav, 800px, light
New pages, no before (main answers 404).
/queues: one row per Queue ID, counts not summed, "Reported by" instances; note names instance-2 (no queue routes). Phone: rows stack, cells labelled./queues/{id}, failed tab, job expanded: sticky state tabs with counts; list header with range; row with final error; open job: timeline with step icons, 3errorsentries oldest first, indented payload./queues/{id}, pending tab: jobs with no ID yet; one-line payload preview per row.