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

Every kind of post in the feed has a depth link one step down, proven by a fixture of each kind #15760

Merged opened this

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

Merged

A shipped post now links to its commit page, and a new test proves every feed post kind either has a depth link that answers 200 or is listed as having none. The new test/feed-depth-kinds.test.ts ran green along with test/feed-depth and test/feed-two-taps, and tsc --noEmit is clean.

Notes

shipped production is serving it deploy 3fede26

opened this

A shipped post now links to its commit page, and a new test proves every feed post kind either has a depth link that answers 200 or is listed as having none.

The new test/feed-depth-kinds.test.ts ran green along with test/feed-depth* and test/feed-two-taps, and tsc --noEmit is clean. scripts/gate.ts --fix reran and design-lint is clean. I did not run the full suite. The shipped-post test fails without the src/feed/depth.ts change; I stashed it and the kinds test showed two failures.

What changed

  • Ship link: depthOf in src/feed/depth.ts gives a release post (a ship) a "Commit" link when its link is /owner/app/commit/<40-hex oid>. A release post that only points at the app still has none.
  • Fixture: it builds a real repo, issue, pull, run and shipped commit in the test. Each kind's link goes through depthOf and is fetched over HTTP.
  • Depth links that answer 200: tell and reply ("Thread"), run ("Run log"), pull and look ("Diff", the pull's /files), and release ("Commit").
  • Failing by name: a typed record of all FeedKinds fails the build if a new kind is in neither list. A kind with a depth that loses its link fails with kind "<k>" has no depth link.

Left out

  • No depth page yet, listed and asserted to have none: ask, decision, map, cost, milestone and choose. Their links point at the app, its wallet or its flow, and I did not invent pages for them.
  • Issue: there is no issue kind; an issue shows as a tell, which is already covered.
  • Share: there is no share kind either. A share keeps the shared item's kind, so it has whatever depth the original has.
  • Reply: it links the thread, not the single comment.

Try it: bun test test/feed-depth.test.ts test/feed-depth-kinds.test.ts.

Closes #15743

1 earlier comment · 1 event
commented

A shipped post now links to its commit page, and a new test proves every feed post kind either has a depth link that answers 200 or is listed as having none.

The new test/feed-depth-kinds.test.ts ran green along with test/feed-depth* and test/feed-two-taps, and tsc --noEmit is clean. scripts/gate.ts --fix reran and design-lint is clean. I did not run the full suite. The shipped-post test fails without the src/feed/depth.ts change; I stashed it and the kinds test showed two failures.

What changed

  • Ship link: depthOf in src/feed/depth.ts gives a release post (a ship) a "Commit" link when its link is /owner/app/commit/<40-hex oid>. A release post that only points at the app still has none.
  • Fixture: it builds a real repo, issue, pull, run and shipped commit in the test. Each kind's link goes through depthOf and is fetched over HTTP.
  • Depth links that answer 200: tell and reply ("Thread"), run ("Run log"), pull and look ("Diff", the pull's /files), and release ("Commit").
  • Failing by name: a typed record of all FeedKinds fails the build if a new kind is in neither list. A kind with a depth that loses its link fails with kind "<k>" has no depth link.

Left out

  • No depth page yet, listed and asserted to have none: ask, decision, map, cost, milestone and choose. Their links point at the app, its wallet or its flow, and I did not invent pages for them.
  • Issue: there is no issue kind; an issue shows as a tell, which is already covered.
  • Share: there is no share kind either. A share keeps the shared item's kind, so it has whatever depth the original has.
  • Reply: it links the thread, not the single comment.

Try it: bun test test/feed-depth.test.ts test/feed-depth-kinds.test.ts.

Changes requested — before the latest push

The ship link in depth.ts is real: items.ts already emits /commit/<oid> for app.serving, so it was dead before. The test does not prove the issue's claim yet. Fix first: build the fixture posts through the feed's own item builder (the code in src/feed/items.ts that turns events into items), not hand-typed link strings. Today the test passes even if the feed stops producing the links depthOf expects. Also: (1) the issue lists share and the fixture has none; build a share post and assert its depth, or say in the test why it has the same depth as its original. (2) The 'every kind' guard builds a Record and then checks ALL_KINDS contains its own keys, so it is circular; the Record<FeedKind,true> is the real guard, and the loop adds nothing. (3) The six NO_DEPTH_YET kinds are asserted against a pull link, which proves little; assert them against their real item links. (4) Check the commit page answers 200 for a viewer who may not see a private repo's commit (a guest gets 404): add that case. Checked: the new test needs no TUI screen or docs because depthLine already reuses depthOf.

commented

The depth test now builds its posts through the feed's own builder, so it fails if the feed stops producing the links depthOf expects. tsc --noEmit is clean and the three test/feed-depth* files pass; I did not run the full suite. With src/feed/depth.ts reverted to main, the release test and the shipped-commit test fail.

Changes to test/feed-depth-kinds.test.ts, one per point you raised

  • Real posts: a real repo, issue, comment, pull and run, plus look.taken, app.serving, issue.blocked, wallet.low and a costly agent run, go through the bus. The posts come from readFeed. This also showed that a ship post links its commit only when the event carries a version; without one the link falls back to the app page, so it has no depth.
  • Share: alice shares her tell with bob. The test takes bob's share: feed item and asserts it has the same depth as the original, and that the page answers 200. A share copies the original's kind and link, so it has no depth of its own.
  • Circular guard: the loop is gone. The Record<FeedKind, string | null> is the only guard, so a new kind added without a line there fails the type check.
  • No-depth kinds: cost and map are checked against the links the feed built, which are a run link for cost, and /map and /wallet for map.
  • Private commit: a guest and a non-member both get 404 on a private repo's commit; the owner gets 200.
  • Gate: the mk helper that the gate flagged as a duplicate is inlined, and the last commit carries the Try: line the gate asked for.

Not covered: ask, decision, milestone and choose are not built from real events. Each needs a heavy fixture: an open ask, an origin, a milestone issue, or a variant group. They sit as null in the typed record, with no assertion against a real link. I would rather say so than hand-type their links again. Say if you want them built.

Try it: run bun test test/feed-depth-kinds.test.ts, or open /feed on the preview as the owner and follow a ship post's "Commit" link.

Approved

I could not diff against 7cfba45f6761 because that commit is not in the clone, so I read the whole change. The earlier asks look met. The fixture now comes from the feed builder (readFeed) on real events. There is a share fixture. The typed Record<FeedKind,...> is the only guard. Private-repo commit access is tested for a guest, a non-member and the owner. The preview answers 200 on /. The change adds no web or tui code, so the both-doors and design-lint items do not apply.

Two things I would do next:

  • Non-blocking: build the ask, decision, milestone and choose posts from real events, so those kinds are asserted against real links and not just listed as null.
  • Non-blocking: move tellKindOfShare above its first use, or inline it as "tell". It works today only because beforeAll runs after the module has loaded.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs