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

Every panel says what it counts: a one-line description, and visitors can leave out the app's own people #16960

Merged opened this in answer to

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

Merged

This pull covers the visitors panel on an app's settings page, plus the home visitors tile's wording. Boards and the other home tiles are untouched. I ran the new test, the existing measure and vitals tests, tsc and the design lint, and all are green.

Notes

opened this

This pull covers the visitors panel on an app's settings page, plus the home visitors tile's wording. Boards and the other home tiles are untouched. I ran the new test, the existing measure and vitals tests, tsc and the design lint, and all are green. I didn't run the full suite; the forge does that on push.

What changed

  • Signed-in readers. A beacon from someone who holds the app's grant cookie is now stored with member=1. A grant is only given to a signed-in person who may read the repository (src/apps/proxy.ts, src/apps/measure.ts). Their speed numbers still count, but appVitals leaves them out of Visitors today and 7 days by default.
  • Toggle. The panel has an "Include signed-in readers" link (?members=1) and a matching "Leave out" link (src/web/pages/settings.ts). It is a plain link, so there is no extra JavaScript.
  • Storage. A new migration, 20261201090000-app-vital-member, adds the member column. Older rows read as 0, so they count as visitors as before.
  • Descriptions. The panel now has a one-line description under its title, from VISITORS_COUNT. It reads "Distinct browsers a day (address + browser, salted daily, nothing stored). The 7-day figure adds up each day.", plus a sentence on leaving out signed-in readers. I reworded the home visitors tile (KPI_COUNTS.visitors) to match.
  • Test. test/app-vitals-members.test.ts covers the owner loading 5 times from 2 addresses: 0 by default, 2 with the toggle. It also checks that an anonymous visitor still counts.

What I left out

  • Hashing. The issue says a signed-in request is "not hashed as a visitor". I still store the salted hash, flagged, because the toggle needs it to count them. Nothing else about how visitors are hashed changed.
  • Descriptions elsewhere. Descriptions for the other app-vitals tiles, the boards and the small-screen (i) are not done. The other home KPIs already had one-sentence descriptions in KPI_COUNTS.
  • Terminal and how-to. There is no change under src/tui/ or docs/features/. The terminal visitors line reads the same data, so it now leaves members out by default with no toggle. That is why the commit says "No door".
  • Proxy test. I tested the counting in recordAppVital/appVitals. I did not add a test through the proxy that detects the grant cookie.

To try it

  1. Open /settings/app on a preview.
  2. Read the line under "Visitors and speed".
  3. Visit the app while signed in, then follow "Include signed-in readers" to see the count change.

The gate warns that "Looks: /settings/app" is not a page in forge.json's app.looks. It didn't block the push, and the reviewer decides.

[{"go":"/settings/app","look":"The Visitors and speed panel, under its title","expect":"One line saying what visitors counts, and an 'Include signed-in readers' link","ask":"Visit the app signed in, then open the link: does Visitors today go up?"}]

Closes #6613

Show 4 earlier items

7 earlier comments
commented

This fixes the check that kept failing on #16960: "every column that names a user is covered by its cascade or by a row of COVERED". account-purge.test.ts and app-vitals-members.test.ts now pass, and bun x tsc --noEmit and bun scripts/design-lint.ts are clean. I didn't run the dead-code or during-timing tests, and I didn't run the full suite, which the forge's check does on push.

What changed: the earlier commits on this branch added app_vital.member, a 0/1 mark that a visit came from a signed-in reader of the repository. The account purge's schema walk matches any column named member as one that names a user, so it flagged the new column. member doesn't hold a user id, so I added a COVERED row for it in src/core/account_purge.ts with do: "none" and the reason. The purge itself is unchanged.

What the branch already does: an app's visitors panel leaves out signed-in readers by default, with a toggle, and the panel says what it counts (the migration is 20261201090000-app-vital-member).

What I left out: I didn't rename the column to dodge the name match, since the COVERED row says plainly why it's exempt. scripts/gate.ts still notes four files with comment lines over 100 columns and says the nightly rewrap handles them. I didn't rewrap them.

To try it: run bun test test/account-purge.test.ts test/app-vitals-members.test.ts.

commented

I've pushed all three blockers and the smaller items to the branch. tsc, the design lint and the focused tests pass (the TUI deploys screens, the vitals and measure suites, unused-exports, the docs tests). I did not run the full suite; the forge runs it on the push.

  • Grant-cookie test: test/app-vitals-members-route.test.ts posts to /__forge/measure with six cookies. A valid grant naming someone is stored member=1; a forged, expired, tampered, anonymous or missing cookie is stored 0. I broke the proxy's marking on purpose and the test failed, so it does catch a proxy that never marks anyone.
  • Page toggle test: the same file checks that the settings page leaves readers out by default, counts them with ?members=1, and that the link flips. It also checks the terminal's visitors line for both settings.
  • Terminal door: the Deploys screen's visitors line now says (signed-in readers left out) or counted, and v flips it, listed in the key bar. GET /api/v1/repos/:owner/:name/app?members=1 does the same for the API. The how-to is docs/features/app-visitors-readers.md. I added the flag-not-unhashed note to docs/TOUR.md, where the visitor hashing is described.
  • Wording: the description is now one plain sentence, APP_VISITORS_COUNT in src/flow/kpi_words.ts, and VISITORS_COUNT is gone from vitals.ts. I restored the home KPI_COUNTS.visitors text to its original wording, since my earlier edit had put the jargon there too.
  • Link: it is now ?#visitors. Its text says it changes the visitor counts only: "Count signed-in readers in the visitor counts" and "Leave signed-in readers out of the visitor counts".
  • Commit lines: the commit carries a Direction: line naming #6613, as the check asked.

Left as is: scripts/gate.ts still flags long comment lines in files I touched. It says the nightly rewrap handles them, so I left them.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it (75b8d384a).

main had renumbered the migration imports again, so src/generated/migrations.ts conflicted. I took main's version and put my 20261201090000-app-vital-member.ts migration back as m441, after games (m440). The file now has 442 imports, one per migration file.

bun x tsc --noEmit reports no errors, and the two app-vitals members test files pass, 4 tests. I did not run the full suite; the forge's check runs it on the push.

The merge commit carries a No look: line, because the merge only renumbers a generated import and changes no page markup.

The pull otherwise stands as before: the Visitors panel says what it counts, signed-in readers are left out by default, and the toggle is on the page, the terminal (v) and the API (?members=1).

🤖 Generated with Claude Code

commented

Two of the three failing tests are fixed and pushed. The third was already red on main and passes on this branch, so I left it. tsc showed no errors. I didn't re-run the full suite, only the failing files and the size tests.

  • Cause: the visitors line in the terminal got longer. It now says "(signed-in readers left out)". The key-hint row on the deploys screen overflowed and was cut off, which hid m members. It also cut off the end of the visitors line, so the CLS value no longer showed.
  • Fix: I shortened the hints in src/tui/screens/deploys.ts. r now reads "refresh", and v reads "count readers in counts" or "leave readers out of counts". I updated the expectation in test/tui-deploys.test.ts to the new sentence, ending at the INP value. The screen still shows the CLS value only when the terminal is wide enough.
  • Test results: test/tui-deploys.test.ts and test/tui-appmembers.test.ts now pass (16 tests), as do the size tests (150).
  • Still red: "a cold home answers from the picture" is in test/observability-budget.test.ts. The check log shows it red on main too. I made no change for it.

The change is wording only, so the commit says No door.

commented

The duplicate m441 is fixed and pushed. I haven't seen the forge's check run on it yet.

  • Cause: main added a migration, 20261201120000-first-change-forge.ts, while this branch carried 20261201090000-app-vital-member.ts. Both ended up as m441 in src/generated/migrations.ts, so tsc rejected the duplicate identifier.
  • Fix: I merged origin/main and regenerated src/generated/migrations.ts with bun scripts/own-source.ts. The merge had left it in conflict. The numbering is now m441 for app-vital-member and m442 for first-change-forge.
  • Checks run locally: own-source --check passes, pin-migrations reports every migration already pinned, and bun x tsc --noEmit is clean. test/own-source.test.ts, test/schema-migrations.test.ts and test/tui-deploys.test.ts pass (36 tests). I didn't re-run the full suite.
  • Left alone:
    • The "11 one-off classes duplicate a part" drift warning comes from src/web/pages/ and src/web/studio/ files this pull doesn't touch.
    • The comment-width note says the nightly rewrap handles it.

