Skip to content

feat: add the console shell and typed data client - #141

Open
danjamk wants to merge 1 commit into
mainfrom
agent/129-serve-the-console-shell-and-a-typed-data
Open

danjamk wants to merge 1 commit into
mainfrom
agent/129-serve-the-console-shell-and-a-typed-data

Conversation

@danjamk

@danjamk danjamk commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Tier: 1, because it changes console/src/, console/test/, console/index.html and docs/decisions/** only. No path in .github/always-review.yaml.
Current step: Done, ready for review

Closes #129

  • Worker: GET /health returns the build id; anything that isn't /health or /api/* is a 404
  • console/index.html: loads tokens.css, components.css and app.js, with an empty #app root
  • console/src/api.ts: route contract types, fetch functions for api/waiting, api/runs, api/factory and the stop route, shape checks that throw a typed ApiError (network, status, json, shape with the field's path), JSON parsed whatever the Content-Type
  • URLs relative to the page; test/relative-urls.test.ts fails on any fetch, src or href starting with / in index.html or src/
  • Fixtures in console/test/fixtures/: working, healthy, paused-spend, paused-operator (snapshot feed), stopping, stopped. README.md there describes each
  • Tests: /health, each fixture parses whole, a missing field throws naming it, plus wrong types, bad times, non-JSON, wrong status and no answer

Run notes

  • Acceptance: make -C console check: passes, typecheck clean and 36 tests in 3 files. GET /health on the deployed console can only be checked after merge, since deploys run from CI.
  • Unclear in the issue: The issue says /health reads VERSION and that anything else is a 404. Add the console Worker on workers.dev, behind Access, with its deploy #105 already built the Worker with BUILD_ID, set by deploy.sh, and with /api/* forwarding. I kept both and made the remaining fallthrough a 404 (decision log). The issue also says index.html (tier 1 at console/index.html), while the Worker serves console/public/ (tier 2). I put the shell at console/index.html and left the placeholder in public/ as it is.
  • Assumptions: Each fixture is one file per state, holding the waiting, runs and factory answers, plus stop for the stop states. Where spec 0002 is silent I used the design's titles and made up the rest: per-run costs that sum to $41.20, an hourly series, PR numbers, docs: record deny rule test in cloud session #43 and docs: record deny rule test in cloud session #44 queued, and reference-build as the reference build's repo name. With these, W1-2's forecast comes out at $103 with a pause at 19:37 UTC, which is its acceptance. The client drops fields the contract doesn't define. A source the response leaves out stays absent; it isn't set to undefined.
  • Missing: No build step puts index.html, app.js or the design's CSS into the served directory. H-1 in the plan describes one (tsc to dist, then copy), but Add the console Worker on workers.dev, behind Access, with its deploy #105 shipped without it, and wrangler.jsonc serves ./public. Adding it touches console/package.json and either wrangler.jsonc or public/**, which are tier 2. Spec 0002 has no Example data for the healthy, paused or stop states, so I wrote those from the working state.
  • Friction: pnpm install failed because pnpm writes to ~/.local/share/pnpm, which the sandbox makes read-only. It worked with XDG_DATA_HOME and PNPM_HOME pointed at $TMPDIR. The console has no Node types, so the tests read fixtures and source files through Vite's import.meta.glob, declared in test/env.d.ts.
  • Follow-ups: A tier 2 issue for the operator: give the console a build that copies index.html, the compiled app.js and design/*.css into the served directory, replacing public/index.html, before W1-5 needs a real page. Also the plan's ADR-012 gap 1: make console/src/api.ts the contract's single typed source.

console/src/api.ts types the route contract's three read routes and
Stop, and checks every response's shape, throwing a typed ApiError
rather than returning partial data. It parses the body whatever the
Content-Type, since the snapshot feed is text/plain, and uses URLs
relative to the page (ADR-012).

console/index.html is the empty shell loading tokens.css,
components.css and app.js. The Worker answers 404 to anything that
isn't /health or /api/*. Fixtures for six states, starting from spec
0002's example data, are what the rest of the wave tests against.
@danjamk
danjamk marked this pull request as ready for review November 29, 2026 22:47
@danjamk danjamk mentioned this pull request Nov 29, 2026
@danjamk

danjamk commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Dispatcher run: completed

Issue #129
PR #141
Profile run:standard-medium (sonnet, medium)
Cost $0.86 of $5.00
Duration 6m 09s
Branch agent/129-serve-the-console-shell-and-a-typed-data

@danjamk danjamk added the needs-operator The dispatcher won't merge this; the operator reviews it label Nov 29, 2026
@danjamk

danjamk commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Dispatcher: Needs the operator

  • The issue has no fenced bash block under ## Acceptance; the agent can't fix that from the PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-operator The dispatcher won't merge this; the operator reviews it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serve the console shell and a typed data client

1 participant