85 lines
3.1 KiB
Markdown
85 lines
3.1 KiB
Markdown
# Issue #122 Verification — Already Implemented on `main`
|
||
|
||
**Date:** 2025-04-18
|
||
**Status:** ✅ Fix already present on `main`; no code changes required.
|
||
**Closes:** #122
|
||
**Related (closed unmerged):** #153, #155
|
||
|
||
---
|
||
|
||
## Summary
|
||
|
||
Issue #122 requested that active/pending Unbuilding state suppresses the Drift alignment event UI so the player is never offered a contradictory choice mid-Unbuilding. The fix is **already implemented** on `main`; this document closes the loop by recording the evidence.
|
||
|
||
---
|
||
|
||
## Evidence on `main`
|
||
|
||
### `js/render.js` — `renderAlignment()` guard (lines 37–49)
|
||
|
||
```js
|
||
function renderAlignment() {
|
||
const container = document.getElementById('alignment-ui');
|
||
if (!container) return;
|
||
|
||
// Lines 41-44: hide #alignment-ui during active/completed Unbuilding
|
||
if (G.dismantleActive || G.dismantleComplete) {
|
||
container.innerHTML = '';
|
||
container.style.display = 'none';
|
||
return;
|
||
}
|
||
|
||
// Lines 47-49: preserve offered Unbuilding prompt instead of repainting normal drift UI
|
||
if (G.dismantleTriggered && !G.dismantleActive && !G.dismantleComplete && typeof Dismantle !== 'undefined' && Dismantle.triggered) {
|
||
Dismantle.renderChoice();
|
||
return;
|
||
}
|
||
// … normal drift alignment rendering follows …
|
||
}
|
||
```
|
||
|
||
| Lines | Purpose |
|
||
|----------|-------------------------------------------------------------------------|
|
||
| 41–44 | Hides `#alignment-ui` entirely when Unbuilding is active or complete. |
|
||
| 47–49 | When Unbuilding has been triggered (but not yet active), renders the Dismantle choice instead of the normal Drift alignment UI. |
|
||
|
||
### `tests/dismantle.test.cjs` — regression coverage (lines 246–276)
|
||
|
||
Two endgame tests already cover the exact scenario described in #122:
|
||
|
||
1. **`renderAlignment does not wipe the Unbuilding prompt after it is offered`** (line 246)
|
||
– Verifies that once the Unbuilding prompt is rendered, a subsequent `renderAlignment()` call does not clear it.
|
||
|
||
2. **`active Unbuilding suppresses pending alignment event UI`** (line 264)
|
||
– When `G.dismantleActive` is `true` and `G.pendingAlignment` is `true`, asserts that `#alignment-ui` is emptied and hidden — the exact fix requested in #122.
|
||
|
||
---
|
||
|
||
## Verification
|
||
|
||
```sh
|
||
node --test tests/dismantle.test.cjs
|
||
```
|
||
|
||
**Result:** 10 tests passed, including:
|
||
|
||
- ✅ `renderAlignment does not wipe the Unbuilding prompt after it is offered`
|
||
- ✅ `active Unbuilding suppresses pending alignment event UI`
|
||
|
||
---
|
||
|
||
## PR Trail
|
||
|
||
| PR | Status | Notes |
|
||
|-----|--------------------|-------------------------------------------------|
|
||
| #153 | Closed (unmerged) | Earlier verification attempt; superseded. |
|
||
| #155 | Closed (unmerged) | Earlier verification attempt; superseded. |
|
||
|
||
No open PR existed for #122. The fix itself landed directly on `main`; this PR ships the **missing verification artifact** so the issue can be closed honestly.
|
||
|
||
---
|
||
|
||
## Conclusion
|
||
|
||
No code changes are needed. The guard in `renderAlignment()` and the corresponding tests on `main` already satisfy #122.
|