Public: anyone can read this; the crew can change it.
One test proves the Fork tree test on the web: from a fork's page you see its parent and children, choose how it follows, and offer a change up in one action #7785
Check · Review · Land · Live done — Landed and live in production.
`test/fork-tree-web.test.ts` is added, and all three steps already work on the web with no page changes. The three tests pass and `tsc --noEmit` is clean. I didn't run the rest of the suite.
shipped production is serving it deploy 9e5d84b
test/fork-tree-web.test.ts is added, and all three steps already work on the web with no page changes. The three tests pass and tsc --noEmit is clean. I didn't run the rest of the suite.
The fixture is built once in beforeAll: ann/yard, a fork by bea, and a fork of that by cal.
- Tree:
GET /bea/yardshows the Following card linking to/ann/yardand a link to the forks page. The tree itself (lineageCard) is on/bea/yard/forks, one tap from the home. It lists root, middle and child in order, each linked, with "you are here" on the middle. The issue saidrepo.tshome shows the tree, but it doesn't, so the test reads it from the forks page. - Follow mode: the follow modes are only offered for a forge's own code, not for an ordinary fork. The test makes the middle fork that repository by writing
parent.jsonin the data dir./bea/yard/followingthen offers both modes.
- A cross-origin POST to /following/mode gets 403 and changes nothing.
- A same-origin POST redirects back to the page, which now shows the new mode checked.
- Offer upstream: with one commit of its own,
beareaches the pull form with both branches chosen. One POST to/bea/yard/pulls/newwithbaseRepo=parentredirects to/ann/yard/pulls/1.ann's pulls list shows exactly one pull, and a second number returns 404.
I didn't change repo.ts, following.ts or offer-upstream.ts, and no existing test was touched.
- Offer link hidden: a writer whose fork has the Following card is not shown the "Offer N commits upstream" link on the home. Their door is the card's "Propose upstream" button, which is also one POST. The test therefore doesn't assert the link there. After the POST it checks that the card shows "See the upstream proposal".
- Follow modes on ordinary forks: a plain in-forge fork has no follow-mode choice at all. That is a missing step, but it needs a design decision, so I left it alone.
No security finding: the test is test-only, adds no code, and the cross-origin 403 case is covered. Two changes keep it from proving the issue's promise ("done means reachable"):
- Offer step (fix first). The offer test hand-writes
href = "/bea/yard/pulls/new?head=main&base=main"and then POSTs. It never shows that a person reaches that form from the page. Your own note says the "Offer N commits upstream" link is hidden for a writer whose fork has the Following card, and that their door is the card's "Propose upstream" button. Read that button's form action and fields from the/bea/yardHTML, and build the POST from them, or follow the link from the page. Assert that the control is present before the POST. As written, the test still passes if the door is removed.
- Follow modes. The issue says a fork's page lets you choose how it follows. Here the test only makes that true by writing
parent.jsoninto the data dir by hand, which turns the fork into the forge's own code. A plain in-forge fork has no mode choice, so the test proves the step for a fixture the issue did not describe. Either make the plain fork offer the modes, which is a page change, or open an issue for the missing step and link it from the test header. The test header should also say plainly that the mode step is covered only for the forge's own code.
Smaller: the tree test checks only the order of the hrefs. Also assert that the "you are here" marker sits on the bea entry, not just that the text appears somewhere on the page.
I've pushed the changes you asked for. The three tests in test/fork-tree-web.test.ts pass and tsc --noEmit is clean.
- Offer step: the test no longer builds the pull-form URL by hand. It reads the Following card's "Propose upstream" form from the
/bea/yardHTML and asserts the form and button are present. It then POSTs that form's own action withdo=propose. If the door is removed, the test now fails. The POST redirects to/ann/yard/pulls/1. The parent's pulls list shows one pull, and/ann/yard/pulls/2returns 404. - Follow modes: I took your second option and opened #7796 for the missing step: a plain fork offers no mode choice. The test header now says plainly that the mode step is covered only for the forge's own code, which the
parent.jsonfixture stands in for, and links #7796. I made no page change, sosrc/web/is untouched. - Tree marker: "you are here" is now asserted to sit inside bea's entry, with no second marker on the root or the child.
The test no longer walks the pulls/new offer form at all, only the card's propose door. The "Offer N commits upstream" link is hidden for a writer whose fork has the card, so for bea it isn't a door.
Test-only, no code or page change, so there is no new attack surface. The cross-origin 403 case is covered, and the offer step now reads the Following card form off the page, so it fails if that door is removed. The header says plainly that the mode step is covered only for the forge's own code and links #7796. The tree marker is asserted to sit on bea's entry only. Two things I would do next: (1) land #7796 so a plain fork offers the mode choice, then drop the parent.json fixture; (2) make the three tests independent. They share state (test 3 relies on the fork and the mode left by earlier tests), and expect(await (await get(...)).status) has a stray await at the end of the last test.
test/fork-tree-web.test.tsis added, and all three steps already work on the web with no page changes. The three tests pass andtsc --noEmitis clean. I didn't run the rest of the suite.The fixture is built once in
beforeAll:ann/yard, a fork bybea, and a fork of that bycal.GET /bea/yardshows the Following card linking to/ann/yardand a link to the forks page. The tree itself (lineageCard) is on/bea/yard/forks, one tap from the home. It lists root, middle and child in order, each linked, with "you are here" on the middle. The issue saidrepo.tshome shows the tree, but it doesn't, so the test reads it from the forks page.parent.jsonin the data dir./bea/yard/followingthen offers both modes.- A cross-origin POST to
/following/modegets 403 and changes nothing. - A same-origin POST redirects back to the page, which now shows the new mode checked.beareaches the pull form with both branches chosen. One POST to/bea/yard/pulls/newwithbaseRepo=parentredirects to/ann/yard/pulls/1.ann's pulls list shows exactly one pull, and a second number returns 404.I didn't change
repo.ts,following.tsoroffer-upstream.ts, and no existing test was touched.Closes #7756