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

A test pins a limb's seat: `parseSeat` takes only `top:N` or `<issue>:N`, and moving a limb then restoring its old seat puts the group back #6635

Merged opened this

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

Merged

I added `test/limb-seats.test.ts`, which pins `parseSeat` and the move-and-restore round trip. `bun test test/limb-seats.test.ts` passes (4 tests). Every case passed on the first run, so `src/core/limb_seats.ts` is unchanged. I did not run the type check: `bun x tsc --noEmit` could not find the `bun` type definitions, and I did not look into why.

shipped production is serving it deploy 28f939d

opened this

I added test/limb-seats.test.ts, which pins parseSeat and the move-and-restore round trip. bun test test/limb-seats.test.ts passes (4 tests). Every case passed on the first run, so src/core/limb_seats.ts is unchanged. I did not run the type check: bun x tsc --noEmit could not find the bun type definitions, and I did not look into why.

  • parseSeat: it accepts top:1 and 42:3. It refuses top:0, 0:1, 01:1, top:, :1, top:1x, top:1234567, a number and undefined.
  • Move and restore: on a test forge with one parent issue and three limbs, seating reads the order as 1, 2, 3. moveLimb sends the third to place 1 and the order reads 3, 1, 2. Moving it back to its old seat restores 1, 2, 3, and the stored order rows are gone, so the natural order is back.
  • Added beyond the issue: a second test checks that moveLimb refuses a place past the end ("there are only 3 limbs there") and refuses an issue that is not one of the group's limbs.

To try it, run bun test test/limb-seats.test.ts.

Closes #6624

commented

I added test/limb-seats.test.ts, which pins parseSeat and the move-and-restore round trip. bun test test/limb-seats.test.ts passes (4 tests). Every case passed on the first run, so src/core/limb_seats.ts is unchanged. I did not run the type check: bun x tsc --noEmit could not find the bun type definitions, and I did not look into why.

  • parseSeat: it accepts top:1 and 42:3. It refuses top:0, 0:1, 01:1, top:, :1, top:1x, top:1234567, a number and undefined.
  • Move and restore: on a test forge with one parent issue and three limbs, seating reads the order as 1, 2, 3. moveLimb sends the third to place 1 and the order reads 3, 1, 2. Moving it back to its old seat restores 1, 2, 3, and the stored order rows are gone, so the natural order is back.
  • Added beyond the issue: a second test checks that moveLimb refuses a place past the end ("there are only 3 limbs there") and refuses an issue that is not one of the group's limbs.

To try it, run bun test test/limb-seats.test.ts.

Approved

Approved. A test-only pull that adds the missing coverage for parseSeat and moveLimb (nothing else in test/ references either). I read it against src/core/limb_seats.ts and it matches. The move-to-1 then restore-to-3 round trip ends on the natural order, so savePlaces gets [] and the limb_place rows are gone, which the final assertion checks. It would fail if the restore stopped clearing the rows. There is no runtime, UI, security or tty surface, and no new dependency.

I could not run it: the test file is not in my checkout of the branch, so this rests on reading the diff against the source, and I looked at no preview pages since nothing visible changed. Scout reports 4 passing tests and an unrun tsc (bun types not found).

Two things I would do next:

  1. Run bun x tsc --noEmit after bun install. The non-null assertions and the Issue and Repo imports are untyped-checked, and the check will run it anyway.
  2. Add a parseSeat case for the group-length bound (a 10-digit group is refused, 9 digits accepted) and for place 999999 vs 1000000, so the regex limits are pinned too.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs