Commit graph

360 commits

Author SHA1 Message Date
acamilo
6d11e437e5 Merge fix/loop-row63 2026-09-29 01:29:42 +00:00
acamilo
b6e552ace2 tests: the row 62 east test's first sighting as a plain tuple 2026-09-29 00:18:27 +00:00
acamilo
c8f35b4fce docs: row 64, a ladder underfoot, Route 4's ledges and the way out that goes nowhere (12.28, audit) 2026-09-29 00:11:14 +00:00
acamilo
d06e1cf809 bridge: refresh stored tokens on load before giving up, persist both roles
A stored access token that has expired (obtainmentTimestamp + expiresIn) or
that validate rejects with 401 is now refreshed once through its role's
RefreshingAuthProvider before startup fails, for the bot and broadcaster
roles alike. Refreshes are persisted under the role whose provider made
them (no more scope-set guessing), through one serialized writer, so both
roles reach tokens.json even when they are one account; writes stay
tmp + rename, 0600.

Only a refresh Twitch refuses (4xx, e.g. 400 Invalid refresh token) is
fatal, with one line naming the role and the runbook's re-authorize step.
Twitch errors are logged by status and message only: twurple's
HttpStatusCodeError message carries the refresh grant URL, client secret
and refresh token included, so the entrypoint and EventSub log lines now
redact it.

Tests mock Twitch's validate and token endpoints. Runbook and B1 updated.
2026-09-28 23:47:48 +00:00
acamilo
83e842aee2 macros: a way out that does not take the fly anywhere is not done
The general half of row 64: section 12.2's rule ("a macro that completes
without moving because its precondition is already satisfied is a trap")
held by the executor for every way out, instead of by each macro.

A way out's promise is another map. A Settle arrival on an exit key that
leaves the fly on the same map now ends Blocked, so the exit rests in the
blocked ledger for the window. When the fly never left the tile it pressed
from, row 57's refused-from-here ledger also keeps that button off this
tile for the window, because the last resort ignores the blocked ledger
and would otherwise re-deal the same dead exit once per hold. Nothing is
pressed, ranked or chosen: two ledgers that already exist get one more
honest writer. A pad with nothing left that can run is empty and waits.

On base with only this commit, from the live row-64 checkpoint (72k
frames, GO OBJECTIVE/GO WARP preferred): GO OBJECTIVE done in place 1,500
-> 0; the fly leaves the ladder tile and moves on (still not to Cerulean,
which needs the ledge knowledge). The test fixture's settle now drains the
refused ledger after every finish, as PokemonPalette::record_talk does.
2026-09-28 23:38:06 +00:00
acamilo
f4946ce744 tests, docs: row 62 round 2, GO HEAL east of Mt. Moon on the cartridge and the two limits in 12.26 2026-09-28 23:37:40 +00:00
acamilo
b2c5944a02 05-deploy: a release with a channel refuses an empty GAME_TITLE
The generated fly.env writes GAME_TITLE whether or not the env file
sets it, and flybridge refuses to start on an empty one. It reads the
file only at start, so the gap surfaced as dead chat at the next reboot
(2026-09-28), a day after the deploy that caused it.
2026-09-28 23:35:33 +00:00
acamilo
e10f48e1c7 macros: a ledge is a hop the route search takes the one way the cartridge does
Row 64, the source of the Mt. Moon ring. Off the ladder, the road reaches
Route 4 east of the mountain, where Cerulean is three ledges down. The
collision list calls a ledge tile a wall, so the route search had no road
from the cave's exit to Cerulean at all: GO OBJECTIVE refused no route, the
east edge rested in the blocked ledger, and the other walks took the fly
back into the cave, onto B1F's exit (27, 3) or down B1F's ladder to B2F
(5, 7), where the ladder ring took over.

- The decoded grid marks LedgeTiles hops (data/tilesets/ledge_tiles.asm,
  OVERWORLD tileset only, the lower-left anchor tiles HandleLedges reads).
- The route search takes a hop from above as one press that lands two
  tiles on; from below a ledge stays a wall; the flood the map's pieces
  are measured with is unchanged.
- The walk holds while the cartridge carries the fly over (scene Unknown,
  scripted, on the hop's own line), so a hop it asked for is not written
  as a push-back.

ROM test from the live checkpoint (FLY_ROW64_CHECKPOINT): base stays on
(5, 7) with 167 done-in-place and never leaves B2F; branch takes the
ladder on the first GO OBJECTIVE, hops Route 4's ledges and reaches
Cerulean City at frame 1,972 with the pushed ledger empty.
2026-09-28 22:50:34 +00:00
acamilo
014d869e14 macros: a walk that starts on its own ladder steps off and back on to take it
Row 64, Mt. Moon B2F (5, 7), two days live. A warp whose exit has no press
fires at the end of a step onto it (CheckWarpsNoCollision) and at no other
time; a bump into the wall beside it warps only at a map edge off the
overworld (ExtraWarpCheck). The fly came down the exit ladder and stood on
it, and GO OBJECTIVE and GO WARP both aimed at the tile underfoot, settled
there and reported done without a press, 27 frames each, ~750 per ten brain
minutes. No ledger was involved, so restarts restored the ring.

A walk whose goal is a step-fired warp the fly already stands on now steps
onto free ground beside it (never another warp) and back, which is what
fires it. Nothing else changes: the pad, the ledgers and every other
arrival are as they were.
2026-09-28 22:49:17 +00:00
acamilo
3ea8da346c recovery splash: the operator's copy, and STUCK from the last progress
A reset to the rung the fly is on reads 'the start of MT. MOON'; a rung
that is not a place reads 'the BOULDER BADGE milestone'; failed says
what happens next ('Trying something else next') instead of promising
a human. The helper keeps the last probe that saw new places or a higher
rung, across restarts and reboots, so STUCK counts the whole trap rather
than the current streak (live: 15 MIN shown for a two-day trap).
Mockups re-shot with the real next target (12 -> 11).
2026-09-28 22:43:41 +00:00
acamilo
64148848e5 loop recovery: check every minute, not every five
The live timer's phase sat one second before each watchdog loop probe,
so every confirmation waited almost a whole extra period. A run is a
JSON read unless a step is due, and the ladder already ignores a probe
it has seen, so a one-minute cadence costs nothing.
2026-09-28 22:19:53 +00:00
acamilo
f2d8a2d491 palette: a centre is the area's from ground the route to it stays on, and no service leaves the rung's room
Review round 2 of row 62. Route 4's east side and Mt. Moon B1F's exit chamber are in
Route 4's area, but the only road to its centre runs through B2F, which is in none:
GO HEAL (and the errand under GO OBJECTIVE) walked into B2F and dropped there, opposite
the road to Cerulean. A building is the area's errand or service only where
geography::route_within holds. And a service is not wanted while the rung's own target
stands in the room (row 29's rule, row 58's gym bounces).
2026-09-28 22:12:09 +00:00
acamilo
aba63beb77 docs: macros.md 12.26 and the row 62 audit, the shop, the balls and the nurse withheld
What the pad dealt against what the fly chose, the five places the pad
withheld a counter with a job to do, the purchase that ended before its
price box, THROW BALL measured as not a trap, and the before/after
surveys (ten per arm) and ROM runs.
2026-09-28 22:08:17 +00:00
acamilo
2fb5e37ab4 scene_probe: FLY_PROBE_CATCH=offers, what the pad deals frame by frame
Twenty brain minutes of the service's frame behind a uniform stub,
counting per decidable frame which shop, centre and ball buttons are on
the pad and what comes of the ones pressed, beside the cartridge's own
heals, purchases, throws, catches, whiteouts and wLastBlackoutMap. With
FLY_PROBE_PREFER, FLY_PROBE_PADS and FLY_PROBE_TRACE_MACRO for the
mechanism (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
d188a59495 tests: row 62's ROM proofs, HEAL in the Mt. Moon centre and a ball bought in Pewter
From the Mt. Moon centre with the party at 10/70 (FLY_ROW62_CENTER_CHECKPOINT):
HEAL is dealt, heals, and wLastBlackoutMap becomes Route 4. From the
rung-11 Pewter checkpoint with the errands paid, 1,606 and no ball
(FLY_ROW62_MART_CHECKPOINT): GO SHOP is on the pad, walks into the mart,
and BUY BALL reports done only with the ball in the bag and 200 paid.
Both fail on main 862e343 (HEAL never dealt in 3,000 frames; GO SHOP not
on Pewter's pad).
2026-09-28 22:08:17 +00:00
acamilo
87d31bcade palette: a centre or a mart with a job to do is dealt again, and its counter person is found from the door
The errand is paid by the first visit, including one on which the counter
could do nothing (the Viridian clerk handing over Oak's parcel, a centre
entered with a full party), and GO SHOP / GO HEAL never came back; a
counter person this session had talked to or reached was retired for it
too. Live: eleven hours, GO SHOP twice (the parcel), no BUY, no HEAL, no
throw, wLastBlackoutMap still Pallet Town.

service_needed reads the cartridge each time: a centre while the party
needs rest, a mart while the bag has no ball, the wallet covers one and
the bag holds no Oak's parcel. It satisfies itself (a heal leaves the
party full, a purchase leaves a ball). GO SHOP / GO HEAL aim at the
area's building while it holds; inside, the counter walk and TALK at it
ignore the talked and reached ledgers (blocked is kept). HEAL's goals
keep the tile that already faces the nurse, where GO HEAL leaves the fly.
The counter person is read from the drawn and the off-screen sprites
(row 58's reading): from a centre's door the nurse is six rows up and
off the screen, so HEAL, GO HEAL and the counter's suppression were all
off on arrival (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
9ad2feff5c executor: a purchase answers the price box the cartridge drew, and is done when paid
After the quantity the mart prints "That will be" and waits for a press
(a cont), then prints the price and only then draws its YES/NO box. The
script's one blind A after a settle was that press, so BUY BALL reported
done before the box existed: 55 starts, 55 done, the wallet unchanged,
from the rung-11 Pewter checkpoint. Step::Prompt pulses A until the box
is drawn (yes_no_prompt, row 56's reading), Step::Paid waits for the
wallet to drop; either running out is blocked. The fake mart now prints
its price, draws the box and charges for a YES (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
019bd02dfe geography: Route 4's Pokécenter is a centre on the map graph
MT_MOON_POKECENTER ($44, Route 4's warp at (11, 5)) joins LINKS, Route
4's west piece and AMENITIES as Route 4's centre. It was on no table,
so HEAL was never dealt in it and no errand could walk to it: the last
centre before Mt. Moon, where the live run spent 3.5 hours whiting out
(loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
eecd5744e0 docs: v0.6.4 status
Some checks are pending
ci / node 22 (test + typecheck) (push) Waiting to run
ci / rust stable (cargo test --workspace --release) (push) Waiting to run
ci / infra/tests/lint.sh (push) Waiting to run
ci / playwright apps/stage (allowed to fail) (push) Waiting to run
2026-09-28 21:38:07 +00:00
acamilo
dc64ffb4ea Merge feat/recovery-splash: an on-stream splash while recovery acts 2026-09-28 21:37:56 +00:00
acamilo
3922b82762 Merge feat/loop-recover-ladder: automatic loop recovery climbs restart, rung reset, rung below 2026-09-28 21:37:50 +00:00
acamilo
26892d8530 loop recovery: wait on the watchdog's ActiveState, and only a root flysim that is the running build
review-ladder r2: a oneshot probe mid-run is 'activating', which
is-active does not count, so the wait never waited. The root copy must
also be byte-identical to /opt/fly/current/flysim, so a manual rollback
cannot approve an archive the running build refuses. Docs: the hold
after an unrestorable rung, the post-deploy --list check, and never
stopping the unit mid-step.
2026-09-28 21:37:40 +00:00
acamilo
865d6f6b55 stage mockups: recovery splash, four phases by two actions 2026-09-28 21:34:37 +00:00
acamilo
c574e7b973 docs: recovery splash and the stream notice contract 2026-09-28 21:34:37 +00:00
acamilo
15f2e6dbae stage: auto-recovery splash over the game, polled from flystage-web
The loop-recovery helper's notice (/run/fly/wd/recovery-notice.json,
FLY_RECOVERY_NOTICE) is served by serve.mjs at /recovery-notice.json and
polled once a second by the page, independent of flysim. Countdown shows a
Game Boy text box over the bottom of the game; acting covers the game while
flysim is down; done/failed show briefly. Stale, malformed or oversized
notices are ignored and helper strings are clipped to a closed charset.
Adds ?recovery=, __stage.recovery(), the recovery-notice dev tool, unit
tests (model, poller, serve.mjs route) and an e2e spec.
2026-09-28 21:34:37 +00:00
acamilo
f205d95e5e loop recovery: review-ladder fixes, root never runs a fly-writable binary
B1: fly-loop-reset runs only /opt/fly/sbin/flysim, a root-owned copy
05-deploy installs from the release tarball after checking it against
the tarball's MANIFEST; fixed paths, fly.env parsed as data, env -i.
B2: the wrapper pauses fly-watchdog.timer (and waits out a running
probe) for the reset, and starts flysim and the timer on every exit.
H1: a step that raises or times out is a failed step; the ladder state
is saved before the step runs. H2: one --list call computes the build's
compatibility once; TimeoutStartSec 25 min. H3: level 2+ resets to the
rung below the best or restarts, never lower.
Tests run the wrapper against a fake flysim, systemctl and archives.
2026-09-28 21:34:32 +00:00
acamilo
9c9cec49a9 loop recovery: reset only to an archive the running build can restore
fly-reset-to-milestone does not check compatibility and a flysim that
refuses every checkpoint does not start. fly-loop-reset --check applies
05-deploy's rule (identical, or an adapter-only difference named in
FLY_ACCEPT_ADAPTERS); the ladder picks the highest restorable rung and
falls back to a restart when there is none.
2026-09-28 21:25:58 +00:00
acamilo
63ecc32b2f loop recovery: an escalation ladder that unsticks a trap on its own
Restart flysim, then reset to the current rung's milestone, then to the
archive below the best rung (never lower), one step per confirmed trap
that outlives the previous one. Two resets a day, three-hour restarts
once they are spent; the ladder starts over at a new best rung or after
six quiet hours. State and history live in the unit's StateDirectory so
a reboot does not forget where the ladder stood.

A router model list confirms each step; a 'not stuck' answer delays it
at most three probes and no answer leaves the watchdog to decide alone.
Each step is announced 60 s ahead in /run/fly/wd/recovery-notice.json
for the stage's recovery splash.

fly-loop-reset is the one new root surface (a sudoers line); 05-deploy
now converges config/fly-sudoers so a release can add it.
2026-09-28 21:23:33 +00:00
acamilo
1bd2223431 Require complete router configuration before veto 2026-09-26 01:23:31 +00:00
acamilo
dccc52ae1c Document recovery and run its regressions in infra gate 2026-09-26 01:15:44 +00:00
acamilo
432991cbc5 Add conservative automated loop recovery timer 2026-09-26 01:12:46 +00:00
acamilo
f6e3013708 tests: the own-turn pad measure skips a menu the cartridge still holds an A on 2026-09-24 05:29:03 +00:00
acamilo
1acd20eb23 docs: macros.md 12.27 and the row 63 audit, an A the cartridge has not let go of 2026-09-24 05:29:03 +00:00
acamilo
e170812e7c palette: a battle menu the cartridge still holds an A on deals no pad
RUN's A is taken and the menu's box stays up while the game stops asking the joypad; a
macro dealt on those frames pressed at a menu already gone and held the pad for its cursor
wait. Empty until the cartridge asks again, 12.13's reading.
2026-09-24 05:29:03 +00:00
acamilo
68b756d824 tests: row 63's ROM proofs, the Potion used from the Mt. Moon checkpoint and the two pinned addresses read back 2026-09-24 05:29:03 +00:00
acamilo
4178a20529 palette: MOVE 1 is FIGHT's backstop only while nothing else is a move, and ITEM asks the cartridge about its Potion 2026-09-24 04:49:40 +00:00
acamilo
86149dca9b executor: a confirming A waits for the cartridge to have let go of the last one
The Potion's party list reads open before the game asks the joypad again, and until it asks
the A that opened it is still in hJoyLast: an A pressed there is no edge. ITEM confirmed on
that frame, reported done over a list still waiting, and the fly backed out with BACK, BACK.
2026-09-24 04:49:40 +00:00
acamilo
944c9204e0 scene_probe: FLY_PROBE_CATCH=bag and =potion, row 63's battle survey and the party list's A window 2026-09-24 04:49:40 +00:00
acamilo
113970f4e1 state: what the cartridge does with an item from the battle bag, and whether it still holds an A
item_routine reads ItemUsePtrTable ($03:$55E1) by id and checks it by its own shape;
battle_item_use answers each routine's refusal on bytes already in WRAM. a_latched reads
hJoyLast, the reading the joypad edge is made against. MacroState gains item_refused and
a_latched, both off by default.
2026-09-24 04:04:08 +00:00
acamilo
862e343e1c docs: v0.6.2 status
Some checks failed
ci / node 22 (test + typecheck) (push) Has been cancelled
ci / rust stable (cargo test --workspace --release) (push) Has been cancelled
ci / infra/tests/lint.sh (push) Has been cancelled
ci / playwright apps/stage (allowed to fail) (push) Has been cancelled
2026-09-23 23:48:20 +00:00
acamilo
d0ce10e3c9 Merge fix/loop-row61: a trainer's challenge is the cartridge's until its battle is over 2026-09-23 23:48:20 +00:00
acamilo
9b117dc4b2 docs: 12.25 and the row 61 audit on top of row 59, the bubble, game.scene in macros mode 2026-09-23 23:47:36 +00:00
acamilo
cff15804fb state, tests: the challenge covers the "!" bubble too, the doc block back above its impl, and the ROM test asserts no pad inside a challenge 2026-09-23 23:47:36 +00:00
acamilo
d6597b3e98 docs: the row 61 audit, a trainer's challenge text walled the forest's corridor 2026-09-23 23:28:17 +00:00
acamilo
0117a85354 docs: macros.md 12.24, a trainer's challenge is the cartridge's until its battle is over 2026-09-23 23:28:12 +00:00
acamilo
c78ca352f6 tests: the ROM proof from the forest's south gate checkpoint 2026-09-23 23:28:05 +00:00
acamilo
0e366cd4e4 state: a trainer's challenge is the cartridge's until its battle is over, in the macros' own scene 2026-09-23 23:27:54 +00:00
acamilo
16bc65b5a8 survey: FLY_PROBE_CATCH_FRAME reads the first free frame from a given one, FLY_PROBE_WHOLE prints a big map whole 2026-09-23 23:27:54 +00:00
acamilo
510727ccc0 docs: v0.6.1 status
Some checks are pending
ci / node 22 (test + typecheck) (push) Waiting to run
ci / rust stable (cargo test --workspace --release) (push) Waiting to run
ci / infra/tests/lint.sh (push) Waiting to run
ci / playwright apps/stage (allowed to fail) (push) Waiting to run
2026-09-23 23:08:10 +00:00
acamilo
f32352bd5e Merge fix/loop-row59: the map graph as the cartridge's headers and warps draw it, pieces and all 2026-09-23 23:08:09 +00:00