Repository navigation
/usage page, slice 2: the page itself (index.html, CSS, box script); /usage answers 404 until it lands - #79
Conversation
public/usage/index.html, usage.css and page.js render buildMonth's month: a row per Halifax day, newest first, a column per seat, All seats and the month row, shaded on 8 classes, with a box of exact values on hover, focus or tap. Previous and next month, "so far" for today, the as-of time from Usage-Newest-Hour, a dash for no data, and a plain message on 403, 503 or an expired login. Fonts and tokens come from /style.css; the dark theme is the wall's colours. Tests: page.js against a stand-in document (rows, box text, Esc and tap elsewhere, error states, CSP rules) and worker tests for /usage, /usage/, /usage/index.html, page.js and usage.css with and without a token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) Tab onto a number off-screen scrolls it into view after focusin, and the scroll handler closed every box that wasn't pinned. It now moves the focused number's box too and drops only a hovered one; Esc still closes it for good. In Chromium (pinned Playwright, a full October) the box had closed on 20 of 192 numbers at 1440x900 and 63 of 192 at 375x812; now 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewer: found 1 blocker(s); 0 still open. Fixes pushed in 1 commit(s).
Automated: @orion-setkernel's agent on |
|
Test-diff guard: this PR changes existing test files, and the issue it closes has no
Claude Lead: if these test changes are right, add the line to the issue with the reason, then re-run the Automated: @orion-setkernel's agent on |
rigel-setkernel
left a comment
There was a problem hiding this comment.
Reviewed the full diff against main and ran LIVE_REPO_CHECK=1 npm run validate on the PR head: check, npm test, npm run test:worker (47 passed) and wrangler deploy --dry-run all pass. I did not run a browser or the visual-diff check; I did not sign in to production either.
Good
- Matches #78:
index.html,usage.cssandpage.jsonly, with no Worker, routing or Access changes. The page and its assets stay under/usage/*, which isrun_worker_first, so they are 403 without a USAGE token. The new worker tests pin that, including for the ingest token. - CSP-clean: no inline style or script, the box is positioned through the CSSOM, and the bar width is an SVG attribute. Everything from data goes through
textContent, and a test greps forinnerHTMLand similar calls. - The failure paths are handled sensibly.
redirect: "manual"turns an expired Access login into status 0, which gets a plain message. 403, 503, a failed fetch and an empty month are covered by tests. The?month=value is regex-validated and clamped to the current Halifax month. - Fonts come only from
/style.css, and the dark tokens are checked equal to the wall's, which already has a contrast test. The screenshots are committed underdocs/design/usage/. The PR is upfront that the visual-diff check doesn't cover this page. - The scroll and focus handling, and its tests, look correct. A pinned or focused box follows its cell, and a hovered one closes. Esc stays closed.
- The edit to the reference copy removes a hostname from a public repo. That is the right call.
Nits, not blocking
public/usage/usage.css:~20:.sum { display: flex }overrides the UA[hidden]rule, and/style.csshas no[hidden]{display:none}. In the 403, 503, no-answer and 500 states the empty<ul id="sum" hidden>therefore still takes its 24px bottom margin. Add.sum[hidden]{display:none}or a global[hidden]rule. The stand-in-document test can't see this.thead th { position: sticky; top: 0 }has no effect, because.scrollis the nearest scroll container and it only scrolls sideways. Drop it or move the scroll.- A 31-row by 6-column table with every number as
tabindex=0is about 190 tab stops. That is fine for one reader, but a roving tabindex would be kinder later. /usageversus/usage/in production (a possible 307) needs a signed-in check after deploy. The PR already flags this as not confirmed.
No secrets, no new dependencies, no workflow or policy changes. The branch name and signature follow the agent convention.
Automated: @rigel-setkernel's agent on rigel-dev.
|
Approvals that count toward the two a merge needs: 1 (rigel-setkernel) on head Automated: @rigel-setkernel's agent on |
vega-setkernel
left a comment
There was a problem hiding this comment.
Approve, apart from minor nits. Note the repo's R2 gate needs a visual diff, and the PR's own body says the visual-diff check doesn't draw this page (see 'For Raghav').
What I checked
- Read the full diff against
mainand the issue #78 acceptance criteria.page.jsis built only withtextContent, there is no inline style or script, andusage.cssleaves fonts and sizes to/style.css. I found no third-party host and no new dependency. The only change outsidepublic/usage/, tests and docs is one README line and one AGENTS.md line. npm run checkpasses.LIVE_REPO_CHECK=1 npm testgives 234 tests: 233 pass, 0 fail, 1 skipped (SETKERNEL_REPO_TOKENunset).npm run test:workergives 47 passed. Both match the PR body. I did not runwrangler deploy --dry-run.- I served
public/with its real_headersCSP and a mocked/usage/data(fixture through the realsumByDay), and loaded the page in Chromium 1.64.1 at 1440x900 light and 375x812 dark. Both runs had no console or CSP errors. At 375 pxdocumentElement.scrollWidthis 375 while the table's scroller is 554 against a 343 client width, so only the table scrolls sideways. I tabbed through all 18 numbers of the November fixture; the box was open on every one. That fixture has only 2 days, so it did not exercise the scroll-on-Tab case, which I did not re-test (the author's 192-number run covers it). A 403 shows the plain message with no CSP errors beyond the browser's own resource-error line. - CSS class names (
.tip,.bar,.h,.on,.off,.sum,.months,.tag,.m,.sand so on) don't collide with anything instyle.css. - The Worker tests cover all three required paths (
/usage,/usage/,/usage/index.html): 403 with no token, a bad token or the ingest token, and 200 plus the CSP header for a usage token. The script and CSS are served too. The change to the existing worker test is a widening of its path list only, so I see no reason for anallow-test-changesline. - The node page test is solid: it runs the real
page.jsagainst a stand-in document and asserts the box text, its position, Esc, tap-to-pin, scroll behaviour, the failure messages and the dark tokens against the wall's.
Nits (not blocking)
public/usage/usage.css:.sum { display: flex }overrides thehiddenattribute, andstyle.csshas no[hidden]rule. On a 403, 503 or failed fetch the<ul id="sum" hidden>still reportsdisplay: flex(I measured it). It is empty, so the cost is only its 24 px bottom margin as dead space. Fix: add.sum[hidden] { display: none; }.public/usage/page.js(listen): if a number is pinned and the user then Tabs to another number,focusinshows the focused number's box but the next scroll flips it back to the pinned one (pinned ?? focused). It is a corner case that Esc clears.- The PR's note says
scripts/visual-diff.mjsskipspublic/usage/and it can't draw this page, so issue #78's 'screenshots from the visual-diff check' criterion is not met as written. The author disclosed this and attached local Playwright shots at the check's pinned version. Whether to extend the check is Raghav's call, as the PR says. - The README and AGENTS.md lines are accurate. AGENTS.md's layout and
npm testblurb is not updated with the new test file, but it is close enough.
For Raghav, not a code change: this is R2 and the quorum needs a visual diff. The attached shots stand in for it. The bare /usage (no slash) behaviour in production still needs a signed-in check after deploy, as the PR says. I did not check that.
Nothing was modified, committed or pushed.
Automated: @vega-setkernel's agent on vega-dev.
|
Approvals that count toward the two a merge needs: 2 (rigel-setkernel vega-setkernel) on head Automated: @vega-setkernel's agent on |
Summary
Slice 2 of the /usage page.
live.setkernel.com/usageanswers 404 today becausepublic/usage/has noindex.html. This PR adds the page: option B from setkernel-live#71, drawn fromGET /usage/data?month=YYYY-MMthroughbuildMonth(public/usage/table.js). The Worker routing and the Access check aren't changed.What changed
public/usage/index.html: the page skeleton. It has no inline style or script. It links/style.css(the site's self-hosted fonts and tokens, masthead and lead),/usage/usage.cssand the module/usage/page.js, and carriesnoindex.public/usage/usage.css: the reference's table, summary and box CSS, plus:td.t1…td.t8), laid over the row's ground with a--tintbackground image, so today's row keeps its shading.prefers-color-scheme: dark. It uses the wall's colours, whichtest/page.test.mjsalready checks for contrast.public/usage/page.js:?month=. The next link is greyed out past the current Halifax month.Usage-Newest-Hour. Without the header the page says "Nothing stored yet".widthattribute holds its length, so no style attribute is needed.tip(td.dataset). It opens on hover, focus or tap. Esc or a tap elsewhere closes it. Its position is set through the CSSOM, asapp.jsalready does for the wall.focusin, so without this the box closed as soon as it opened.redirect: "manual") each show a plain message. An empty month says so.textContent.test/usage-page.test.mjsruns the realpage.jsin node against a stand-in document built fromindex.html's ids, withfetchanswering the existing fixture month. It checks:/style.css, and dark tokens that equal the wall's.test/worker/usage-page.test.js:/usage/index.html,/usage/page.jsand/usage/usage.cssanswer 403 with no token, a bad token or the ingest token./usage/,/usageand/usage/index.htmlanswer 200 with the page and the CSP header for a usage token, and the script and CSS are served too.public/usage/) each gain a line.Screenshots
These are local shots on a sample October with made-up numbers, light and dark at 1440 px and a tap at 375 px. They don't come from the visual-diff check:
scripts/visual-diff.mjsskipspublic/usage/(NOT_UI) and draws only?demo. The page also needs an Access token and/usage/data, which the check can't provide. I took the shots with Playwright 1.64.1 (the version the check pins), servingpublic/with_headersand answering/usage/datafrom a fixture. The script wasn't committed, to stay under the issue's 400-line limit.At 375 px, in the same harness,
document.documentElement.scrollWidthis 375 while the table's scroller is 439, so only the table scrolls sideways. The empty month, the 403 and the redirect each showed their message with no console or CSP errors.How it was tested
npm ci, thenLIVE_REPO_CHECK=1 npm run validate:npm test: tests 234, pass 233, skipped 1 (SETKERNEL_REPO_TOKENis unset, as in CI);npm run test:worker: 47 passed;wrangler deploy --dry-run: pass.mainis 396 changed lines.Not run, or not confirmed
/usageURL in production. In workerd's test assets,/usageand/usage/index.htmlanswer 200 with the page. Cloudflare's default trailing-slash handling may answer 307 to/usage/instead. Either reaches the page, and its links (?month=,/usage/...) work from both URLs. That needs a signed-in check after deploy, which only Raghav's Access login can do.For the reviewer
Refs #71
🤖 Generated with Claude Code
Checks (setkernel:verify, read by the worker)
Closes #78
Automated: @orion-setkernel's agent on
orion-dev.