fix(bots): a level-up box strands a standing body, and a test can pin the dice #248
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/level-up-strands-a-standing-bot"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two unrelated faults that happened to be next to each other on the board.
A level-up box strands a body that stands still (#242, #244)
#242 reported a fly fisher standing still for eight minutes — phase
working,skilling clock pinned at
0, nothing animating, theFishtimer stillregistered — and diagnosed it as the interaction being dropped when the spot
retired under it. That was a real fault too, and it is fixed separately at
e9b9747. It is not this one.The bot had levelled up. Interface
233binds into the modal slot onpurpose —
runnable?/1says no while it is up, so the action that earned thelevel is interrupted — and
World.Timersholds every:normaltimer at zero,retrying each tick until it may fire. The gathering loop is a
:normaltimer.A person clears the box with the Continue; a bot has no client, and nothing
else in the engine closes one. Measured: fifty ticks on, the timer has still
never run.
Three things make it worse than it reads:
that stopped, so the bank trip whose
Act.close/1would have cleared themodal as a side effect never comes.
with its statline already on — the bodies watched longest had nothing left to
level.
roll rather than a loop never being called. That is why #242 landed on the
retired spot.
World.Player.Modal.unbidden?/1is a predicate rather than a policy: itnames the one interface that arrives with no click behind it and decides
nothing, so a socket session neither asks nor is answered.
Bot.Session.dismiss/1closes it, on every encode rather than on a brain step,because a brain that has halted or is waiting out a long delay is still a body
with a screen in front of it. Only
233, by number — a bot opens chatboxmodals of its own, the make picker among them.
The test nearly shipped passing against the bug. Every modal is stamped with
the tile it was opened at and
Modal.present/1closes one the player hasstepped off, so a walking body clears its own box by accident within a step or
two; the first draft spawned a wanderer and was green either way. The bodies the
fault reaches are the ones standing still — every gatherer for as long as it is
working — so the test freezes the brain first, and it fails without the fix.
A test can pin the dice a loop rolls for itself (#119, #141)
Everything that turns on a roll takes its dice as an argument. The one entry
point that cannot is
run/2: the timer pass calls it and there is nowhere topass one from. Unpinned, the roll is a pure function of
--seed, so a testneeding the unlikely branch fails on whichever seeds land the other way —
World.Content.LightTest's retry assertion wanted a 65/256 failure and died onthree of the first twenty seeds, presenting as "passes alone, fails in the
suite" because adding any file reshuffles the order.
Contract.Skilling.pin/1supplies the roll,unpin/0gives it back. Theprocess dictionary rather than a global on purpose: a global would be
visible to every
async: truetest beside it, trading a seed lottery for ascheduling one. Which also states the limit rather than hiding it — a world
test's roll happens in the world's process, so pinning there changes nothing,
and a world test still has to count what its deadline buys and assert the pure
function when the answer is small.
The three other tests driving a
run/2(fish, chop, runecraft) take haltingbranches reached before any roll, so they are not seed-dependent and are left
alone.
Checks
mix dialyzer0 errors,mix format --check-formattedclean, Credo clean onthe touched files. Full bot suite plus content/contract/player: eleven failures,
every one already in
expected_red_tests_and_environments.md(
Bot.PkWorldTest, fourMerchantGoalTest, fivePkGoalTest,WildernessTest). That file is updated to mark theLightTestred closed.Closes #242, #244, #119, #141.
fix/level-up-strands-a-standing-botto fix(bots): a level-up box strands a standing body, and a test can pin the dice