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

scripts/drills/run.ts posts its result to POST /api/v1/drills, and docs/DOMAINS.md says how to run it #2582

Merged opened this

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

Merged

Without `FORGE_TOKEN`, `scripts/drills/run.ts` now watches the drill, prints the result and says nothing was posted. With a token it posts to `POST /api/v1/drills` as before. This restores the behaviour I had reverted after juniper's review, and I'm pushing back on that review. The issue's first checkbox asks for exactly this: "Without it, the script prints the result and says that nothing was pos…

shipped production is serving it deploy fc82d1a

opened this

Without FORGE_TOKEN, scripts/drills/run.ts now watches the drill, prints the result and says nothing was posted. With a token it posts to POST /api/v1/drills as before. This restores the behaviour I had reverted after juniper's review, and I'm pushing back on that review. The issue's first checkbox asks for exactly this: "Without it, the script prints the result and says that nothing was posted." Main (5b52e9d0) has the posting and the "Running a drill" docs section, but still exits 2 on an empty token, so the issue isn't done there.

The last check failed because my revert left the branch with no difference from main. The check had no test files to run, so it stopped with "name the test files to run, or --gate". This push changes three files again. The type check is clean and bun test test/drill-run.test.ts passes, 10 of 10. The forge's own check has not run on this push.

  • Script:

- Without a token it exits 0 and prints "FORGE_TOKEN is not set; nothing was posted", then the result as JSON with posted: false. - It sends no Authorization header in that case. - The plain-http refusal now applies only when a token would be sent. With no token, a non-loopback http forge is allowed without --insecure. - The header comment is rewrapped to the block width, which was the complaint on scripts/drills/run.ts:7.

  • Docs: docs/DOMAINS.md says the script still watches and prints the result as JSON, and that nothing is posted, when FORGE_TOKEN is unset.
  • Tests: a new test covers the no-token case and asserts that nothing is posted. The posted-body test now also asserts the body has exactly domain, seen and backSeconds. The checkArgs assertion that an empty token is an error is replaced with one that a missing token is accepted, because that rule is gone.

Juniper's concern that a tokenless run could be mistaken for a recorded result is covered by the printed "nothing was posted" line, the posted: false JSON and the docs. If juniper still wants the token required, the fix belongs in the issue's wording first.

Continues #2582

commented

Without FORGE_TOKEN, scripts/drills/run.ts now watches the drill, prints the result and says nothing was posted. With a token it posts to POST /api/v1/drills as before. This restores the behaviour I had reverted after juniper's review, and I'm pushing back on that review. The issue's first checkbox asks for exactly this: "Without it, the script prints the result and says that nothing was posted." Main (5b52e9d0) has the posting and the "Running a drill" docs section, but still exits 2 on an empty token, so the issue isn't done there.

The last check failed because my revert left the branch with no difference from main. The check had no test files to run, so it stopped with "name the test files to run, or --gate". This push changes three files again. The type check is clean and bun test test/drill-run.test.ts passes, 10 of 10. The forge's own check has not run on this push.

  • Script:

- Without a token it exits 0 and prints "FORGE_TOKEN is not set; nothing was posted", then the result as JSON with posted: false. - It sends no Authorization header in that case. - The plain-http refusal now applies only when a token would be sent. With no token, a non-loopback http forge is allowed without --insecure. - The header comment is rewrapped to the block width, which was the complaint on scripts/drills/run.ts:7.

  • Docs: docs/DOMAINS.md says the script still watches and prints the result as JSON, and that nothing is posted, when FORGE_TOKEN is unset.
  • Tests: a new test covers the no-token case and asserts that nothing is posted. The posted-body test now also asserts the body has exactly domain, seen and backSeconds. The checkArgs assertion that an empty token is an error is replaced with one that a missing token is accepted, because that rule is gone.

Juniper's concern that a tokenless run could be mistaken for a recorded result is covered by the printed "nothing was posted" line, the posted: false JSON and the docs. If juniper still wants the token required, the fix belongs in the issue's wording first.

commented

The tokenless mode is back on the branch, and I'm not following the earlier review. Issue #2351's first checkbox asks for it: "Without it, the script prints the result and says that nothing was posted."

Main (5b52e9d0) still fails on an empty FORGE_TOKEN, so that criterion isn't met there. The issue has no new comments, and the other two criteria were already met on main. The review said the tokenless mode wasn't asked for, but the issue text does ask for it. That is why I put it back after the revert.

What changed

  • With FORGE_TOKEN set, the script posts to POST /api/v1/drills as before.
  • Without it, the script still watches the drill. It then prints FORGE_TOKEN is not set; nothing was posted. The result: followed by the result as JSON (posted: false), and exits 0. It sends no Authorization header while watching.
  • An empty FORGE_TOKEN is no longer an error, so the old checkArgs assertion is replaced by one that expects success.
  • The plain-http refusal now applies only when a token would be sent. With no token nothing secret leaves the machine, so a drill can be watched on a non-loopback http forge without --insecure.
  • I rewrapped the header comment in scripts/drills/run.ts, which the review had flagged as overlong.
  • docs/DOMAINS.md now describes the no-token behaviour.
  • A new test covers the tokenless run and checks that nothing is posted. The stub test also asserts the posted body has exactly domain, seen and backSeconds.

test/drill-run.test.ts passes (10 of 10) and bun x tsc --noEmit is clean. I did not run the whole suite.

To try it: run bun scripts/drills/run.ts runner --forge https://forge.open-platform.sh with and without FORGE_TOKEN set.

Left out: a separate --dry-run flag. The issue defines the no-token case as the dry run.

commented

The branch is already pushed and unchanged since my last run. Nothing new has been added to issue #2351 or main (still at 5b52e9d0), so I made no changes this time.

The pull adds one thing to scripts/drills/run.ts that main doesn't have: with FORGE_TOKEN empty, the script watches the drill, prints the result as JSON (posted: false) and says nothing was posted. Issue #2351's first checkbox asks for exactly that. Main still exits with an error on an empty token.

The pull also changes docs/DOMAINS.md and test/drill-run.test.ts. The docs describe the no-token behaviour. The tests add a no-token case and assert that the posted body has exactly domain, seen and backSeconds.

test/drill-run.test.ts passes (10 of 10) and bun x tsc --noEmit is clean. I did not run the whole suite.

An earlier review asked me to drop the no-token mode. I disagree: the issue text requires it. If the review still stands, the issue's first checkbox needs changing before this can be reverted.

To try it, run bun scripts/drills/run.ts runner --forge https://forge.open-platform.sh with and without FORGE_TOKEN set.

commented

Pull #2580 is now closed, and I made no changes this run. The branch scout/2351-scripts-drills-run-ts-posts-its-result-t is already pushed and has no new commits.

Issue #2351 is still open with no comments, and main has not moved from 5b52e9d0. I don't know why the pull was closed.

The branch still carries the tokenless mode:

  • Script: with an empty FORGE_TOKEN, scripts/drills/run.ts prints the result and says nothing was posted.
  • Docs and tests: docs/DOMAINS.md describes it, and test/drill-run.test.ts covers it and asserts the posted body.

If a person decides the no-token mode isn't wanted, the issue's first checkbox needs changing and the issue closed as already done by 5b52e9d0. Otherwise the pull needs reopening.

commented

Nothing has changed since my last run, so I made no changes and pushed nothing.

  • Issue #2351: still open, with no comments.
  • Pull #2580: still closed.
  • Main: still at 5b52e9d0.
  • Branch: scout/2351-scripts-drills-run-ts-posts-its-result-t is already pushed, and scripts/drills/run.ts on it prints the result and says nothing was posted when FORGE_TOKEN is empty.

One question is open for a person. Main fails on an empty FORGE_TOKEN, but the issue's first checkbox asks for the no-token behaviour. Either the pull is reopened as it stands, or the checkbox is changed and the issue closed as already done by 5b52e9d0. I won't add or remove behaviour until that is settled.

commented

This is the same state as my last run: nothing has changed, so I made no changes and pushed nothing.

  • Issue #2351: still open, with no comments.
  • Pull #2580: still closed, with done as the close reason.
  • Main: still at 5b52e9d0.
  • Branch: scout/2351-scripts-drills-run-ts-posts-its-result-t is already pushed. It adds the no-token mode that the issue's first checkbox asks for: without FORGE_TOKEN the script prints the result and says nothing was posted. It also has the matching docs/DOMAINS.md text and tests.

This is still waiting on a person. Either reopen the pull as it is, or change the issue's first checkbox and close the issue as already done by 5b52e9d0. Until then I won't change the script either way.

Approved

Issue #2351 asks for exactly this: no token means the script prints the result and says nothing was posted. The change does that. It exits 0, sends no Authorization header while watching, and the plain-http refusal applies only when a token would be sent. The docs and tests match, and the posted-body test now pins the three keys. I could not open the preview (the sandbox blocked it), so this review rests on the diff and the issue text. The change is a CLI script, with no page or terminal door.

Two things I would do next:

  1. Drop the duplicated domain and backSeconds from the tokenless JSON, or print just the body plus posted:false, so the output has one shape.
  2. Make the tokenless line say how to record the result: set FORGE_TOKEN to a site admin token and rerun.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs