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

Migrated from github.com/Trevato/SO-ARM100

A test proves /admin settings and moderators survive a relay restart on the same FORGE_APP_DATA #143

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

I added Software/so101/src/admin-restart.test.ts, which proves that /admin state survives a relay restart on the same data dir. The new test passes. I couldn't run tsc --noEmit here because bun couldn't write to its temp dir, so the forge's check will be its first type check.

Notes

shipped merged

opened this

I added Software/so101/src/admin-restart.test.ts, which proves that /admin state survives a relay restart on the same data dir. The new test passes. I couldn't run tsc --noEmit here because bun couldn't write to its temp dir, so the forge's check will be its first type check.

The test starts a relay on a temp data dir. The owner saves an announcement and names bob as a moderator through POST /admin. It then closes the relay and the lobby and boots a new pair on the same dir. After the restart:

  • The owner's GET /admin still shows the announcement, and the log lists both changes with trevato as the author.
  • bob still gets 200 on /admin, sees the read-only page, and gets 403 when trying to save. The announcement is unchanged afterwards.

Nothing outside the new file changed. I ran only this test file, not the whole bun test suite.

🤖 Generated with Claude Code

Closes #136

2 earlier comments
commented

I added Software/so101/src/admin-restart.test.ts, which proves that /admin state survives a relay restart on the same data dir. The new test passes. I couldn't run tsc --noEmit here because bun couldn't write to its temp dir, so the forge's check will be its first type check.

The test starts a relay on a temp data dir. The owner saves an announcement and names bob as a moderator through POST /admin. It then closes the relay and the lobby and boots a new pair on the same dir. After the restart:

  • The owner's GET /admin still shows the announcement, and the log lists both changes with trevato as the author.
  • bob still gets 200 on /admin, sees the read-only page, and gets 403 when trying to save. The announcement is unchanged afterwards.

Nothing outside the new file changed. I ran only this test file, not the whole bun test suite.

🤖 Generated with Claude Code

commented

This pull adds a test that /admin state survives a relay restart. It also adds check.run to forge.json, which the forge's check had flagged as missing. I haven't run the new check command here, so the forge's run on this push will be its first.

  • Test: Software/so101/src/admin-restart.test.ts starts a relay on a temp data dir, and the owner saves an announcement and names bob a moderator through POST /admin. It then restarts on the same dir and checks four things:

- The owner still sees the setting. - The log still shows both changes, attributed to trevato. - bob still sees /admin read-only. - bob still gets 403 when saving.

  • forge.json: it had a check block with only limits. I added check.run as bun install --cwd Software/so101 --frozen-lockfile && bun --cwd Software/so101 test, which is the app's own install and test commands. This is outside the issue's test-only scope, but the check refuses the file without it.

I ran only the new test file, not the whole bun test suite. tsc --noEmit wouldn't run here because bun couldn't write to its temp dir.

🤖 Generated with Claude Code

commented

This pull is now only Software/so101/src/admin-restart.test.ts, merged with current main. I haven't run the tests again since the merge.

The "does not merge into main: forge.json" failure came from my earlier check.run edit. Main fixed the same problem a different way (1142ee6 drops the check block entirely), so the two versions of forge.json conflicted. I reverted my edit and merged main, so forge.json is now identical to main's.

The test starts a relay on a temp FORGE_APP_DATA. The owner saves an announcement and names bob a moderator through POST /admin. It then restarts on the same dir and checks:

  • The owner still sees the setting and both log entries, attributed to trevato.
  • bob still sees /admin read-only.
  • bob still gets 403 when saving.

🤖 Generated with Claude Code

Approved

Test-only change, in scope for the issue. It boots a relay on a temp data dir, saves an announcement and adds a moderator as the owner, and restarts both Lobby and relay on the same admin file. It then checks that the setting and both log entries (attributed to trevato) are back, that bob sees the read-only page, and that his save gets 403 and changes nothing. The assertions match what src/admin.ts writes (settings JSON plus the .log.jsonl), and the identity is signed with the real sign(). Temp dir cleanup is in afterEach. This is a test file, so there is no page, terminal or preview behaviour to exercise; I could not run the new test locally because my clone does not have the file checked out, so I am relying on the green check. Two things I would do next: (1) assert that a moderator removed before the restart stays removed, so persistence is covered in both directions; (2) check that a guest with no identity headers still gets the public view of /admin after the restart.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs