From f4068946ed1041aab05df2dd691716fbb6447e74 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 6 Sep 2026 13:15:04 -0400 Subject: [PATCH] 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 --- .gitea/workflows/build.yaml | 8 ---- client/src/main.ts | 59 +++--------------------------- deploy/chart/templates/worlds.yaml | 2 +- playwright.config.ts | 11 +----- server/internal/transport/http.go | 2 - tests/game.spec.ts | 6 +-- 6 files changed, 10 insertions(+), 78 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 43b701c..07a5a53 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -36,14 +36,6 @@ jobs: run: go vet ./... - run: npx playwright install --with-deps chromium - run: npm run test:e2e - - name: Upload Playwright results on failure - if: failure() - uses: actions/upload-artifact@v4 - with: - name: playwright-report - path: test-results/ - retention-days: 7 - if-no-files-found: ignore - uses: azure/setup-helm@v4.3.0 - run: | helm lint deploy/chart diff --git a/client/src/main.ts b/client/src/main.ts index d560eb7..9f8e85b 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -18,28 +18,6 @@ let noticeTimer: ReturnType; 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(); let requestedClose = false; const keys = new Set(); 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('[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'; }); diff --git a/deploy/chart/templates/worlds.yaml b/deploy/chart/templates/worlds.yaml index 1b593ea..e19dc76 100644 --- a/deploy/chart/templates/worlds.yaml +++ b/deploy/chart/templates/worlds.yaml @@ -9,7 +9,7 @@ {{- end -}} {{- if and .Values.portal.host (not (hasKey $ids .Values.portal.primaryWorld)) -}}{{- fail "portal.primaryWorld must exist in worlds" -}}{{- end -}} {{- range .Values.worlds }} -{{ $host := default .host $root.Values.portal.host -}} +{{- $host := default .host $root.Values.portal.host -}} {{- $primary := eq .id $root.Values.portal.primaryWorld -}} --- apiVersion: apps/v1 diff --git a/playwright.config.ts b/playwright.config.ts index 213ea19..11282c6 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -2,16 +2,7 @@ import { defineConfig } from '@playwright/test'; export default defineConfig({ testDir: './tests', timeout: 45000, workers: 1, fullyParallel: false, - use: { baseURL: 'http://127.0.0.1:18089', browserName: 'chromium', channel: process.env.PLAYWRIGHT_CHANNEL || undefined, headless: true, screenshot: 'only-on-failure', trace: 'retain-on-failure', launchOptions: { args: [ - '--use-angle=swiftshader', '--enable-unsafe-swiftshader', - // The CI runner's headless page was getting treated as backgrounded/occluded, - // which throttles requestAnimationFrame to ~1Hz or worse -- turning every - // frame-driven client action (movement steering, gather/attack retries) into a - // multi-second-per-tick crawl and blowing well past assertion timeouts even - // though the server side was fine. These are the standard flags to keep a - // headless/automated tab running at full rAF rate regardless of visibility. - '--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-renderer-backgrounding', - ] } }, + use: { baseURL: 'http://127.0.0.1:18089', browserName: 'chromium', channel: process.env.PLAYWRIGHT_CHANNEL || undefined, headless: true, screenshot: 'only-on-failure', trace: 'retain-on-failure', launchOptions: { args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader'] } }, webServer: { command: 'node tools/dev-server.mjs', url: 'http://127.0.0.1:18089/readyz', timeout: 180000, reuseExistingServer: false, diff --git a/server/internal/transport/http.go b/server/internal/transport/http.go index ecf19e3..79ee6f3 100644 --- a/server/internal/transport/http.go +++ b/server/internal/transport/http.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "io" - "log/slog" "net" "net/http" "os" @@ -434,7 +433,6 @@ func (h *HTTP) socket(w http.ResponseWriter, r *http.Request) { } if err = h.s.world.Intent(id, intent); err != nil { c.Message = err.Error() - slog.Warn("intent rejected", "character", id, "op", intent.Op, "target", intent.Target, "error", err) } h.s.mu.Unlock() } diff --git a/tests/game.spec.ts b/tests/game.spec.ts index 02eb16e..2016aab 100644 --- a/tests/game.spec.ts +++ b/tests/game.spec.ts @@ -19,8 +19,7 @@ test('desktop renders models, moves authoritatively, gathers, and reconnects', a await page.keyboard.down('d'); await page.waitForTimeout(1000); await page.keyboard.up('d'); await expect.poll(() => page.evaluate(() => (window as any).__aeternalis.snapshot.self.entity.position.x)).toBeGreaterThan(before.x + 3); await page.getByRole('button', { name: 'Gather', exact: true }).click(); - // Same slow-CI-hardware headroom as the boss-attack poll below (bumped 15s -> 20s). - await expect.poll(() => page.evaluate(() => Object.values((window as any).__aeternalis.snapshot.self.skills).reduce((sum: number, n: any) => sum + n, 0)), { timeout: 20000 }).toBeGreaterThan(0); + await expect.poll(() => page.evaluate(() => Object.values((window as any).__aeternalis.snapshot.self.skills).reduce((sum: number, n: any) => sum + n, 0)), { timeout: 15000 }).toBeGreaterThan(0); await page.getByRole('button', { name: 'Inventory and crafting' }).click(); await expect(page.locator('#inventory')).toBeVisible(); await expect(page.locator('#inventory-items')).toContainText('Knife'); @@ -83,8 +82,7 @@ test('boss event is visible and accepts server-authoritative combat', async ({ p await page.getByRole('button', { name: 'Close display settings' }).click(); const hp = await page.evaluate(() => (window as any).__aeternalis.snapshot.world.bossHp); await page.getByRole('button', { name: 'Target Harbinger', exact: true }).click(); - // A little more slow-CI-hardware headroom on top of the prior 15s -> 20s bump. - await expect.poll(() => page.evaluate(() => (window as any).__aeternalis.snapshot.world.bossHp), { timeout: 25000 }).toBeLessThan(hp); + await expect.poll(() => page.evaluate(() => (window as any).__aeternalis.snapshot.world.bossHp), { timeout: 20000 }).toBeLessThan(hp); await expect(page.locator('#boss-bar')).toBeVisible(); await page.screenshot({ path: 'test-results/boss.png' }); });