The commit message says No door, since only a generated list changed.

commented

I merged main into this branch and pushed. The merge conflict was in src/generated/migrations.ts, and it is resolved.

Both sides had added a migration under the number m441. Rather than hand-edit the file, I regenerated it with bun scripts/own-source.ts. The order is now:

  • m441: app-vital-member, from this branch
  • m442: first-change-forge
  • m443: repo-check-slots, new from main

tsc --noEmit is clean and test/own-source.test.ts passes (3 tests). I did not run the rest of the test suite; the forge's check runs it on this push. scripts/gate.ts passes with only a note that 7 files have comment lines over 100 columns, none in code this branch touched. I left those for the nightly rewrap. src/web/pages/settings.ts also merged automatically, with no conflict.

commented

This pull already merges cleanly into main, so I pushed nothing new. The branch contains main at 099c6cc36, and the "Merge main; regenerate migrations list" commit (50198ab74) already resolved the src/generated/migrations.ts conflict. Running bun scripts/own-source.ts again changes nothing, so the generated list is current. The three failed checks probably ran against an older main. If main has moved again since, the next push needs another merge and regeneration.

What the pull does: it adds the app's own people as a member list for app vitals, so visitors can leave them out. This covers the migration 20261201090000-app-vital-member, the vitals, measure and proxy changes, the settings page, the API route and docs/features/app-visitors-readers.md. The panel descriptions come from src/flow/kpi_words.ts, and src/tui/screens/deploys.ts carries the terminal side.

Checks:

  • bun x tsc --noEmit is clean.
  • 24 tests pass across job-slices, unused-exports (the dead-code rule), own-source, route-timing-coverage, the two app-vitals-members suites and tui-deploys.
  • scripts/gate.ts --fix rewrapped nothing. It notes 7 files with comment lines over 100 columns, which the nightly rewrap handles on main.
  • I did not run the full suite. scripts/fast.ts named 3837 test files, an estimated 322 minutes, which is too broad for the sandbox. The forge's check runs everything.

Left out: no new behaviour in this round.

To try it: open an app's settings page and use the toggle that leaves its members out of the vitals counts. docs/features/app-visitors-readers.md describes it.

commented

Visitor counts on an app now leave out people signed in to read its repository, unless the viewer asks to include them. Each surface says which count it shows:

  • Settings page: the Visitors and speed panel has a one-line description of what it counts (APP_VISITORS_COUNT in src/flow/kpi_words.ts). A link under it switches the counts with ?members=1; the settings code reads that parameter once. Speed (TTFB, load, LCP, INP, CLS) always counts everyone.
  • Terminal: the Deploys screen's visitors line ends with (readers out) or (readers in), and v switches between them. v sits after m members in the key bar, so the members key still fits.
  • API: GET /api/v1/repos/:owner/:name/app?members=1 gives the same counts. A non-admin gets no vitals either way.

Changes in this round, from review:

  • Visitors line: the old wording, (signed-in readers left out), pushed CLS off the edge of the screen. With the shorter wording, test/tui-deploys.test.ts expects CLS again.
  • r hint: it is back to what main has, refresh (the open pulls below the deploys: check, preview).
  • New tests:
    • v on the Deploys screen switches the count (1 visitor, then 2) and the key label, in test/tui-deploys.test.ts.
    • The API leaves readers out by default, counts them with ?members=1, and gives a non-admin no vitals, in test/app-vitals-members-route.test.ts. That test fails with the ?members=1 handling removed.

To check: tsc --noEmit is clean, the gate passes all 32 rules (2 notes), and the 147 tests that use the Deploys screen, visitor counts and settings pages pass. scripts/fast.ts said the change reaches too many files to name, so I picked those tests by hand.

To try: open Settings → the app → Visitors and speed and click the link to switch the counts, or open the app's Deploys screen in the terminal and press v.

[{"go":"/<owner>/<repo>/settings/app#visitors","look":"Visitors and speed panel","expect":"a one-line description of what is counted, and a link 'Count signed-in readers in the visitor counts'"},{"go":"/<owner>/<repo>/settings/app?members=1#visitors","look":"Visitors today","expect":"the count includes signed-in readers; the link now reads 'Leave signed-in readers out of the visitor counts'"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs