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

Full suite red: test/unreached.test.ts #9315

Closed opened this in answer to
Closed without merging

test/unreached.test.ts was red because src/actions/pindemos.ts (merged in #9284) was imported only by its own test. I wired it into the app instead of adding it to the allow-list. What changed Each pin on the builds page now has a Showcase or Unshowcase button, shown to anyone who can already see Delete.

Notes

stopped closed without shipping deploy 5be5032

opened this

test/unreached.test.ts was red because src/actions/pin_demos.ts (merged in #9284) was imported only by its own test. I wired it into the app instead of adding it to the allow-list.

What changed

  • Each pin on the builds page now has a Showcase or Unshowcase button, shown to anyone who can already see Delete.
  • The button posts to a new route, POST /:owner/:name/builds/:label/showcase. The handler is showcaseSubmit in src/web/pages/builds.ts. It calls setShowcase from pin_demos.ts and flashes the result. It uses the same same-origin check and sign-in handling as the delete route.
  • A new test in test/build-pins.test.ts posts to the route. It checks that a cross-origin post gets a 403 and changes nothing, and that the pin's showcase flag then goes on and off.

Checks: test/unreached.test.ts, test/build-pins.test.ts, test/pin-demos.test.ts, the other build-related tests, bun scripts/gate.ts, bun scripts/design-lint.ts and bun x tsc --noEmit all pass. I did not run the whole suite; the forge runs that on push. I did not try the button in a running app.

Left out: the other actions in pin_demos.ts still have no UI: saveDemo (edit name, version, launch and page), deleteDemo and captureBuild. They are called from the file's own functions or its test, so the module counts as reached. The next pull on this feature should add forms for them.

Closes #9306

2 earlier comments
commented

test/unreached.test.ts was red because src/actions/pin_demos.ts (merged in #9284) was imported only by its own test. I wired it into the app instead of adding it to the allow-list.

What changed

  • Each pin on the builds page now has a Showcase or Unshowcase button, shown to anyone who can already see Delete.
  • The button posts to a new route, POST /:owner/:name/builds/:label/showcase. The handler is showcaseSubmit in src/web/pages/builds.ts. It calls setShowcase from pin_demos.ts and flashes the result. It uses the same same-origin check and sign-in handling as the delete route.
  • A new test in test/build-pins.test.ts posts to the route. It checks that a cross-origin post gets a 403 and changes nothing, and that the pin's showcase flag then goes on and off.

Checks: test/unreached.test.ts, test/build-pins.test.ts, test/pin-demos.test.ts, the other build-related tests, bun scripts/gate.ts, bun scripts/design-lint.ts and bun x tsc --noEmit all pass. I did not run the whole suite; the forge runs that on push. I did not try the button in a running app.

Left out: the other actions in pin_demos.ts still have no UI: saveDemo (edit name, version, launch and page), deleteDemo and captureBuild. They are called from the file's own functions or its test, so the module counts as reached. The next pull on this feature should add forms for them.

commented

test/unreached.test.ts was red because nothing in the app imported src/actions/pin_demos.ts. I fixed that by adding a Showcase button to each pin on the builds page.

The check failed because the pull changes src/http/server.ts and src/web/pages/builds.ts but no commit message said how to try it on the preview. I added an empty commit with a Try: line and pushed it. bun scripts/gate.ts now passes locally. I did not rerun tsc or the tests, since this commit changes no files. The forge's check on the new push will show whether it is green.

What changed

  • Each pin on the builds page now has a Showcase or Unshowcase button, shown to anyone who can already see Delete.
  • It posts to a new route, POST /:owner/:name/builds/:label/showcase, handled by showcaseSubmit in src/web/pages/builds.ts. The handler calls setShowcase from pin_demos.ts and flashes the result. It uses the same same-origin check and sign-in handling as the delete route.
  • A new test in test/build-pins.test.ts posts to the route. A cross-origin post gets a 403 and changes nothing. A same-origin post turns the pin's showcase flag on and then off.

Left out: saveDemo (edit name, version, launch and page), deleteDemo and captureBuild still have no UI. Only their own tests and pin_demos.ts itself call them. The next pull on this feature should add forms for them.

Try: open /<owner>/<repo>/builds on the preview, sign in as a writer, and press Showcase on a pin.

commented

Declined: already done on main in 30f7db6. #9314 removed src/actions/pin_demos.ts and test/pin-demos.test.ts, which was the other way to clear the red test/unreached.test.ts. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m6gn6zg4btvxq56bd9p0a73f

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs