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

The owner's inbox filters are saved and each change can be undone #15097

Merged opened this

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

Merged

The feed's filter is now saved per account. A bare /feed opens with it, and a visible Back to the previous filter button undoes the last choice. I didn't build an age filter, and I didn't add a keepplan entry or an estimate.

Notes

shipped production is serving it deploy be80413

opened this

The feed's filter is now saved per account. A bare /feed opens with it, and a visible Back to the previous filter button undoes the last choice. I didn't build an age filter, and I didn't add a keep_plan entry or an estimate.

What changed

  • Storage: a new feed_filter_step table (migration 20261121150000, pinned) keeps each account's choices as steps. The newest step is the current filter and the last 20 are kept. All the logic lives in src/feed/saved_filter.ts.
  • Boundary: show goes through parseShow and app through isAppName, both when saving and when reading back. Stored text that fails is treated as no filter. A saved app the viewer can no longer read is dropped.
  • Page: feedPage redirects a bare /feed to the saved set and saves a set named in the address (src/web/studio/filter_back.ts). It leaves ?before= and ?cursor= pages alone, and it doesn't save a request marked sec-fetch-site: cross-site.
  • Back: POST /feed/back goes through readForm("rw"), so it gets the same-origin check as the other form posts. The button only appears once there is a step to take back.
  • "No filter" is now a saved choice: the Clear and un-tap links, and the "Newest" link when no filter is on, now point to /feed?show=all, so clearing is a choice and not an absence. I updated the four existing tests that asserted the old bare /feed href.
  • Terminal: the feed screen opens with the saved set, saves each c/m/s/a choice, and b steps back. docs/features/feed-filters.md has a new section on this.
  • Test: test/feed-saved-filter.test.ts saves, reloads (the redirect) and reverts. It also checks that accounts are separate, that bad stored values are ignored, and that a cross-site request isn't saved.

Checks: bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean. I ran 780 tests (the feed, terminal-feed, schema, feature and migration suites) and all pass. I ran no bare bun test: fast.ts named 3,278 files for this diff, too many to run, so I picked the covering suites myself.

Not done

  • Age filter: none exists on the feed today, so there was nothing to save.
  • Kind and person chips: they were already saved per account (feed_chip), so I left them as they are.
  • Back on the chips: it doesn't step the chips back, only the app/show filter.
  • No look: the commit says No look: (a button and a redirect), so there are no before/after screenshots.

Try it: sign in, open /feed?show=mine, then open /feed. It returns to Mine. Tap Ships, then press Back to the previous filter to return to Mine.

[
 {"go":"/feed?show=mine","look":"Mine is outlined; a 'Back to the previous filter' button sits under the buttons","expect":"Reloading bare /feed redirects to /feed?show=mine"},
 {"go":"/feed?show=ships","look":"Press 'Back to the previous filter'","expect":"The feed returns to Mine"},
 {"go":"/feed?show=all","look":"No narrowing button is outlined","expect":"Bare /feed now shows the whole feed"}
]

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Closes #15071

4 earlier comments · 1 event
commented

The feed's filter is now saved per account. A bare /feed opens with it, and a visible Back to the previous filter button undoes the last choice. I didn't build an age filter, and I didn't add a keep_plan entry or an estimate.

What changed

  • Storage: a new feed_filter_step table (migration 20261121150000, pinned) keeps each account's choices as steps. The newest step is the current filter and the last 20 are kept. All the logic lives in src/feed/saved_filter.ts.
  • Boundary: show goes through parseShow and app through isAppName, both when saving and when reading back. Stored text that fails is treated as no filter. A saved app the viewer can no longer read is dropped.
  • Page: feedPage redirects a bare /feed to the saved set and saves a set named in the address (src/web/studio/filter_back.ts). It leaves ?before= and ?cursor= pages alone, and it doesn't save a request marked sec-fetch-site: cross-site.
  • Back: POST /feed/back goes through readForm("rw"), so it gets the same-origin check as the other form posts. The button only appears once there is a step to take back.
  • "No filter" is now a saved choice: the Clear and un-tap links, and the "Newest" link when no filter is on, now point to /feed?show=all, so clearing is a choice and not an absence. I updated the four existing tests that asserted the old bare /feed href.
  • Terminal: the feed screen opens with the saved set, saves each c/m/s/a choice, and b steps back. docs/features/feed-filters.md has a new section on this.
  • Test: test/feed-saved-filter.test.ts saves, reloads (the redirect) and reverts. It also checks that accounts are separate, that bad stored values are ignored, and that a cross-site request isn't saved.

Checks: bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean. I ran 780 tests (the feed, terminal-feed, schema, feature and migration suites) and all pass. I ran no bare bun test: fast.ts named 3,278 files for this diff, too many to run, so I picked the covering suites myself.

Not done

  • Age filter: none exists on the feed today, so there was nothing to save.
  • Kind and person chips: they were already saved per account (feed_chip), so I left them as they are.
  • Back on the chips: it doesn't step the chips back, only the app/show filter.
  • No look: the commit says No look: (a button and a redirect), so there are no before/after screenshots.

Try it: sign in, open /feed?show=mine, then open /feed. It returns to Mine. Tap Ships, then press Back to the previous filter to return to Mine.

[
 {"go":"/feed?show=mine","look":"Mine is outlined; a 'Back to the previous filter' button sits under the buttons","expect":"Reloading bare /feed redirects to /feed?show=mine"},
 {"go":"/feed?show=ships","look":"Press 'Back to the previous filter'","expect":"The feed returns to Mine"},
 {"go":"/feed?show=all","look":"No narrowing button is outlined","expect":"Bare /feed now shows the whole feed"}
]

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

commented

<!-- look-pages 8099be6a327b --> Look pages for 8099be6, from the gate:

  • look pages (inferred): this pull changes src/web/studio/feed.ts, src/web/studio/filter_back.ts, src/web/studio/home.ts; the forge pictures / (src/web/studio/feed.ts), /docs (src/web/studio/feed.ts), /explore (src/web/studio/feed.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The feed's saved filter is now remembered per account, and the last choice can be taken back. That is the code from the earlier commit. This push adds no code, only a commit that carries the Direction: line the gate asked for.

The failing check was the "pipeline first" rule. The pull adds a feature (src/feed/saved_filter.ts, src/web/studio/filter_back.ts) and changes nothing in the pipeline. The Direction: line says why it goes ahead of the pipeline items and names #15071. I also added a No look: line to the commit, since the gate had inferred 31 pages to picture from the files this pull changes.

The other gate messages were similarity notes, not failures, so I left them alone. I haven't re-run the check since the push, so I don't know yet whether it passes.

  • canStepBack resembles everReverted in src/checks/revert_red.ts.
  • filterBackSubmit resembles everydayKeep in src/web/pages/everyday.ts.
  • The mk helper in test/feed-saved-filter.test.ts is identical to the one in test/feed-filters.test.ts.

I ran no tests, tsc or scripts/gate.ts locally, because the push adds no code.

commented

No code change this time, so nothing new is pushed. That comment is the gate's list of pages it will picture for 8099be6, and I have nothing to correct in it.

The inferred list is accurate. The pull changes src/web/studio/feed.ts, filter_back.ts and home.ts, and those reach the feed on /, /docs, /explore and 25 other pages. I'm not overriding it with a Looks: line. Letting the gate picture all of them is the safer choice.

My last commit's No look: line was loose. It said the pages were unchanged by that commit, which is true because it was empty. The pull as a whole does change them, so it shouldn't be read as a claim that no look is needed. I can't rewrite it without a force push, which is refused here. The look pages should still come from the feature commit.

Review block for the page change:

[
  {"go": "/", "look": "the feed filter control while signed in as the owner", "expect": "the filter last chosen is applied on first paint, with no layout shift"},
  {"go": "/", "look": "choose a different filter, then use the back control", "expect": "the previous filter returns and is saved again", "ask": "does the back control disappear when there is nothing to step back to?"},
  {"go": "/explore", "look": "the feed as a signed-out visitor", "expect": "no saved filter applied and no back control"}
]
Changes requested — before the latest push

Three things to fix in one round. (1) A GET that writes: applySavedFilter saves on a plain /feed?show= or ?app= request, guarded only by the absence of sec-fetch-site: cross-site; move the save to a same-origin-checked POST, or require sec-fetch-site: same-origin/none explicitly. (2) The terminal door has no test: the saved filter on open, b stepping back, and saving on c/m/s/a are untested. (3) The bare-/feed redirect drops other query params, and 'another account' test proves nothing. Direction: this is a feature pull while the owner's pipeline-first list is open; it needs to be justified or held behind the pipeline items. The three boxes of #15071 are otherwise met.

commented

I've pushed all three fixes to the pull. The five feed test files I ran pass (27 tests) and bun x tsc --noEmit printed nothing. I never confirmed scripts/gate.ts --fix finished: I only looked at its tail, and the output was filtered. scripts/fast.ts named 3,278 test files, which is too broad to run here, so the full check on the forge has to cover the rest.

What changed

  • GET that writes: applySavedFilter (src/web/studio/filter_back.ts) now saves only when Sec-Fetch-Site is same-origin or none. A missing header, cross-site or same-site saves nothing, so the chips and a typed address still work. I kept the save on GET and did not move the chips to POST, to keep the page server-rendered and link-based.
  • Redirect: a bare /feed redirects to the saved set only when the query is empty. ?kind= or ?person= now get a 200 and no redirect.
  • Per-account test: it now saves a set as alice, then checks that alice's bare /feed gives 302 and bob's gives 200 with no back button, and that bob's saved set is still empty.
  • Terminal door: a new test covers the screen opening with the saved set, c, m, s and a each saving, and b stepping back through the steps. It also checks that b does nothing, and the binding is hidden, when there is nothing to step back to.

The earlier "Direction:" commit line stays in the history. I also repeated it in this commit and added Looks: /feed.

Left out: the duplicate-implementation notes from the gate (the mk test helper, canStepBack and filterBackSubmit) are still not merged into shared code.

Try it: sign in, open /feed?show=mine, then open /feed again and you land on /feed?show=mine. The "Back to the previous filter" button, or b in the terminal, returns to the one before.

[
  {"go": "/feed?show=mine", "look": "the narrowing chip and the back button", "expect": "'Only mine' is marked on and 'Back to the previous filter' shows"},
  {"go": "/feed", "look": "address after load", "expect": "redirects to /feed?show=mine"},
  {"go": "/feed?kind=issue", "look": "address after load", "expect": "stays put; no redirect"},
  {"go": "/feed", "look": "press the back button", "expect": "returns to the previous filter, or the plain feed if there was none"}
]
Approved

Earlier asks are met: a save from GET now needs Sec-Fetch-Site same-origin or none, a bare /feed redirects only with an empty query, the per-account test checks that bob is unaffected, and the terminal has a screen with b and a test. Stored values are re-validated on read, POST /feed/back goes through readForm("rw"), and the migration is pinned. The docs are in docs/features and README is untouched. Non-blocking: the duplicate-shape notes (mk helper, canStepBack) could be shared later. Non-blocking: saveFilter reads then inserts, so two concurrent saves could collide on the seq key; harmless here.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs