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

Games: the people list shows no ops after a successful `op` (#17610 item 8) #17619

opened this

Merged 13h 59m ago, live in production

A successful op now shows in the people list within a few syncs. I couldn't confirm that real Minecraft servers write ops.json late, so that's an inference from the symptom. The test uses a fake docker whose ops.json stays empty on the first two reads.

Notes

opened this

A successful op now shows in the people list within a few syncs. I couldn't confirm that real Minecraft servers write ops.json late, so that's an inference from the symptom. The test uses a fake docker whose ops.json stays empty on the first two reads. I ran test/game-people.test.ts and test/game-agent-update.test.ts (15 pass) and bun scripts/gate.ts --explain. bun x tsc --noEmit was not run: the gate says it needs installed dependencies and I did not run bun install.

Cause. The agent read ops.json once after a people command and then went back to its 60-second cache. If the server hadn't flushed the file at that moment, the empty list was kept for up to a minute.

Change (src/games/agent.sh):

  • A successful op, deop, whitelist-add, whitelist-remove, ban or pardon is written to .people.expect.
  • After each read of the lists, people_settle checks that the file shows the change. If it doesn't, the next sync reads again, at most 5 times.
  • A server that wasn't read keeps its line, so a stopped server doesn't use up the tries.
  • docs/features/games.md now says this. The page and terminal already show whatever the lists hold, so there is no change to either (commit line says No door).

Test (test/game-people.test.ts). It runs the real agent over three syncs. The first sync issues the op command, the second still sees no ops, and the third must show Alice. With people_settle commented out it fails, and with it back in it passes.

Left out:

  • kick, move and whitelist-on/off are not tracked, since they don't change these lists.
  • I did not look at the forge side. recordPeople and peopleOf store and return exactly what the agent sends.
  • An op on a player the server can't resolve (offline and not in its usercache) still returns a failed result, and nothing is retried for it.

To try: op someone from a service's People block and watch the ops list over the next few syncs.

Closes #17617

3 earlier comments
commented

A successful op now shows in the people list within a few syncs. I couldn't confirm that real Minecraft servers write ops.json late, so that's an inference from the symptom. The test uses a fake docker whose ops.json stays empty on the first two reads. I ran test/game-people.test.ts and test/game-agent-update.test.ts (15 pass) and bun scripts/gate.ts --explain. bun x tsc --noEmit was not run: the gate says it needs installed dependencies and I did not run bun install.

Cause. The agent read ops.json once after a people command and then went back to its 60-second cache. If the server hadn't flushed the file at that moment, the empty list was kept for up to a minute.

Change (src/games/agent.sh):

  • A successful op, deop, whitelist-add, whitelist-remove, ban or pardon is written to .people.expect.
  • After each read of the lists, people_settle checks that the file shows the change. If it doesn't, the next sync reads again, at most 5 times.
  • A server that wasn't read keeps its line, so a stopped server doesn't use up the tries.
  • docs/features/games.md now says this. The page and terminal already show whatever the lists hold, so there is no change to either (commit line says No door).

Test (test/game-people.test.ts). It runs the real agent over three syncs. The first sync issues the op command, the second still sees no ops, and the third must show Alice. With people_settle commented out it fails, and with it back in it passes.

Left out:

  • kick, move and whitelist-on/off are not tracked, since they don't change these lists.
  • I did not look at the forge side. recordPeople and peopleOf store and return exactly what the agent sends.
  • An op on a player the server can't resolve (offline and not in its usercache) still returns a failed result, and nothing is retried for it.

To try: op someone from a service's People block and watch the ops list over the next few syncs.

commented

Both points are fixed and pushed. A server that wasn't read now keeps its line in .people.expect with the same tries, and the new test for it passes. The gate reports 0 fail and bun x tsc --noEmit is clean. I ran the full test/game-people.test.ts before the last commit but did not re-run it after it.

  • people_settle in src/games/agent.sh: when has is "unread" (stopped, no RCON, or the exec failed), the line is kept as it was and no try is spent. .people.due is now set only when a server that was read still lacks the change, and it is no longer set for an unread-only remainder. A stopped server no longer forces a re-read of every list on each sync.
  • New test, "a server not read keeps its expected change": it runs seven syncs with the server down, more than the five tries a change is held for. It checks that .people.expect is still hub\top\tAlice\t0, with no .people.due file. Then it brings the server up and checks that the next sync shows the op and empties the expect file. It sets FORGE_GAME_PEOPLE_EVERY=0, because without a due flag the sync after the server returns would otherwise wait out the 60-second cache. That cache wait is intended.
  • Gate note: the gate noted that the new run helper in this test file is 0.70 similar to run in test/game-sync-plain.test.ts. It is a note, not a failure, and I left it. The two tests I added here each have their own copy of the spawn helper, so it could move into one shared helper.
commented

I merged main into the branch and pushed it. The one conflict was in src/games/agent.sh.

main had replaced the inline capped 5 "${COMPOSE[@]}" ps … call with a running helper. I kept the helper and left my people_settle "$out" call right after the read loop.

The tests for people, agent-update and game-box all pass (28 tests), bun x tsc --noEmit is clean, and the gate reports 0 fail. I didn't run the rest of the suite; the forge's check does that on the push.

commented

I merged main into this branch and pushed it. The only conflict was in docs/features/games.md, and it is resolved.

What changed: main added the refused-joins and wakes paragraphs (#17610). My side had one new sentence in the agent paragraph. That sentence says a change a list doesn't show yet is read again on the next syncs, up to five, so a successful op shows in the ops (#17617). I kept main's paragraphs unchanged and put my sentence into the one agent paragraph that remains. No code was touched.

Checks:

  • tsc --noEmit ran, but its output was cut off by the same command's timeout, so I can't confirm it passed.
  • test/game-people.test.ts, test/docs-index.test.ts and test/docs-link.test.ts pass (33 tests).
  • I did not run the full suite or the scripts/fast.ts selection. That selection named 2,754 files and would have taken about 226 minutes, so I ran the games and docs tests by hand. The forge's check runs everything on this push.
  • bun scripts/gate.ts --fix changed nothing. It flagged two test helpers in test/game-people.test.ts as similar to one in test/game-sync-plain.test.ts. That is a note, not a failure, and I left them.
Sign in to join this conversation.

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

Keyboard shortcuts

Docs