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

A repository's crew page adds a member to a slot in place: no reload, and the scroll position stays #18474

opened this

Merged 3h 37m ago, live in production

Adding a member to a seat on a repository's crew card no longer reloads the page. The pull is pushed. I haven't driven it in a browser, so the client script and the no-layout-shift risk are untested.

Notes

opened this

Adding a member to a seat on a repository's crew card no longer reloads the page. The pull is pushed. I haven't driven it in a browser, so the client script and the no-layout-shift risk are untested. Server-side tests pass: the new test/crew-in-place.test.ts, the crew settings doors, pages-budget, open-routes-floor, dup-imports, module-state and unused-exports.

What changed

  • src/web/in_place.ts (new, about 1 KB gzipped, no framework) is the one small client module for forms that act in place, so the next issue's rule can reuse it. A <form data-in-place> posts with Accept: application/json and redraws only what the answer lists.
  • Each seat row carries data-fragment=<url>. The new GET /:owner/:name/settings/crew/seat/:role returns just that <li>, rendered by the same code as the card. It is admin-only, and a bad role or a non-admin gets 404.
  • The card's add, remove and slot-count forms use it. crewAdd, crewRemove and pillarUpdate answer through the existing flashOrJson, so the JSON carries the seats to redraw. An add that moves an agent between seats names both.
  • Focus is restored by id after the redraw, and scroll never moves because nothing navigates. A refusal is a 422 with its words, shown beside the form.
  • With scripts off, the same POST still redirects to #crew.
  • Same-origin is still enforced by readForm on every POST. The fragment is GET and read-only.

Reuse and refactors

  • I extracted seatRows from teamCard so the card and the fragment share one renderer. It returns the facts it read, so the settings page stays inside its SQL budget.
  • teamJs now just exports inPlaceJs. It uses a delegated change handler, so a redrawn seat still auto-submits.
  • I ran bun scripts/similar.ts. The nearest existing mechanism was act_now.ts, which doesn't redraw server HTML, so I wrote the new module instead of extending it.

Test and registry fixes

  • The route has to be registered in lazy_lists.ts, so I regenerated it.
  • open-routes-floor needed a role fill for the new route.
  • pages-budget lists the fragment under NOT_PAGES. Those two edits are changes to existing tests, to cover the new route.

Left out

  • The role-change form (crewRoleUpdate) still redirects.
  • The planner-card and account crew page (src/web/pages/crew.ts) are untouched. The repository crew card lives in src/web/studio/crew.ts, not in the files the issue named.
  • There is no terminal side and no docs/features entry. The commit says No door:, since the change is a web-only redraw of a form that still posts as before.
  • The gate's "look pages" note says it couldn't trace the route to a page. I gave Looks: /alice/notes/settings, and it replied that this isn't an app.looks page in forge.json, so a reviewer decides.

Try it on the preview

  • Open /<owner>/<repo>/settings as an admin and pick an agent under "Add" on a seat. Only that seat changes, and the scroll position stays.
  • Pick an agent that doesn't declare the seat's role, or set a count of 99. The refusal appears under the form and the page doesn't move.
[
  {"go":"/<owner>/<repo>/settings#team","look":"scroll down to the seats, choose an agent in a seat's Add select","expect":"that seat's row redraws with the member listed; the page does not jump to the top and the select keeps focus"},
  {"go":"/<owner>/<repo>/settings#team","look":"click Remove on a member, then type a count in a seat's number field and tab out","expect":"the seat redraws in place with the member gone or the new count, no reload"},
  {"go":"/<owner>/<repo>/settings#team","look":"type 99 in a seat's count and tab out","expect":"the words 'Use a whole number from 0 (paused) to 8; the planner 0 or 1.' appear under that form, nothing else moves","ask":"is the refusal clear beside the form?"}
]

🤖 Generated with Claude Code

Closes #18459

Show 1 earlier items

7 earlier comments
commented

<!-- look-pages 46ca78f60148 --> Look pages for 46ca78f, from the gate:

  • look pages (none): "Looks: /alice/notes/settings" is not a page of app.looks in forge.json; this pull changes src/web/in_place.ts, src/web/pages/crew-settings.ts, src/web/studio/crew.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The failing test, the "patterns the walk skips" check in test/no-polling.test.ts, is fixed and pushed. I ran only that file, and it passes (13 tests). I haven't seen the forge's full check on the new push.

The check failed because the walk couldn't fill :role in the new route /:owner/:name/settings/crew/seat/:role, and no reason was named for skipping it. I added the route to the file's NOT_WALKED list with the reason: it is an HTML fragment of one crew seat, not a page. The change is test-only, so nothing in the app moved.

The rest of the pull is as described before: add, remove and slot-count forms on the crew card redraw only the changed seat, and the add form falls back to the old redirect with scripts off.

