AGENTS.md instructions for /home/pjensen/Repos/JSHack <INSTRUCTIONS>…
- User
AGENTS.md instructions for /home/pjensen/Repos/JSHack
--- project-doc ---
AGENTS.md - JSHack Field Manual
JSHack is a zero-dependency browser roguelike: pure JavaScript, pure ES modules, ECS architecture, Deno tooling. This file is optimized for coding agents. Prefer the commands below over manual spelunking.
Deeper docs:
- README.md
- SEPARATION_MANIFEST.md
- RUNTIME_TOPOLOGY_DOCTRINE.md
- TEN_COMMANDMENTS.md
- ecs-js/AGENTS.md
Hard Laws
- No build step. Pure ES modules. No webpack, babel, JSX, TypeScript, or bundling.
- Deno, not Node. Tests and tools run with Deno. Default test command:
deno test --allow-read. - JavaScript only. Keep source as
.js/.mjs. - Mobile-first. Touch is primary; desktop keyboard is secondary.
- Separation is law.
rules/never importsdisplay/orbridge/;display/never importsrules/;bridge/projects read-only rule state. - No system-to-system calls. Systems communicate with
world.emit/world.on; scheduler owns ordering. - New events use concrete event classes. Any new event contract must define
a concrete
EcsEventclass and emit an instance withworld.emit(new Event(...)). Do not introduce string-only events or parallel string re-emits for new contracts. - Touched listener installers use canonical extensions. Any new listener
installer, or any existing listener installer touched during a task, must use
defineExtension(...)andworld.install(...)for idempotent installation. Do not add new bespoke symbol-guard installers. - No swallowed event failures. Do not add
emitSafe-style wrappers aroundworld.emit.
- User
<environment_context> /home/pjensen/Repos/JSHack bash <current_date>2026-06-13</current_date> America/New_York <workspace_roots>/home/pjensen/Repos/JSHack</workspace_roots><permission_profile type="managed"><file_system type="restricted">:root/home/pjensen/Repos/JSHack:slash_tmp:tmpdir/home/pjensen/Repos/JSHack/.git/home/pjensen/Repos/JSHack/.agents/home/pjensen/Repos/JSHack/.codex</file_system></permission_profile> </environment_context>
- User
we have some failing tests, please explain why they are failing
initDungeon generates floor with tile data => ./tests/floor.test.mjs:10:6 initDungeon creates DungeonState with floorEntityIds => ./tests/floor.test.mjs:19:6 spawn position is on a walkable tile => ./tests/floor.test.mjs:34:6 generateFloor is deterministic => ./tests/floor.test.mjs:42:6 floor loads exactly the chunks described by the floor extent => ./tests/floor.test.mjs:73:6 floor boundary does not expose walkable tiles into unloaded void => ./tests/floor.test.mjs:97:6 generateFloor emits monotonic chunk progress callbacks => ./tests/floor.test.mjs:118:6 initDungeon forwards chunk progress callback => ./tests/floor.test.mjs:140:6
not sure precisely when they were introduced, but I do feel we should never again be pushing failing tests. Update AGENTS.md to stipulate that the FULL suite must run after a task is completed.
- Assistant
I’ll inspect the failing floor tests and the dungeon generation code first, then update the repo instructions with the full-suite requirement. After that I’ll run the relevant tests to capture the actual failure mode.
- Assistant
The listed tests all exercise the same path:
initDungeon()andgenerateFloor()in dungeon environment code. I’ve got the test expectations; now I’m checking the implementation and then I’ll run the focused file to get exact stack traces. - Assistant
One local convention I found in the included RTK file says shell commands should be prefixed with
rtk; I’ll use that for subsequent command runs. The implementation has a depth-0 overworld branch and a normal dungeon branch; your failing tests target depth 1, so I’m narrowing on that branch. - Assistant
The focused run shows one shared root cause, not eight independent failures: floor generation reaches materialization, then
buildCatalogItem()throwsUnknown item id: amulet_focus. I’m tracing where that spawn ID is authored and whether the catalog still defines it under another name. - Assistant
amulet_focusis defined insrc/content/items/necks.js, so the ID itself is valid. The failure is looking like a catalog registration/init problem in the test/runtime path: the generator selects a valid loot-table item, but the item content side-effect import has not populated the catalog before materialization. - Assistant
I found the immediate mismatch:
tests/floor.test.mjsimportsinstallContentMonsters.mjs, and that helper installs content without importingsrc/content/items/index.js. Other tests useinstallContentCatalog.mjs, which does import the item barrel beforeinstallContent(). I’m updatingAGENTS.mdnow to make the full runtime suite a required post-task check. - Assistant
AGENTS.mdnow has the full-suite requirement in both Hard Laws and the merge checklist. I’ll run the full runtime suite once so the final answer can say exactly what remains failing after this documentation-only change. - Assistant
The full suite is still running; so far it has progressed well past the floor tests and into later navigation/runtime tests. One side command using
rtk git diff -- ...misparsed the pathspec, so I’ll re-run the doc diff plainly after the suite finishes. - Assistant
Important wrinkle: the full suite imported the global test harness first, which loads item content, so it got past
floor.test.mjs. The focused file still fails in isolation because that file’s own setup helper only imports monsters; that means the failure is order-dependent test pollution, not invalid floor logic. - Assistant
The suite is still clean so far and is in the late transition/system tests. I’ll wait for the final summary before closing this out; the key explanation is already clear from the isolated failure stack.
- Assistant
The full runtime suite finished with 17 failures: the eight floor failures you listed, plus nine transition/inventory failures caused by
localStorageopening its backing database in this environment. I’ll grab the exact doc diff/line numbers now. - Assistant
Updated AGENTS.md to require
deno test --allow-read --no-checkafter every task, and added the same requirement to the merge checklist at AGENTS.md.The floor tests are all failing for the same reason:
generateFloor()materializes a spawned equipment item, callsbuildCatalogItem(world, "amulet_focus", ...), and the catalog lookup throwsUnknown item id: amulet_focus. The item itself exists insrc/content/items/necks.js, buttests/floor.test.mjsimportstests/helpers/installContentMonsters.mjs, which does not importsrc/content/items/index.jsbeforeinstallContent(). So the test setup installs content without loading item definitions first. UseinstallContentCatalog.mjsor make the monster helper also import the item barrel.Verification:
deno test --allow-read tests/floor.test.mjsfails with the eight listed errors. - User
fix the issues with an eye towards not letting the tests drag the project backwards. (e.g) fix the tests, or -- if it's really a bug, fix the bug.
- Assistant
I’ll fix the failures by classifying each as test setup/environment issue versus real runtime bug, then I’ll verify isolated tests and the full runtime suite. I’m using the repo’s
using-entireskill for provenance-aware exploration before editing. - Assistant
I’ll check the relevant history briefly, then make the smallest fixes: content setup should mirror runtime content loading, and cache clearing should tolerate unavailable browser storage in tests/Deno.
- Assistant
History confirms
installContent()intentionally expects all content files to be imported first; so the floor failure is a stale/incomplete test harness, not a reason to weaken loot/catalog behavior. For storage,clearFloorCache()is the only cache path not guarding localStorage access, while neighboring load/persist paths already catch failures. - Assistant
I’m going to change the shared monster test helper to import item definitions before
installContent(), matchingmain.jsstartup and the catalog helper. Separately, I’ll hardenclearFloorCache()so an unavailablelocalStoragedatabase cannot break in-memory cache cleanup or transition tests. - Assistant
The content helper now mirrors the runtime requirement that item DSL modules be imported before content installation. Next I’m updating the storage cleanup path without changing transition semantics.
- Assistant
Edits are in. I’m running the isolated failing files first so we catch regressions that the full-suite order might mask.
- Assistant
The previously failing isolated files now pass: floor, transition, and transition inventory. I’m running the full runtime suite now because the project rule we added requires it and it can expose order-dependent issues.
- Assistant
The full suite is still running and has passed through the previously failing floor area. I’ll keep it running to completion and report the final count.
- Assistant
The full suite is past the storage-heavy transition tests and still clean. Waiting for the final summary.
- Assistant
The full suite is in the final stretch and the formerly failing transition file is passing in-suite as well. I’ll poll once more for the final result.
- Assistant
The full runtime suite passed:
2354 passed | 0 failed. I’m doing a quick final status check so the summary is accurate. - Assistant
Fixed the failures without weakening runtime behavior.
Changed tests/helpers/installContentMonsters.mjs to import item content before
installContent(), matching runtime startup. That fixes theamulet_focusfailures by correcting test setup instead of relaxing catalog validation.Changed transition.js so
clearFloorCache()always clears in-memory caches and tolerates unavailablelocalStoragein Deno/test environments.Kept the AGENTS.md full-suite rule from the prior change at AGENTS.md.
Verification passed:
deno test --allow-read tests/floor.test.mjsdeno test --allow-read tests/transition.test.mjsdeno test --allow-read tests/transitionInventory.test.mjsdeno test --allow-read --no-check->2354 passed | 0 failed
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.