task 7 fix1 - xopherdeep/do-it-for-the-xp GitHub Wiki

Task 7 — fix round 1 (from the task review, with the lead's rulings)

The review confirmed the Storm Temple's data (every item once, the Boss Key gate, the locked lobby stairs, the byte-identical regenerated temples, the layout-switch refresh). These fixes make the dress TOOL safe for the next seven temples. Do them in this order, TDD, one spec at a time, commit in small steps.

1. Pits land where the dungeon says (Important)

Review: "a hole becomes a pit with no targetLevel/targetCoords (dressRooms.ts:162) ... The engine drops a pit to the same cell on the floor below, else that floor's first stairs up (templeGraph.ts:297-311, hazards.ts) ... a displaced hole is dropped unless it lands on a circle (dressBoard.ts:297-303). Earth: the boss at B1 (0,0) is a 1x1 floor reached only by the lone hole at 1F (0,7) 'Skull Final Drop' — unreachable. Ice: the hole into the boss at B6 (16,0) is displaced and dropped. Moon: the pit at 5F (2,1) would land on 4F (2,1) instead of (2,2). Shadow: 'PoD Pit Room Blocked' drops onto a wall." RULING: pits honour content.targetLevel / content.targetCoords everywhere: the engine's fall (fallInPit and wherever a pit moves the hero) and the solver's linkPits use them when present and keep today's fallback when absent (so every existing temple behaves the same). A target may be any lower floor, so no hole becomes a teleport. The dress step writes the target for every hole from the JSON's hole link. A displaced hole is never dropped: relocate it to the nearest free cell (adding a cell beside its source if none is free) and record the move. Spec: every JSON hole appears exactly once as a pit with the right target; engine + solver tests for a targeted pit, an untargeted pit (unchanged), and a pit into a 1x1 floor.

2. A boss reached by a fall still needs the Boss Key (Important)

Review: "the handoff's recipe (masterlocked on the side before the hole) can't work: the engine ignores masterlocked between ordinary rooms (locked.master is never read)". RULING: use the pattern the dressing already uses for stairs: when the boss's floor is entered only by a hole or teleport, land the fall in an added antechamber cell beside the boss, behind the Boss door (every side into the boss room is masterlocked, which the engine does honour). Spec: on a fixture where the boss floor is reached only by a hole, the solver cannot reach the boss without the Boss Key and can with it.

3. The e2e walk (Important)

RULING: one targeted attempt only: scope the three reveal selectors to the visible page (:visible, or the active ion-page). If it is green, done. If not, mark the spec's describe as describe.skip with a STATUS comment saying exactly what fails, and say so in the report; the lead files a follow-up. Do not iterate further. Stop any dev server you start.

4. Smaller fixes worth making now because they would repeat in every temple

  • Big-key doors between ordinary rooms (not into a boss room): write a plain door (the engine and solver treat them as plain anyway, but the Temple Creator shows a Boss Lock skull), and list them in classicReport(id).plainBigKeyDoors.
  • Multi-screen must-clear rooms: displaced stairs from a must-clear fight must not go to a sibling screen of the same LTTP room outside the seal (skip placeNearest tier 1 for them). Add a spec check that a must-clear room's fight cell separates the room's entries from its exits, or that the room is one screen.
  • Sparse floors: compact floors by moving cells whose four sides are all walls (reached only by a link) next to the used bounding box, before link targets are computed. Hera 3F must lose its empty rows.
  • R8 filter (ClassicTemples.spec.ts:41): instead of accepting any "has no stairs-… at" note, assert every flight's targetCoords lands on a stairs room of the opposite kind.
  • Bomb chests: the distance to a Bomb chest must respect locks (no chest behind a small lock), and only cracks that cut the boss off get one (the lead's ruling), not every crack on the frontier.
  • A temple with no empty cell (Storm): add ONE shop cell beside the entrance (grow the grid by one cell) so every temple sells Bombs and potions; record it as an added cell. No save/camp unless an empty cell exists.
  • ShippedTemplesAudit.spec.ts is exactly 500 lines and hard-codes toHaveLength(7): derive the count from SHIPPED_IDS and move the classic-temple block into ClassicTemples.spec.ts (or a new spec) so the next temple's edit does not push it over the budget.
  • importAllTemples.ts:13's header still says hero progress is "never read or written here": update it. The renamed importAllTemples.spec progress test never wires its fake store: make it real or remove it.
  • Race on first launch (useTemple.ts:95-96): openTemple must wait for ensureBuiltInTemples() before ensureTempleFresh, so the seed sync cannot forget a run under an open page.

Leave for later (do NOT do now)

  • GT Quad Pot's miniboss-only enemies (needs a converter field; the Moon temple handles it).
  • A content-only change to a shipped layout also resets runs (matches the design).

Gate

Specs: ClassicDress, ClassicTemples, ClassicTempleRefresh, ShippedTemplesAudit, ClassicDungeonJson, importAllTemples, TempleSolver, RoomInteractions (and any spec covering hazards.ts / the pit fall). Audit: npx --yes [email protected] audit --no-index --unroll > /tmp/audit-t7f.txt 2>&1, compare with the branch base the lead uses (no file you touch may newly appear under LINE_BUDGET_FILE, CONTROL_FLOW_INLINE_BOOLEAN, TYPE_COLOCATION, HOOK_RETURN_OVERLOAD), then git checkout -- chemx-ratchet.json. Regenerate storm-temple.ts with the fixed tool. Append a "Fix round 1" section to task-7-report.md (what changed per item, commands, output) and reply with the short status contract.

⚠️ **GitHub.com Fallback** ⚠️