To try it, open /<owner>/<repo>/settings as an admin on the preview and pick an agent under "Add" on a seat. The page shouldn't reload or scroll.

🤖 Generated with Claude Code

commented

I've answered the look-pages note with a "No look:" line in a new empty commit, and the gate no longer mentions looks. There is no code change, and I haven't seen the forge's check on this push.

The note was the gate's: my earlier Looks: /alice/notes/settings line named a page that isn't in forge.json app.looks, and the gate couldn't trace a page from the changed files. That list has no page for a repository's settings, only /settings/crew, which this pull doesn't touch. So the commit now says No look: forge.json app.looks has no repository settings page…, and a reviewer has to try the change on the preview.

I didn't re-run the four checks you listed (dead-code exports, duplicate imports, first-view budget, process-wide state), because nothing in the source changed. They passed locally last time: unused-exports, dup-imports, module-state and pages-budget.

I didn't add the repository settings page to app.looks. That would put a seeded repository into the looks fixture, which is more than this pull should decide.

To try it, open a repository's /settings as an admin on the preview and choose an agent under "Add" on a seat. Only that seat should redraw, with no reload or scroll.

🤖 Generated with Claude Code

commented

The crew page now adds, removes and re-counts a seat in place, redrawing only that seat from its server-rendered fragment. The check failed on two tests; I fixed one and left the other.

  • security-floor-routes test (fixed): the new GET /:owner/:name/settings/crew/seat/:role fragment route is one the seed can't fill, because the seed passes no role. I added it to the UNSEEDED list with a reason, in test/security-floor-routes.test.ts. That file now passes locally, 21 of 21.
  • mcp-size test (not touched): the forge's own log says it is red on main at 840ab71 with the same tests, so it isn't counted against this pull. I didn't change the code behind it, and it passes when I run it alone here, 12 of 12.
  • Gate: gate --fix made no rewrap. It noted one comment line over 100 columns in src/web/studio/crew.ts and said the nightly rewrap on main will wrap it.

Reviewers: in the seat fragment route, GET /:owner/:name/settings/crew/seat/:role is a fragment, not a page.

Not run here: bun x tsc --noEmit and scripts/design-lint.ts. Both are left to the forge's check on this push.

commented

I fixed @sentinel's one finding and pushed it. The comment at src/web/in_place.ts:13 now names test/crew-in-place.test.ts, where the script's gzipped byte budget is asserted. I moved no assertion, because that test already holds it.

The change is a comment only, so I ran no tests. The four checks the crew's pulls most often fail (dead exports, duplicate imports, first-view budget, process-wide state) are untouched by it. gate --fix made no rewrap. It noted one comment line over 100 columns in src/web/studio/crew.ts, which the nightly rewrap on main will wrap.

I did not drive the interaction in a browser either, so focus and scroll are still judged from the code only.

commented

The pull needs no code change. I'm pushing nothing, because both red tests look unrelated to it.

  • tui-apps assign test: it waits for "Crew · 1 run" on the terminal issue screen. That text comes from src/tui/screens/issue.ts:776, which this pull doesn't touch. My changes are confined to the crew settings page, the new fragment route, in_place.ts and their tests. test/tui-apps.test.ts passed 8 of 8 in each of three local runs. The forge says it is green on main in 3 runs, and that run took 20 s before timing out, so it looks like a slow or flaky shard. I'm not changing the test.
  • mcp-size test: the forge's log says it is red on main at be45257 with the same tests, so it is not counted against this pull. It passed locally earlier.

Please re-run the check. If tui-apps is red again on a re-run, send me that log and I'll look for a link to the crew page.

commented

I merged main into the branch and pushed it. The only conflict was in src/web/studio/crew.ts.

  • Conflict: main had moved the crew member rows into a shared memberRow function. In both conflicting places I kept main's version, so the member rows are main's.
  • My addition: the Remove form inside memberRow now carries data-in-place. Without it, removing a member would reload the page instead of redrawing the seat.
  • Checks: bun x tsc --noEmit showed no errors. I ran test/crew-in-place.test.ts and the other tests that mention memberRow or settings/crew, 65 in all, and they all pass. I did not run the full suite, so the forge's check on this push covers the rest.
  • Gate: gate --fix made no rewrap. It noted one comment line over 100 columns in src/web/studio/crew.ts, which the nightly rewrap on main will wrap.
commented

The gate failure is fixed and pushed. bun scripts/gate.ts now passes locally with no rule failing. It only prints the usual over-100-column note for src/web/studio/crew.ts.

The gate flagged scripts/multiline-rows.ts. My earlier gate --fix had rewrapped a comment there that this pull didn't write, so the diff carried a change that wasn't mine. I restored the file to match main. The pull's diff now touches only the crew in-place files and their tests.

I ran no other tests for this push, since the restore reverts a comment to what main already has.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs