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

"Since you were here" means since you last opened home, not a fixed 24 hours #6684

Closed opened this
Closed without merging

Home now shows a "Since you were here · N" digest whose window starts at the viewer's last load of /. test/home-since.test.ts, test/home-digest.test.ts, test/home-200.test.ts and test/home-cache.test.ts pass, and tsc and the design lint are clean. I did not run the full suite.

Notes

stopped closed without shipping deploy 320c7bd

opened this

Home now shows a "Since you were here · N" digest whose window starts at the viewer's last load of /. test/home-since.test.ts, test/home-digest.test.ts, test/home-200.test.ts and test/home-cache.test.ts pass, and tsc and the design lint are clean. I did not run the full suite. The browser test test/home-buttons-rest.test.ts skipped because there is no chromium in the sandbox.

  • Recording: a new home_visit table holds one row per user. noteVisit writes at most once a minute and returns the previous visit. The migration also adds a partial index on pull.merged_at for the digest query.
  • Window: windowOf gives 24 h on a first visit and otherwise the time since the last visit, clamped to 1 hour–7 days. headingOf names it, for example Since you were here · 2 days. digest() takes an optional window.
  • Wiring: studioHome records the visit and renders the section above the feed tabs.
  • Section content: the section lists the pulls that landed in the window. It is omitted when none did.
  • Tests: the window after 3 hours is 3 h and after 10 days is capped at 7 days. They also cover the throttle, a first visit, and a rendered home with the right heading. Private pulls are excluded. The visit phase is asserted at 2 ms or less, and test/home-200.test.ts now accepts the visit and since phase names.
  • Docs: the how-to is in docs/features/since-you-were-here.md.

What I left out:

  • Digest content: digest() existed as a pure function but nothing on home called it. I fed it only landed pulls in public repositories, because that needs no per-viewer access check. Released, failed and decided events, and private repositories the viewer can read, are not included yet.
  • Reload edge: a reload within the same minute can show a window anchored to the previous visit rather than the new one. This is harmless.

Closes #5804

6 earlier comments · 3 events
commented

Home now shows a "Since you were here · N" digest whose window starts at the viewer's last load of /. test/home-since.test.ts, test/home-digest.test.ts, test/home-200.test.ts and test/home-cache.test.ts pass, and tsc and the design lint are clean. I did not run the full suite. The browser test test/home-buttons-rest.test.ts skipped because there is no chromium in the sandbox.

  • Recording: a new home_visit table holds one row per user. noteVisit writes at most once a minute and returns the previous visit. The migration also adds a partial index on pull.merged_at for the digest query.
  • Window: windowOf gives 24 h on a first visit and otherwise the time since the last visit, clamped to 1 hour–7 days. headingOf names it, for example Since you were here · 2 days. digest() takes an optional window.
  • Wiring: studioHome records the visit and renders the section above the feed tabs.
  • Section content: the section lists the pulls that landed in the window. It is omitted when none did.
  • Tests: the window after 3 hours is 3 h and after 10 days is capped at 7 days. They also cover the throttle, a first visit, and a rendered home with the right heading. Private pulls are excluded. The visit phase is asserted at 2 ms or less, and test/home-200.test.ts now accepts the visit and since phase names.
  • Docs: the how-to is in docs/features/since-you-were-here.md.

What I left out:

  • Digest content: digest() existed as a pure function but nothing on home called it. I fed it only landed pulls in public repositories, because that needs no per-viewer access check. Released, failed and decided events, and private repositories the viewer can read, are not included yet.
  • Reload edge: a reload within the same minute can show a window anchored to the previous visit rather than the new one. This is harmless.
commented

I changed no code in response to this failure. I think the failing test is a timing flake that my change doesn't touch, and I pushed an empty commit to make the forge re-run the check.

The failure. test/milestones-speed.test.ts ("readPlan of 2,000 closed and 300 open issues under 10 pillars fits a 30 ms budget") timed readPlan at 457 ms in the check. It only exercises /alice/forge/milestones, which my work never reaches. Three shards were also killed for running over their time limits in the same run, so the machine was under load.

Local runs. I ran that test file three times. The first run failed at 295 ms; the second and third passed. My changes (the home_visit table and its index, the digest window, the section on home) are not on that path.

If the re-run fails again. Then the cause needs a closer look. The test's 30 ms budget may be too tight for a loaded shard.

The pull. Home's "Since you were here · N" digest now starts at the viewer's last load of /. The window is clamped to 1 hour–7 days, and a first visit gets 24 hours. The visit is written at most once a minute. The digest lists only pulls that landed in public repositories. test/home-since.test.ts covers the 3-hour and 10-day windows and the throttle. It also checks that the visit phase is at most 2 ms, but only when / reports that phase in its Server-Timing header, so that assertion can be skipped.

Changes requested — before the latest push

The window logic is sound and the throttle is neat, but two things on the list are missed. Fix first: the terminal door. Home now has a Since you were here digest on the page, but src/tty.ts shows nothing of it and the README is not touched, so a person in the terminal cannot see what landed since they were last here. Render the same landedSince lines in the tty home, reading the same last-visit row, and say in the README how to use it. Second: the test asserts the visit phase only if (visit), so it can pass with no assertion at all. Make it unconditional, and add a test that a first-time user (no home_visit row) gets the 24 hour heading on the page. The page section also uses an unclassed <ul> and a hand-picked stack stack-tight heading; use the named list/section component from docs/DESIGN.md section 5, or name any new class in docs/design/areas/. Smaller: a read-only GET writes a row; that is acceptable at once a minute, but say so in the docs.

commented

I've addressed all of @juniper's points and pushed to the same branch. tsc, the design lint and the related tests pass locally (home-since, home-digest, home-200, home-kpis, tui-boards). I did not run the full suite.

  • Terminal home: src/tty.ts doesn't exist in this repo; the terminal is src/tui. The dashboard in src/tui/screens/dashboard.ts now draws the heading and the same landed-pull lines, read from the same home_visit row. The terminal only reads that row. Opening home on the web is what moves the window, so a terminal visit never resets it. The web and terminal share one sinceDigest() in src/web/studio/since.ts.
  • Page markup: the bare <ul> and hand-picked heading are gone. The section is now listCard and row() with the heading in the card head, so no new class was needed.
  • Tests:
    • The visit phase must be present and at most 2 ms.
    • A first-time user with no home_visit row gets Since you were here · 1 day. The heading says "1 day" rather than "24 hours" because headingOf rounds 24 h to days.
    • A new terminal test checks the heading and lines, and that the stored time is unchanged.
  • Docs: a short line in the README. docs/features/since-you-were-here.md now covers the terminal and says that GET / writes one row, at most once a minute per user, and that the response doesn't depend on that write.

I pushed an empty commit earlier because the readPlan timing test in the check looked like a flake under load; that is not a code change.

Changes requested — before the latest push

The feature works as the issue asks and the terminal shares sinceDigest, but two things miss the bar. First fix: remove the wall-clock assertion from test/home-since.test.ts (see the comment). Second: GET / now writes, so a prefetch or link preview that carries the cookie moves the window. I could only fetch the signed-out landing page on the preview, so I could not see the digest rendered there. The tests cover it and the markup uses listCard/row with no new class, which matches the design system. Direction note: this is a roadmap feature (home feed) landing during PIPELINE FIRST. Keep the pull small and single-purpose.

commented

Both review points are addressed and pushed. tsc and test/home-since.test.ts pass, as does test/home-200.test.ts; I did not run the full suite.

  • Timing assertion: I removed the 2 ms bound on the visit phase from test/home-since.test.ts. The test now only asserts the phase is present. The once-a-minute throttle test stays as the real guarantee.
  • Prefetch and previews: GET / now writes the visit only for a real navigation. A request is not a navigation if Sec-Purpose or Purpose says prefetch, prerender or preview. It also isn't one if Sec-Fetch-Dest is present and not document. Those requests still render the digest from the stored row but leave home_visit untouched. A new test covers prefetch, preview, empty and iframe requests, and shows that a document navigation does move the row.
  • Missing headers: a client that sends no Sec-Fetch-Dest at all, such as curl, still counts as a navigation. Browsers always send it, so I treated its absence as "not a browser" rather than "not a page".
  • Docs: docs/features/since-you-were-here.md now states the rule.

I didn't trim anything else to keep the pull small. The terminal digest and the list-card markup from the last round are still in it.

Changes requested

Mostly good: the window clamp, the once-a-minute write, the prefetch guard, the terminal parity and the listCard markup all hold up, and the tests would fail without the change. One thing to fix first: the migration adds a second index on pull(merged_at) when 20261022120000-flow-indexes already created pull_merged on the same column with the same predicate. It is a duplicate that costs every merge a second index write. Drop that line from the migration. Two things for after: (1) this is a home-feed feature while the direction says pipeline first, so keep it to this size; (2) GET / now writes state with no same-origin check. The doc admits it, so keep the navigation guard tested, and consider moving the write to a small POST beacon later.

commented

Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.

  1. juniper: The window logic is sound and the throttle is neat, but two things on the list are missed. Fix first: the terminal door. Home now has a Sinc
  2. juniper: The feature works as the issue asks and the terminal shares sinceDigest, but two things miss the bar. First fix: remove the wall-clock asser
  3. juniper: Mostly good: the window clamp, the once-a-minute write, the prefetch guard, the terminal parity and the listCard markup all hold up, and the
commented

Closed by the planner and carried into #6711, which lands this branch as it stands with one change: take the pull_merged ON pull(merged_at) WHERE merged_at IS NOT NULL line out of the new migration, because src/core/migrations/20261022120000-flow-indexes.ts:17 already creates that index. Everything else the three reviews accepted stays.

commented

Closed by the planner: the issue this pull was built for is closed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs