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

A fork tree reader returns an app's ancestors, siblings and descendants as plain data, filtered by what the caller may read #10508

Closed opened this has it
opened this

Split from #10388 (parked twice: the whole thing in one pull stayed red). This is the data half only, no HTTP and no MCP.

Done:

  • [ ] A new src/actions/fork_tree.ts exports forkTree(db, repo, user, { depth?, limit? }) returning { root, nodes: [{ repo: "owner/name", parent: "owner/name" | null, depth, follow: "take-updates" | "offers" | "autonomous" }], truncated }: ancestors up to the root, then every descendant of the root breadth-first (so siblings come for free), built on visibleForks/forkParentFor in src/core/repos.ts and the follow mode src/core/following.ts already holds.
  • [x] Depth defaults to 4 and is capped at 8; nodes are capped at 200 with truncated: true past it; both caps are named constants with a comment.
  • [x] Private forks the caller cannot read are omitted before anything is counted, and their descendants are omitted with them; a test asserts a stranger and the owner get different node lists and the stranger's has no trace of the private one.
  • [x] No git is read (no drift here); a test builds a tree of 200 forks and asserts a warm call answers under 50 ms.
  • [x] test/fork-tree.test.ts covers a three-level tree (a forge, an organization's fork, a person's fork of that) read from the middle node.
  • [x] bun test test/fork-tree.test.ts and bun x tsc --noEmit pass.

Files: src/actions/fork_tree.ts, test/fork-tree.test.ts Risks: do not touch src/http/ or the existing forks tool in this issue; the old branch scout/10388-… went red touching many files at once. Suggested: scout.

commented

Parked by the crew: the check stayed red through 2 automatic tries (pull #10510 closed; its branch scout/10508-a-fork-tree-reader-returns-an-app-s-ance at 99b51b2b2dee keeps the work so far). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.

commented

Reviewed pull #10587 at its head: ticked Depth defaults to 4 and is capped at 8; nodes are capped at 200 with truncated: true past it; both caps are named constants with a comment.; Private forks the caller cannot read are omitted before anything is counted, and their descendants are omitted with them; a test asserts a stranger and the owner get different node lists and the stranger's has no trace of the private one.; No git is read (no drift here); a test builds a tree of 200 forks and asserts a warm call answers under 50 ms.; test/fork-tree.test.ts covers a three-level tree (a forge, an organization's fork, a person's fork of that) read from the middle node.; bun test test/fork-tree.test.ts and bun x tsc --noEmit pass..

commented

Left open after pull #10587 landed: 1 unticked item remains (A new src/actions/fork_tree.ts exports forkTree(db, repo, user, { depth?, limit? }) returning { root, nodes: [{ repo: "owner/name", parent: "owner/name" | null, depth, follow: "take-updates" | "offers" | "autonomous" }], truncated }: ancestors up to the root, then every descendant of the root breadth-first (so siblings come for free), built on visibleForks/forkParentFor in src/core/repos.ts and the follow mode src/core/following.ts already holds.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.

commented

The open box is on main: src/actions/fork_tree.ts exports forkTree. Closing.

commented

Already done on main in 259f1facd: the remaining box landed there (see my comment above).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs