Revert the six post-merge patch commits; back to the portal-merge state

Reverts the working tree for these six files to their state at 7c5cb78
(the control-portal merge, reconciled with the auto-deploy digest bump)
-- undoing c5b8361, 74ff146, b1a07b7, db3e5a8, 0bb3e4b, and 9b226f7.

Those six commits were reactive fixes chasing CI failures one at a
time; each one changed the failure mode without ever reaching a fully
green run, and the last one coincided with the browser session itself
crashing mid-test rather than a logic assertion failing. Reverting to
a clean, known point (right after the merge, before any of that
patching) rather than continuing to layer fixes on an unverified base.

Note: this reintroduces a real, independently-confirmed bug fixed by
db3e5a8 -- deploy/chart/templates/worlds.yaml's per-world loop is
missing a newline between iterations (a leading whitespace-trim on the
$host template variable eats it), which breaks `helm lint` /
`helm template` for any values file with more than one world. That
will fail again on the next push if it isn't re-applied.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-06 13:15:04 -04:00
co-authored by Claude Sonnet 5
parent 9b226f76cb
commit f4068946ed
6 changed files with 10 additions and 78 deletions
+6 -53
View File
@@ -18,28 +18,6 @@ let noticeTimer: ReturnType<typeof setTimeout>;
let inputElapsed = 0;
let walkTo: { x: number; z: number } | undefined;
let pendingAction: { op: string; target: string } | undefined;
let actionElapsed = 0;
// A gather target can stay legitimately, persistently unreachable for a long time (a
// depleted resource waits out a real respawn timer measured in minutes, not a stray
// frame) -- retrying it forever would starve everything else. But a *working* attack is
// mostly cooldown rejections between the hits that land, so "stuck" can't just mean
// "hasn't succeeded since the click": it has to mean no progress at all for a while.
// Track a per-target progress signal (target HP for attack, held-item count for
// gather/loot) and only give up once that's stopped moving for a wall-clock budget --
// not a frame/attempt count, since a throttled or backgrounded tab can go seconds
// between rendered frames, and counting attempts instead of real elapsed time let a
// "few tries" balloon into tens of real seconds.
let lastProgress: number | undefined;
let lastProgressAt = 0;
function progressSignature(): number | undefined {
if (!pendingAction || !snapshot) return undefined;
if (pendingAction.op === 'attack') {
if (pendingAction.target === 'boss') return snapshot.world.bossHp;
return snapshot.entities.find(e => e.id === pendingAction!.target)?.hp;
}
return Object.values(snapshot.self.inventory).reduce((a: number, b: number) => a + b, 0);
}
const avoidUntil = new Map<string, number>();
let requestedClose = false;
const keys = new Set<string>();
let view: WorldView;
@@ -64,18 +42,16 @@ function selection(entity?: Entity) {
}
function action(op: string) {
if (!snapshot) return;
const now = Date.now();
const kinds = op === 'attack' ? ['boss', 'sentinel'] : ['tree', 'ore', 'herb', 'corpse'];
let target = view.selected;
if (!target || !kinds.includes(target.kind) || (avoidUntil.get(target.id) ?? 0) > now) {
if (!target || !kinds.includes(target.kind)) {
const p = snapshot.self.entity.position;
target = snapshot.entities.filter(e => kinds.includes(e.kind) && (avoidUntil.get(e.id) ?? 0) <= now).sort((a, b) => Math.hypot(a.position.x - p.x, a.position.z - p.z) - Math.hypot(b.position.x - p.x, b.position.z - p.z))[0];
target = snapshot.entities.filter(e => kinds.includes(e.kind)).sort((a, b) => Math.hypot(a.position.x - p.x, a.position.z - p.z) - Math.hypot(b.position.x - p.x, b.position.z - p.z))[0];
}
if (!target) { notice('No target nearby.'); return; }
selection(target);
pendingAction = { op: target.kind === 'corpse' ? 'loot' : op, target: target.id };
walkTo = target.position;
lastProgress = undefined; lastProgressAt = Date.now();
}
function connect() {
requestedClose = false; sequence = 0;
@@ -181,31 +157,8 @@ async function boot() {
const p = snapshot.self.entity.position, dx = walkTo.x - p.x, dz = walkTo.z - p.z, distance = Math.hypot(dx, dz);
const target = snapshot.entities.find(e => e.id === pendingAction?.target);
const range = pendingAction ? pendingAction.op === 'attack' ? config.attackRange + (target?.kind === 'boss' ? 3 : -0.5) : config.gatherRange - 0.5 : 0.8;
if (distance <= range) {
if (!pendingAction) { walkTo = undefined; }
// A single fire-and-forget attempt can land a hair outside the authoritative
// server position (which may lag a stale/throttled client render) and get
// rejected with no second chance, so retry at a conservative cadence (well
// under the intent rate limit) instead of giving up forever -- the server's
// own action cooldown makes repeat attempts harmless. But a target can also be
// legitimately, persistently rejected (a depleted resource waits out a real
// respawn timer), so give up on THIS target after a wall-clock budget and let
// the next action() pick a fresh one rather than retrying a lost cause forever.
else {
actionElapsed += dt;
if (actionElapsed >= 0.3) {
actionElapsed = 0;
const sig = progressSignature();
if (sig !== undefined && sig !== lastProgress) { lastProgress = sig; lastProgressAt = Date.now(); }
if (Date.now() - lastProgressAt > 5000) {
avoidUntil.set(pendingAction.target, Date.now() + 8000);
const retryOp = pendingAction.op === 'loot' ? 'gather' : pendingAction.op;
walkTo = undefined; pendingAction = undefined;
action(retryOp);
} else { send(pendingAction.op, pendingAction.target); }
}
}
} else { x = dx / distance; z = dz / distance; actionElapsed = 0.3; }
if (distance <= range) { if (pendingAction) send(pendingAction.op, pendingAction.target); walkTo = undefined; pendingAction = undefined; }
else { x = dx / distance; z = dz / distance; }
}
view.moving = !!(x || z);
if (inputElapsed >= 0.05) { send('move', '', x, z); inputElapsed = 0; }
@@ -245,7 +198,7 @@ async function boot() {
for (const id of ['inventory', 'settings']) { $(`${id}-toggle`).onclick = () => { visible(id, $(id).hidden); visible('movement', $('inventory').hidden && $('settings').hidden && !!snapshot); if (id === 'inventory' && snapshot) inventory(snapshot.self); }; }
document.querySelectorAll<HTMLButtonElement>('[data-close]').forEach(button => button.onclick = () => visible(button.dataset.close!, false));
$('attack').onclick = () => action('attack'); $('gather').onclick = () => action('gather'); $('heal').onclick = () => send('heal'); $('keystone').onclick = () => send('return');
$('target-boss').onclick = () => { selection(snapshot?.entities.find(e => e.id === 'boss')); walkTo = { x: 0, z: 0 }; pendingAction = { op: 'attack', target: 'boss' }; lastProgress = undefined; lastProgressAt = Date.now(); };
$('target-boss').onclick = () => { selection(snapshot?.entities.find(e => e.id === 'boss')); walkTo = { x: 0, z: 0 }; pendingAction = { op: 'attack', target: 'boss' }; };
$('dev-boss').onclick = () => void api('/api/dev/boss', {}).catch(e => notice(e.message));
$('reconnect').onclick = () => location.reload();
$('new-character').onclick = () => { requestedClose = true; ws?.close(); location.reload(); };
@@ -274,6 +227,6 @@ async function boot() {
if (hit.entity) { selection(hit.entity); action(['boss', 'sentinel'].includes(hit.entity.kind) ? 'attack' : 'gather'); }
else if (hit.point) { selection(); walkTo = hit.point; pendingAction = undefined; }
});
Object.defineProperty(window, '__aeternalis', { value: { diagnostics: () => view.diagnostics(), get snapshot() { return snapshot; }, get walkTo() { return walkTo; }, get pendingAction() { return pendingAction; }, get keys() { return [...keys]; } }, configurable: true });
Object.defineProperty(window, '__aeternalis', { value: { diagnostics: () => view.diagnostics(), get snapshot() { return snapshot; } }, configurable: true });
}
boot().catch(error => { console.error(error); $('arrival-error').textContent = `Unable to enter the world: ${error.message}`; $('connection-status').textContent = 'Unavailable'; });