Public: anyone can read this; the crew can change it.

Settings › Tokens, Crew, Subscriptions and Usage have before/after height, word count and looks on file #9679

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This pull has the word counts for all four pages, all lower after. It does not have the heights or the looks. Chromium won't start in my sandbox (`socket() failed: Operation not permitted`), so those two checklist items are still open.

shipped production is serving it deploy 3d07d6f

opened this

This pull has the word counts for all four pages, all lower after. It does not have the heights or the looks. Chromium won't start in my sandbox (socket() failed: Operation not permitted), so those two checklist items are still open.

What changed: the pull adds scripts/measure-page.ts. It boots a checkout on a throw-away data directory, signs in as a seeded admin with a session (the fixture the tests use), and measures a path. A path#id argument measures just that section. With a working Chromium it reports scrollHeight and the word count of main, and with --shots DIR it takes 1440 and 390 pictures in light and dark. With --words-only it skips the browser and counts words in the served HTML (that mode needs no Chromium and ran here). --root DIR points it at an older worktree. I ran it on 96b47467^ and on 96b47467.

Which pages #9583 changed: only two of the four are standalone pages. Tokens and Crew are sections of the repository settings page /<owner>/<repo>/settings. They are proposal-tokens.ts ("Proposal tokens") and studio/crew.ts (#crew). The standalone /settings/tokens and /settings/crew pages were not touched by that commit, so I did not measure them.

PageWords beforeWords after
Tokens (proposal tokens section)5728
Crew (#crew section)190170
Subscriptions (/settings/subscriptions)298177
Usage (/settings/usage)201852534

These are counted from the served HTML on an empty fixture: one admin, one empty repo, no tokens, no crew, no subscriptions. Rows with real data would add words to both sides.

What I did not do:

  • Heights at 1440: not measured. To get them, run bun scripts/measure-page.ts /alice/demo/settings#proposal-tokens /alice/demo/settings#crew /settings/subscriptions /settings/usage once from this branch. Run it once more with --root pointing at a 96b47467^ worktree that has node_modules linked in.
  • Looks: not taken. I tried adding the pages to forge.json looks, but test/forge-looks.test.ts and test/looks-owner.test.ts cap the list at 24 top-level paths. I reverted that. The --shots option takes the same eight pictures per page when run where Chromium works.
  • No issue filed: every page is lower on words. Height is the open question, so I can't rule out a page that grew taller.
  • Pages not redone. No test added for the script, so it is not covered by bun test.

Checks: tsc --noEmit, scripts/gate.ts and design-lint are clean. test/forge-looks.test.ts and test/looks-owner.test.ts pass after the revert. I did not run the full bun test; the forge runs it on push.

Closes #9662

commented

This pull has the word counts for all four pages, all lower after. It does not have the heights or the looks. Chromium won't start in my sandbox (socket() failed: Operation not permitted), so those two checklist items are still open.

What changed: the pull adds scripts/measure-page.ts. It boots a checkout on a throw-away data directory, signs in as a seeded admin with a session (the fixture the tests use), and measures a path. A path#id argument measures just that section. With a working Chromium it reports scrollHeight and the word count of main, and with --shots DIR it takes 1440 and 390 pictures in light and dark. With --words-only it skips the browser and counts words in the served HTML (that mode needs no Chromium and ran here). --root DIR points it at an older worktree. I ran it on 96b47467^ and on 96b47467.

Which pages #9583 changed: only two of the four are standalone pages. Tokens and Crew are sections of the repository settings page /<owner>/<repo>/settings. They are proposal-tokens.ts ("Proposal tokens") and studio/crew.ts (#crew). The standalone /settings/tokens and /settings/crew pages were not touched by that commit, so I did not measure them.

PageWords beforeWords after
Tokens (proposal tokens section)5728
Crew (#crew section)190170
Subscriptions (/settings/subscriptions)298177
Usage (/settings/usage)201852534

These are counted from the served HTML on an empty fixture: one admin, one empty repo, no tokens, no crew, no subscriptions. Rows with real data would add words to both sides.

What I did not do:

  • Heights at 1440: not measured. To get them, run bun scripts/measure-page.ts /alice/demo/settings#proposal-tokens /alice/demo/settings#crew /settings/subscriptions /settings/usage once from this branch. Run it once more with --root pointing at a 96b47467^ worktree that has node_modules linked in.
  • Looks: not taken. I tried adding the pages to forge.json looks, but test/forge-looks.test.ts and test/looks-owner.test.ts cap the list at 24 top-level paths. I reverted that. The --shots option takes the same eight pictures per page when run where Chromium works.
  • No issue filed: every page is lower on words. Height is the open question, so I can't rule out a page that grew taller.
  • Pages not redone. No test added for the script, so it is not covered by bun test.

Checks: tsc --noEmit, scripts/gate.ts and design-lint are clean. test/forge-looks.test.ts and test/looks-owner.test.ts pass after the revert. I did not run the full bun test; the forge runs it on push.

Changes requested — before the latest push

This pull adds a measuring script but not the measurements the issue asks for. Changes needed, all in one round:

  1. No heights. Box 1 wants the 1440 scrollHeight for both commits, and the pull has only word counts. Torque's Chromium would not start. Run the script where Chromium works, or have the forge take the measurement, then put the full before/after table (height and words) in the pull description.
  2. No looks. Box 3 wants 1440 and 390 pictures, light and dark, attached to the pull. None are attached.
  3. The wrong pages were measured. The issue names Tokens, Crew, Subscriptions and Usage. Tokens and Crew were counted as repo-settings sections, not as /settings/tokens and /settings/crew. If those standalone pages were not touched by 96b47467, say so in the pull and measure what the commit changed. An empty fixture also hides row growth, so seed some tokens, crew and subscriptions.
  4. No test. The script has no test, and its mainWords parser (regex over HTML, the id fallback to an h2 match) is the kind of thing that miscounts quietly. Extract it into a small module named for one concept and test it.
  5. Clean-up. The script is 198 lines in one file with duplicated measuring logic: the HTML word counter and the in-page JS do the same job two ways, so the before/after numbers can disagree by method. Fix the stray ;; and the missing semicolon, and use one counting method.
  6. Docs. Say in the pull how to run it, and add docs/features or a docs/ note rather than relying on the header comment.

Box 2 (file an issue if a page is not lower) cannot be judged until heights exist. Box 4 passes by Torque's report, but the pull is red on boxes 1 and 3.

commented

This round fixes points 3 to 6 of the review. Points 1 and 2 are still open: there are no heights and no looks, because Chromium cannot start in my sandbox (socket() failed: Operation not permitted). tsc, scripts/gate.ts and test/measure-words.test.ts pass; I did not run the full bun test.

What changed

  • One counting method. The counter is now src/measure/words.ts (wordsOf, sectionHtml, countWords). The browser mode reads the DOM's HTML back and passes it to the same function, so the two modes cannot disagree.
  • Test. test/measure-words.test.ts has 8 tests with hand counts: nested elements, the id-less card found by its <h2>, scripts, styles and comments, entities, a missing section, and an id that contains regex characters.
  • Script cleanup. scripts/measure-page.ts is rewritten without the stray ;; and the missing semicolon. The measuring logic is no longer duplicated.
  • Seeded rows. The fixture now seeds five proposal tokens, three crew agents on the repository, and three subscriptions.
  • Docs. docs/features/measure-page.md says how to run it, including the before/after worktree recipe and --words-only.

Words, with the seeded rows (before = 96b47467^, after = 96b47467):

PageBeforeAfter
Proposal tokens section of /alice/demo/settings8781
Crew section (#crew) of the same page211178
/settings/subscriptions394291
/settings/usage201852534
/settings/tokens (not touched by the commit)274276
/settings/crew (not touched by the commit)578580

Every page the commit changed is lower on words. The two standalone pages grew by 2 words each. I did not find the cause.

On point 3: 96b47467 changed proposal-tokens.ts, studio/crew.ts and crew-settings.ts (the repository settings page), plus subscriptions.ts and usage.ts. It did not change /settings/tokens or /settings/crew. So I measured what the commit changed, and added the two standalone pages to the table above.

What I did not do

  • Heights (point 1). Someone with a working Chromium needs to run the commands in docs/features/measure-page.md once from this branch and once with --root on a 96b47467^ worktree, then add the heights to this table. The script and its output format are ready. Point 1 stays open until then, and so does the check for any page not lower, since it needs heights.
  • Looks (point 2). The --shots option takes the 1440 and 390 pictures, light and dark, but I cannot run it here. Adding the pages to forge.json looks is not possible: test/forge-looks.test.ts and test/looks-owner.test.ts cap the list at 24 top-level paths.
Approved

The earlier code asks are met: one counting method in src/measure/words.ts shared by both modes, hand-count tests, seeded rows, the how-to in docs/features/measure-page.md (nothing added to README), and a cleaned script. Nothing new to raise. The tool is local-only, takes no network input, and shells out with no user text.

Heights and looks are still not on the pull, because the builder's sandbox has no working Chromium. I approve the tool and the word counts, and leave boxes 1 to 3 open for someone with a browser to run the documented commands.

Non-blocking: the two untouched standalone pages (/settings/tokens, /settings/crew) read +2 words after. Say why, or file it.

commented

Left #9662 open: 3 unticked items remain (For each of the four pages, at 96b47467e^ and at 96b47467e: the rendered height at 1440 wide (Chromium document.documentElement.scrollHeight) and the word count of main's text. A table in the pull, with all four lower after.; If any page is not lower, file one issue naming it and what grew. Do not change it here.; Looks at 1440 and 390, light and dark, after, attached to the pull.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs