castle-web-cli 0.4.244 → 0.4.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +1 -0
- package/dist/api.js +13 -0
- package/dist/contentOriginTiming.d.ts +13 -0
- package/dist/contentOriginTiming.js +15 -0
- package/dist/imports.js +28 -6
- package/dist/index.js +20 -2
- package/dist/init.js +1 -1
- package/dist/projectState.d.ts +33 -0
- package/dist/projectState.js +97 -0
- package/dist/serve.d.ts +18 -0
- package/dist/serve.js +103 -2
- package/dist/serveSecurity.d.ts +105 -3
- package/dist/serveSecurity.js +500 -39
- package/dist/shell/assets/{index-DulbYIJm.js → index-Bec6LpAv.js} +87 -87
- package/dist/shell/index.html +1 -1
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/runtime.js +57 -0
- package/kits/hub-game/code/client/chrome.js +6 -1
- package/kits/hub-game/code/server/friendBests.js +8 -2
- package/kits/hub-game/code/server/hub.js +12 -2
- package/kits/hub-game/code/server/resumePose.js +30 -9
- package/kits/hub-game/code/server/writerLease.js +161 -17
- package/kits/hub-game/docs/contract.md +32 -11
- package/kits/hub-game/scripts/test-menu-client.mjs +7 -6
- package/kits/hub-game/scripts/test-menu-footer-dom.mjs +94 -0
- package/kits/hub-game/scripts/test-resume-pose.mjs +85 -0
- package/kits/hub-game/scripts/test-writer-lease-server.mjs +108 -4
- package/kits/hub-game/scripts/test-writer-lease.mjs +385 -1
- package/package.json +2 -2
|
@@ -294,7 +294,7 @@ of any of these. Every hook gets `hub`, the place's context, first:
|
|
|
294
294
|
| `hub.mark(playerId, { text, color })` | a coloured tag over a player's avatar for everyone: a team, who is it; `null` clears it (§11, v1.1) |
|
|
295
295
|
| `hub.wear(playerId, { kind, color, rarity })` | put a wearable on a player's avatar, kept on their account in every hub place where the host runs the hub: `kind` `"halo"`, `"aura"`, `"orbit"` or, v1.24, a hat `"hat-<id>"`, `color` `#rrggbb`, `rarity` 0-9; `null` takes it off; true when taken (§11, v1.4) |
|
|
296
296
|
| `hub.friendsAmong(playerId, userIds)` | v1.36: `Promise<string[]>`, the subset of candidate decimal user-id strings that are this connected player's friends (a guest's too: a guest is over 13 like any other player). Deduped, capped at 100; ghost applies mutual follows, age, blocks and the hub gate. Every refusal (including an unknown op), absent hub ops or failure resolves `[]`. Empty answers cached per player for 40 s, non-empty answers for 10 min; requests within that window intersect the cached answer with their candidates, and never send another op inside 31 s. v1.166: an account's first read in a session that comes back empty is cached 5 s and gets one early re-read even inside the 31 s gap; a read begun within that first read's minute holds the next op until the minute ends, so at most two ops go out in it (ghost allows two a minute per player per session); later empty answers keep 40 s and the gap. Optional per-place `freshFriends: true` (v1.99) instead bounds both TTLs to 31 s and exposes the server-only freshness flag. On by use, no manifest key |
|
|
297
|
-
| `hub.friendBests(key, { better: 'higher' or 'lower' })` | v1.57: a helper with `report(playerId, best): Promise<void>` and `friendFor(playerId): Promise<{ userId, username, best } or null>`. Signed-in players only, finite numbers. `report` keeps each user's best in a top-100 deck-storage index `fb:<key>` of `{ userId, username, best, at }` (20-character username, `at` wall-clock milliseconds), through one serialized writer per key per layer. Cross-layer lost updates are acceptable. Index reads cache for 60 s; `friendFor` caches empty membership for 40 s (v1.166: an empty answer from the session's first minute only until `friendsAmong` may read again, 5 s after the provisional first) and non-empty membership for 10 min per player per visit, and selects the best friend from the index. Leaving clears the visit cache. Both methods swallow failures. Keys are 1–60 letters, digits, `_`, `.`, `:`, `-`; use one direction per key. No manifest key, reads or writes until used |
|
|
297
|
+
| `hub.friendBests(key, { better: 'higher' or 'lower' })` | v1.57: a helper with `report(playerId, best): Promise<void>` and `friendFor(playerId): Promise<{ userId, username, best } or null>`. Signed-in players only, finite numbers. `report` keeps each user's best in a top-100 deck-storage index `fb:<key>` of `{ userId, username, best, at }` (20-character username, `at` wall-clock milliseconds), through one serialized writer per key per layer. Cross-layer lost updates are acceptable. Index reads cache for 60 s; `friendFor` caches empty membership for 40 s (v1.166: an empty answer from the session's first minute only until `friendsAmong` may read again, 5 s after the provisional first) and non-empty membership for 10 min per player per visit, and selects the best friend from the index. Leaving clears the visit cache. With a writer lease on (§"Writer leases"), `report(playerId, best, saves?)` writes the index through `saves` when given (a `hub.saves.deck` view, taken when the best was made) or else the account's `hub.saves.deck(userId)` view at the call, so a best whose claim has since been replaced is never written; without a lease it writes the raw deck store as before. Both methods swallow failures. Keys are 1–60 letters, digits, `_`, `.`, `:`, `-`; use one direction per key. No manifest key, reads or writes until used |
|
|
298
298
|
| `hub.leaving(playerId, text)` | v1.52: the line this player reads when leaving this place; a string, trimmed and cut at 120 characters, `null` or empty clears it. The latest call wins; true when taken, otherwise false and warn once. Sent to this player alone, only on change; never in a snapshot (§5) |
|
|
299
299
|
| `hub.tryOn(playerId, { kind, color, rarity } \| null)` | v1.28: show a wearable on a player in this place only, instead of the one they own, until `null`, their leaving or the place's end. Never saved: nothing goes to ghost, the wearable on the account is neither read nor changed, and no other place hears of it. The same shape and refusals as `hub.wear`; true when taken (§11) |
|
|
300
300
|
| `hub.role(playerId, spec \| null)` | v1.157: set a visit-only role `{ id, label, color, hat?, top?, tool? }`; true when taken, false and logged once when refused. Null or no second argument clears; no host calls (§11) |
|
|
@@ -4137,23 +4137,38 @@ fences this one's later saves. Reset/undo also loses the writer, and so does a
|
|
|
4137
4137
|
claim the platform refuses, or one still failing after 20 seconds. A lost
|
|
4138
4138
|
account stays lost on a same-playerId resume, or while another connected visit
|
|
4139
4139
|
of that account remains here. If a fresh connection has a new playerId and all
|
|
4140
|
-
other visits of its
|
|
4140
|
+
other visits of its account are only retained, the kit first forgets those
|
|
4141
4141
|
visits through ordinary leave cleanup (including the deck's `leave` hook), then
|
|
4142
|
-
joins the new visit
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4142
|
+
joins the new visit. A lost account claims anew before its arrival hooks run; a
|
|
4143
|
+
held one is revalidated (a transient failure retried for up to 20 seconds), and
|
|
4144
|
+
if another instance took it meanwhile the visit claims anew without the notice.
|
|
4145
|
+
Only a check that answers keeps the claim: one refused, or still failing after
|
|
4146
|
+
20 seconds, also claims anew, so the arrival never loads under a claim it may
|
|
4147
|
+
have lost; writes the previous visit already queued go first, each under its own
|
|
4148
|
+
fence, including ones queued while earlier ones were in flight. A check that
|
|
4149
|
+
settles after every connected visit of the account here has gone (a visit held
|
|
4150
|
+
only for `resumePose` counts as gone) never claims anew, so it cannot take the
|
|
4151
|
+
account from another instance; a claim still retrying stops once no visit of the
|
|
4152
|
+
account remains here.
|
|
4153
|
+
A `resumePose` place ends a replaced held visit's pose under its own claim first.
|
|
4154
|
+
Views made while the claim revalidates follow its outcome. A place must reload the account's saves through
|
|
4155
|
+
`hub.saves` on that fresh arrival; `get`/`list` wait for the claim. Once the kit
|
|
4156
|
+
has forgotten every visit, a visit back also claims anew.
|
|
4146
4157
|
The last departure of a held account keeps the lease for 60 seconds for end
|
|
4147
|
-
saves. A host with no save API (`UNKNOWN_COMMAND`, or a non-retryable
|
|
4158
|
+
saves; a visit back inside that window revalidates it the same way. A host with no save API (`UNKNOWN_COMMAND`, or a non-retryable
|
|
4148
4159
|
`CAULDRON_STORAGE_UNAVAILABLE`) saves as before, without a lease.
|
|
4149
4160
|
|
|
4150
4161
|
`hub.saves` exposes `enabled`, `deck(userId)`, `fence(userId)`, `ready(userId)`,
|
|
4151
4162
|
`lost(userId)`, and `onLost(fn)` (called with the user ID; returns unsubscribe).
|
|
4152
4163
|
`deck` returns the raw deck store by identity when disabled or when the host
|
|
4153
|
-
lacks root `claim`/`transaction`. Otherwise its `get`/`list` wait for the claim
|
|
4164
|
+
lacks root `claim`/`transaction`. Otherwise its `get`/`list`/`snapshot` wait for the claim
|
|
4154
4165
|
to commit or give up; `set`/`remove`/`increment`/`transaction`/`conditionalWrite`
|
|
4155
|
-
fence and run in account order.
|
|
4156
|
-
|
|
4166
|
+
fence and run in account order. A view is bound to the claim current when it was
|
|
4167
|
+
made: once the account is claimed anew here, writes through an older view reject
|
|
4168
|
+
with `CAULDRON_STORAGE_WRITER_LOST`, so a write a visit queued never lands under a
|
|
4169
|
+
later visit's claim. Take the view when the write is queued.
|
|
4170
|
+
`user(userId)` provides the same wrapper for user-scoped writes. A `resumePose`
|
|
4171
|
+
place takes, ends and clears the durable pose through this view. Places must use these views for their per-player writes;
|
|
4157
4172
|
shared boards keep their ordinary stores. Root `session.storage` atomic calls
|
|
4158
4173
|
are not wrapped and need an explicit `fence`.
|
|
4159
4174
|
`hub.wallet` fences its own writes: a lost writer locks that account's wallet
|
|
@@ -4164,7 +4179,9 @@ and shows a persistent personal HUD line: “You're playing somewhere else, so
|
|
|
4164
4179
|
progress here isn't saved.” Repeated fences fail locally. The fence and the
|
|
4165
4180
|
ordinary write are separate requests: a write already past its fence when
|
|
4166
4181
|
another instance claims and loads can still land. This one-round-trip window
|
|
4167
|
-
remains; the lease does not make ordinary saves atomic.
|
|
4182
|
+
remains; the lease does not make ordinary saves atomic. The platform cannot close it yet: ordinary
|
|
4183
|
+
`set`/`remove`/`increment` take no writer check, and `transaction`/`conditionalWrite`
|
|
4184
|
+
write only managed targets.
|
|
4168
4185
|
|
|
4169
4186
|
### Town pose retention (v1.98)
|
|
4170
4187
|
|
|
@@ -5425,6 +5442,10 @@ a deck written before them remains valid.
|
|
|
5425
5442
|
| 2026-10-25 (v1.190) | §8 `hub.hold(playerId, at?, facingDeg?, { turnCamera: true })`: the held player is sent `hub-hold-face` with the held facing on the hold and again at `hub.release`, and their client turns as `hub-jumped` does (the camera to `PI - facing`; under the orbit key the avatar via `faceRequest`). A later hold without the option takes the release turn away; other ends of a hold turn nothing. Absent the option, holds, the wire and v1.85's rule are unchanged. The native host mirrors the turn. |
|
|
5426
5443
|
| 2026-10-25 (v1.191) | §4/§6 `hub.drop(playerId)` with an explicit id always sends that player `hub-drop` when they are in the place, even with no hold the place registered (then without `actor`), so a client holding an object the server never heard of lets go. `hub.drop()` with no id, the return value (registered holds ended) and grab budgets are unchanged. |
|
|
5427
5444
|
| 2026-10-25 (v1.192) | Writer leases: `writerLease: true` (the hub block or a named place; only `true` or absent) makes the newest instance to claim an account the only one that saves it. Each account claims its own empty user target (`hub:writer:`) once per instance; another instance's claim fences this one, whose later per-player writes reject with `CAULDRON_STORAGE_WRITER_LOST` (no network call) and whose visits see the personal HUD line "You're playing somewhere else, so progress here isn't saved." A claim refused, still failing after 20 s, or a reset/undo also loses the writer; the last departure keeps the lease 60 s for end saves. A fresh connection (new player id) of a lost account with no other connected visit here forgets that account's retained visits through ordinary leave cleanup (the deck's `leave` hook included) and claims anew before its arrival hooks; a same-player-id resume, or a fresh visit beside a connected lost one, stays lost. `hub.saves` adds `enabled`, `deck(userId)`, `user(userId)`, `fence(userId)`, `ready(userId)`, `lost(userId)` and `onLost(fn)`; places route per-player writes through `deck`/`user`, `fence` before root `session.storage` atomic calls, and reload an account's saves on every fresh arrival (`get`/`list` wait for the claim); `hub.wallet` fences its own writes. Compatibility: absent, nothing changes (raw stores by identity, no claim, no notice, retention as before); a host without root `claim`/`transaction`, or one answering `UNKNOWN_COMMAND` or a non-retryable `CAULDRON_STORAGE_UNAVAILABLE`, saves as before without a lease. Server-only: no client manifest key or wire field (the notice uses the existing `hub-hud`). A write already past its fence when another instance claims can still land (about one round trip). No deck opts in yet. |
|
|
5445
|
+
| 2026-11-18 (v1.222) | Writer leases (server-only, no wire or manifest change): a fresh connection whose account has no connected visit here forgets that account's retained visits whether or not it is lost, and a visit back to a held claim (retained visits, or the 60 s end-save window) revalidates it; a claim another instance took meanwhile is replaced silently instead of losing the fresh visit. `hub.saves.deck`/`user` views are bound to the claim current when made, so a superseded visit's queued writes reject with `CAULDRON_STORAGE_WRITER_LOST`. `resumePose` takes, ends and clears its durable pose through the lease view, so a fenced instance no longer moves the pose revision. No deck opts in yet. |
|
|
5446
|
+
| 2026-11-18 (v1.223) | Writer leases (server-only, no wire or manifest change): a lone visit back that arrives while an earlier visit's revalidation is still out checks the claim again once that round settles (on whichever claim it settled), so a check from before another instance's takeover never lets the return proceed only to lose its first save. `resumePose` takes its snapshot through the lease view too, so it reads only once the claim settles and keeps a pose the previous writer saved just before; its 5 s read budget starts once the claim has settled. An older pending round that resumes on a replacement claim a newer arrival is already checking waits for that round and keeps the claim it found; it never inherits a claim that round reopens. A take holds its queue place at once, so an end asked while it waits for the claim runs after it. Without `writerLease` nothing changes. No deck opts in yet. |
|
|
5447
|
+
| 2026-11-18 (v1.224) | Writer leases (server-only): `await hub.saves.holds(view)` tells whether the claim a save view writes through is still active and has not been lost, after pending claim checks settle. Unrecognized views and lease-off stores answer true. No manifest or wire change. |
|
|
5448
|
+
| 2026-11-18 (v1.225) | Writer leases (server-only): a lone visit back whose claim check is refused, or still failing after 20 s, claims anew like a taken claim instead of keeping a claim its first save may find lost; writes already queued under the old claim go first under their own fences, a check that settles after the account's connected visits here have all gone (held visits count as gone) never claims anew (taken or not), and a claim still retrying stops once no visit of the account remains. `friendBests` `report(playerId, best, saves?)` under a lease writes the `fb:<key>` index through the given `hub.saves` view (else the account's view at the call), so a best whose claim was replaced never reaches the index. The write-after-fence window stays open: the platform has no writer check on ordinary writes. Without `writerLease` nothing changes. No manifest or wire change. |
|
|
5428
5449
|
| 2026-10-25 (v1.193) | Town purse paid ledger: the Town deck's scope gains `paid:<userId>:<paymentId>`, an integer tokens count for one once-only payment, set once (a repeatable `set`) and never lowered or removed. Payment ids are the fixed list `bell:1`..`bell:7`, `bell:encore:1`..`bell:encore:7` and `errand:cat` (hub-town `tokens.js` `PAID`, T9). A balance is `tokens:<userId>` plus every ledger row, less hat prices and `spent:<userId>`; the Town's wardrobe read and the House's `chirpPurchases` funds read the rows by key. Each payment marks its old claim (`<earn key>:ledger`), raises it, then sets its row, so a layer on older code reads it as claimed. Ghost adds `paid` to `HUB_TOWN_PLAYER_NAMESPACES` (door-deck reads) and to the hub user reset. Compatibility: absent rows, the balance is exactly the old one; an older Town or House reader, or a Ghost without the namespace, shows a lower balance, never a higher one; this House against a Ghost without the namespace has its funds read refused, so Ghost lands first. Gifts, the day's bonuses and game results keep the old claim-then-credit path. No manifest key, wire field or SDK change. |
|
|
5429
5450
|
| 2026-10-25 (v1.187) | §9 Action chips: every place draws its `hub.actions` offers on the action overflow rail. A landscape place without `hub.safeInsets` or the `hubActionOverflow` scene key leaves the bottom-right column, which trimmed offers from the top with no sign, for the rail portrait and safe-inset places already used: one row, two rows, the first offer and More, then Actions, with a sheet listing all. At 844 × 390 three short offers stand in one row; in a crowded 509 × 218 frame an offer the column dropped is now behind More. The rail now also yields to open panels, sounds the chip cue on a press and leaves no focus behind after a pointer press, as the column did, in every place. The scene key is a no-op. No wire field. |
|
|
5430
5451
|
| 2026-10-25 | Chat with Chirp: the chat flight holds the companion on the sightline between the camera and the player, at the depth where its paper is about a tenth of view height (the active lens, as the show pose is sized), facing the camera, instead of 1.3 m beyond the player where a 6 m orbit (and more so the tablet camera) drew it tiny. Panel lift, 0.9 m camera clearance and closing back to following are unchanged; a camera too close behind the player, or facing away, keeps the old spot. No version, manifest or wire change |
|
|
@@ -206,7 +206,7 @@ test('buffer before WORLD, opt-in only, stale versions ignored, place change cle
|
|
|
206
206
|
test('lazy sheet, sections including empty sections, square phone touch tiles, scroll, note and selection', () => {
|
|
207
207
|
const r = rig(), count = r.dom.made.length; r.draw(null); assert.equal(r.dom.made.length, count); assert.deepEqual(r.locks, []);
|
|
208
208
|
r.draw(); const card = sheet(r.dom), blue = tile(r.dom, 'blue'), red = tile(r.dom, 'red');
|
|
209
|
-
assert.equal(card.attrs.role, 'dialog'); assert.equal(card.attrs['aria-label'], 'Wardrobe'); assert.equal(card.style.maxHeight, 'min(max(
|
|
209
|
+
assert.equal(card.attrs.role, 'dialog'); assert.equal(card.attrs['aria-label'], 'Wardrobe'); assert.equal(card.style.maxHeight, 'min(max(55dvh, 220px), calc(100dvh - 24px))');
|
|
210
210
|
assert.equal(card.style.bottom, '0'); assert.equal(card.style.pointerEvents, 'auto');
|
|
211
211
|
assert(card.style.background.startsWith('var(--castle-surface-'));
|
|
212
212
|
for (const text of ['Wardrobe', 'Pick a colour', 'Colours', 'Hats', 'Empty', 'Blue', 'Red', 'Cap', '✓']) assert(find(r.dom, text));
|
|
@@ -235,15 +235,16 @@ test('face caps the sheet at 40 percent, absent face preserves CSS and replaceme
|
|
|
235
235
|
@media (prefers-reduced-motion: reduce) { .hub-menu-tile:not(:disabled):active, .hub-menu-tile.is-pressed { transform: none; } }
|
|
236
236
|
@media (max-width: 600px) { .hub-menu-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)) !important; } }
|
|
237
237
|
@media (max-width: 340px) { .hub-menu-grid { grid-template-columns: repeat(3, minmax(64px, 1fr)) !important; } }
|
|
238
|
-
@supports (height: 1dvh) { .hub-menu-sheet { max-height: min(max(55dvh, 220px), calc(100dvh - 24px)) !important; } }
|
|
239
238
|
`;
|
|
240
239
|
r.draw(); const stylesBefore = { ...sheet(r.dom).styles };
|
|
241
240
|
for (const [i, value] of [spec, { ...spec, face: 0 }, spec, { ...spec, face: 90 }].entries()) {
|
|
242
241
|
r.draw({ n: i + 2, spec: value });
|
|
243
242
|
const card = sheet(r.dom), hasFace = Object.hasOwn(value, 'face');
|
|
244
243
|
// A short view keeps a row of choices: 220 px (150 px with face) at least, short of the view.
|
|
245
|
-
assert.deepEqual(card.styles, { ...stylesBefore, maxHeight: hasFace ? 'min(max(
|
|
246
|
-
assert.equal(card.children.find((node) => node.tag === 'style').textContent,
|
|
244
|
+
assert.deepEqual(card.styles, { ...stylesBefore, maxHeight: hasFace ? 'min(max(40dvh, 150px), calc(100dvh - 24px))' : 'min(max(55dvh, 220px), calc(100dvh - 24px))' });
|
|
245
|
+
assert.equal(card.children.find((node) => node.tag === 'style').textContent, cssBefore);
|
|
246
|
+
// The cap is the inline dvh declaration (the vh one where dvh is unknown), never an !important rule the safe-inset cap would lose to.
|
|
247
|
+
assert(!card.children.find((node) => node.tag === 'style').textContent.includes('max-height'));
|
|
247
248
|
const scroll = tile(r.dom, 'blue').parent.parent;
|
|
248
249
|
assert.equal(scroll.style.overflowY, 'auto'); assert.equal(scroll.style.minHeight, '0');
|
|
249
250
|
assert.equal(scroll.style.overscrollBehavior, 'contain'); assert.equal(scroll.style.touchAction, 'pan-y');
|
|
@@ -488,7 +489,7 @@ test('row menu has complete text columns, no icon slots and a pinned footer; clo
|
|
|
488
489
|
const rows = { title: 'Scores', presentation: 'rows', sections: [{ title: 'Rank · Player · Points', items: [{ id: 'record', label: '1st', readOnly: true, columns: ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts'] }] }], footer: [{ id: 'next', label: 'More scores' }, { id: 'leave', label: 'Back to town' }] };
|
|
489
490
|
r.draw({ n: 1, spec: rows });
|
|
490
491
|
const card = sheet(r.dom), record = tile(r.dom, 'record'), leave = tile(r.dom, 'leave');
|
|
491
|
-
assert.equal(card.style.maxHeight, 'calc(
|
|
492
|
+
assert.equal(card.style.maxHeight, 'calc(100dvh - 24px)');
|
|
492
493
|
assert.equal(hud.style.visibility, 'hidden'); assert.equal(prompt.style.visibility, 'hidden');
|
|
493
494
|
assert.equal(record.tag, 'div'); assert.deepEqual(record.children.map(c => c.textContent), ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts']);
|
|
494
495
|
assert.equal(record.style.gridTemplateColumns, 'minmax(0, 6em) minmax(4em, 1fr) minmax(0, max-content)');
|
|
@@ -496,7 +497,7 @@ test('row menu has complete text columns, no icon slots and a pinned footer; clo
|
|
|
496
497
|
assert.equal(leave.parent.parent, card); assert.equal(leave.parent.style.flexShrink, '0');
|
|
497
498
|
assert.equal(leave.textContent, 'Back to town'); assert.equal(leave.style.minHeight, '44px'); assert.equal(leave.style.aspectRatio, '');
|
|
498
499
|
tap(tile(r.dom, 'next')); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'next', n: 1 }]);
|
|
499
|
-
r.draw({ n: 2, spec: { ...rows, face: 0 } }); assert.equal(sheet(r.dom).style.maxHeight, 'min(max(
|
|
500
|
+
r.draw({ n: 2, spec: { ...rows, face: 0 } }); assert.equal(sheet(r.dom).style.maxHeight, 'min(max(40dvh, 150px), calc(100dvh - 24px))');
|
|
500
501
|
r.draw(null); assert.equal(hud.style.visibility, ''); assert.equal(prompt.style.visibility, '');
|
|
501
502
|
r.draw({ n: 3, spec }); assert.equal(tile(r.dom, 'blue').style.aspectRatio, '1');
|
|
502
503
|
r.chrome.dispose();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// A row sheet's footer (a shop's Buy / Back) stays inside the play frame at
|
|
2
|
+
// every size, in the real CSS cascade with the safe-inset layout on. On a
|
|
3
|
+
// short frame (the 497x213 a 844x390 landscape browser gives an embedded deck)
|
|
4
|
+
// the safe pass caps the sheet's height and moves it; the sheet's own height
|
|
5
|
+
// rule once out-ranked that cap while the move still applied, so the footer
|
|
6
|
+
// left the frame and a tap on Buy hit the page around it.
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import { readFile } from 'node:fs/promises';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { chromium } from 'playwright-core';
|
|
11
|
+
import { launchChromium } from '../../../experiments/hub-town/qa/launch.mjs';
|
|
12
|
+
|
|
13
|
+
const root = new URL('../../../', import.meta.url);
|
|
14
|
+
// Web embeds (short landscape, portrait), the Android app's portrait card
|
|
15
|
+
// (full width at 800:1120) and its fullscreen landscape, and a smaller frame.
|
|
16
|
+
const SIZES = [[497, 213], [574, 246], [352, 623], [360, 504], [411, 575], [800, 360], [914, 411], [640, 200]];
|
|
17
|
+
// The confirm sheet as a shop sends it (hub-liferp `confirmMenu`).
|
|
18
|
+
const CONFIRM = {
|
|
19
|
+
title: 'Furniture', note: 'You have $150', presentation: 'rows',
|
|
20
|
+
sections: [{ title: 'Buy this?', items: [{ id: 'furn-plant', label: 'Plant', columns: ['Plant', 'Leafy pot plant', '$20'], readOnly: true }] }],
|
|
21
|
+
footer: [{ id: 'buy', label: 'Buy $20' }, { id: 'back', label: 'Back' }],
|
|
22
|
+
};
|
|
23
|
+
const FACED = { ...CONFIRM, face: 0 };
|
|
24
|
+
const browser = await launchChromium(chromium, { executablePath: process.env.CHROME });
|
|
25
|
+
try {
|
|
26
|
+
const page = await browser.newPage();
|
|
27
|
+
await page.route('**/*', async route => {
|
|
28
|
+
const url = new URL(route.request().url());
|
|
29
|
+
assert.equal(url.origin, 'http://layout.test');
|
|
30
|
+
if (url.pathname === '/') {
|
|
31
|
+
return route.fulfill({ contentType: 'text/html', body: '<script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js"}}</script><body style="margin:0"></body>' });
|
|
32
|
+
}
|
|
33
|
+
const file = new URL(`.${url.pathname}`, root);
|
|
34
|
+
assert(fileURLToPath(file).startsWith(fileURLToPath(root)));
|
|
35
|
+
await route.fulfill({ contentType: 'text/javascript', body: await readFile(file, 'utf8') });
|
|
36
|
+
});
|
|
37
|
+
let checks = 0;
|
|
38
|
+
for (const [width, height] of SIZES) {
|
|
39
|
+
await page.setViewportSize({ width, height });
|
|
40
|
+
await page.goto('http://layout.test/');
|
|
41
|
+
for (const [name, spec, showHud] of [['confirm', CONFIRM, false], ['faced confirm', FACED, false], ['confirm under the HUD', CONFIRM, true], ['faced confirm under the HUD', FACED, true]]) {
|
|
42
|
+
const seen = await page.evaluate(async ({ spec, showHud }) => {
|
|
43
|
+
const { makeChrome } = await import('/kits/hub-game/code/client/chrome.js');
|
|
44
|
+
const chrome = makeChrome({ avatarCount: 1, onBack() {}, onAvatar() {}, safeInsets: true });
|
|
45
|
+
try {
|
|
46
|
+
chrome.setHudClear(true);
|
|
47
|
+
chrome.setHud({ big: '$150', text: 'Step up to the counter' }, null);
|
|
48
|
+
chrome.setMenu({ n: 1, spec }, () => {});
|
|
49
|
+
// Live Hollowbrook (iWhMzrJZV6hF, Nov 18) shows its cash HUD over an
|
|
50
|
+
// open row sheet; that HUD's band is what leaves the sheet a short
|
|
51
|
+
// place under the host corners. Emulate the state seen there.
|
|
52
|
+
if (showHud) document.querySelector('[data-hub-copy]').parentElement.style.visibility = '';
|
|
53
|
+
for (let i = 0; i < 3; i++) {
|
|
54
|
+
chrome.flushSafeInsets();
|
|
55
|
+
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
56
|
+
chrome.frameSafeInsets();
|
|
57
|
+
}
|
|
58
|
+
const sheet = document.querySelector('[data-hub="menu"]');
|
|
59
|
+
const s = sheet.getBoundingClientRect();
|
|
60
|
+
const buttons = ['buy', 'back'].map((id) => {
|
|
61
|
+
const b = sheet.querySelector(`[data-menu-footer] button[data-id="${id}"]`);
|
|
62
|
+
const r = b.getBoundingClientRect();
|
|
63
|
+
const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2);
|
|
64
|
+
// As first drawn, unscrolled: inside the sheet's own visible box too.
|
|
65
|
+
return { id, top: r.top, bottom: r.bottom, h: r.height, hits: hit === b || b.contains(hit), inSheet: r.top >= s.top - 0.5 && r.bottom <= s.bottom + 0.5 };
|
|
66
|
+
});
|
|
67
|
+
const hudNode = document.querySelector('[data-hub-copy]').parentElement;
|
|
68
|
+
return { hudShown: getComputedStyle(hudNode).visibility === 'visible', capped: sheet.hasAttribute('data-hub-safe-max-height'), moved: sheet.hasAttribute('data-hub-safe-translate'), boxes: chrome.layout().boxes, safe: sheet.getAttribute('style').match(/--hub-safe[^;]*/g), sheet: { top: s.top, bottom: s.bottom, h: s.height }, buttons };
|
|
69
|
+
} finally {
|
|
70
|
+
chrome.dispose();
|
|
71
|
+
}
|
|
72
|
+
}, { spec, showHud });
|
|
73
|
+
const at = `${width}x${height} ${name}: ${JSON.stringify(seen)}`;
|
|
74
|
+
// The live case: the shown HUD leaves the sheet a short place, so the
|
|
75
|
+
// safe pass both caps and moves it. Without both, the cascade this
|
|
76
|
+
// test guards was not exercised.
|
|
77
|
+
if (showHud) assert(seen.hudShown, `the HUD is shown, ${at}`);
|
|
78
|
+
if (showHud && width === 497 && height === 213 && name === 'confirm under the HUD') {
|
|
79
|
+
assert(seen.capped && seen.moved, `the safe pass caps and moves the sheet, ${at}`);
|
|
80
|
+
}
|
|
81
|
+
assert(seen.sheet.top >= -0.5 && seen.sheet.bottom <= height + 0.5, `sheet inside the frame, ${at}`);
|
|
82
|
+
for (const b of seen.buttons) {
|
|
83
|
+
assert(b.top >= -0.5 && b.bottom <= height + 0.5, `${b.id} inside the frame, ${at}`);
|
|
84
|
+
assert(b.h >= 43.5, `${b.id} keeps its 44 px target, ${at}`);
|
|
85
|
+
assert(b.hits, `a tap on ${b.id} reaches it, ${at}`);
|
|
86
|
+
assert(b.inSheet, `${b.id} shows without scrolling, ${at}`);
|
|
87
|
+
}
|
|
88
|
+
checks++;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
console.log(`menu footer: ${checks} real DOM size checks passed`);
|
|
92
|
+
} finally {
|
|
93
|
+
await browser.close();
|
|
94
|
+
}
|
|
@@ -140,3 +140,88 @@ void cleanupHung.prune();
|
|
|
140
140
|
void cleanupHung.prune();
|
|
141
141
|
assert.equal(cleanupCalls, 1, 'hung cleanup is single-flight');
|
|
142
142
|
console.log('resumePose: cursor coverage and hung cleanup single-flight passed');
|
|
143
|
+
|
|
144
|
+
// A leased take snapshots only once the claim settles: the previous writer's
|
|
145
|
+
// last pose save, landing before that, is the revision it consumes.
|
|
146
|
+
{
|
|
147
|
+
const shared = poseStorage();
|
|
148
|
+
const raw = { storage: { deck: shared } };
|
|
149
|
+
const old = store(raw, 'main');
|
|
150
|
+
await old.take('102');
|
|
151
|
+
let settle;
|
|
152
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
153
|
+
const leased = new Proxy(shared, {
|
|
154
|
+
get(target, name) {
|
|
155
|
+
if (name === 'snapshot') { return async (...args) => { await claimed; return target.snapshot(...args); }; }
|
|
156
|
+
return typeof target[name] === 'function' ? target[name].bind(target) : target[name];
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const fresh = store(raw, 'main', null, () => leased);
|
|
160
|
+
const taking = fresh.take('102', 'return');
|
|
161
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
162
|
+
await old.end('102', pose);
|
|
163
|
+
settle();
|
|
164
|
+
assert.deepEqual(await taking, pose, 'the return keeps the pose saved before its claim settled');
|
|
165
|
+
console.log('resumePose: leased take waits for the claim passed');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// A slow claim does not eat the take's read budget: the pose is restored and
|
|
169
|
+
// its revision kept for the next departure.
|
|
170
|
+
{
|
|
171
|
+
const shared = poseStorage();
|
|
172
|
+
const raw = { storage: { deck: shared } };
|
|
173
|
+
const old = store(raw, 'main');
|
|
174
|
+
await old.take('102');
|
|
175
|
+
await old.end('102', pose);
|
|
176
|
+
const realNow = Date.now;
|
|
177
|
+
let skew = 0;
|
|
178
|
+
Date.now = () => realNow() + skew;
|
|
179
|
+
try {
|
|
180
|
+
let settle;
|
|
181
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
182
|
+
const send = shared.transaction.bind(shared);
|
|
183
|
+
const slow = new Proxy(shared, {
|
|
184
|
+
get(target, name) {
|
|
185
|
+
// The clear's reply comes back 600 ms later.
|
|
186
|
+
if (name === 'transaction') { return async (input) => { const out = await send(input); skew += 600; return out; }; }
|
|
187
|
+
// As the lease view: reads wait for the claim.
|
|
188
|
+
if (name === 'snapshot') { return async (...args) => { await claimed; return target.snapshot(...args); }; }
|
|
189
|
+
return typeof target[name] === 'function' ? target[name].bind(target) : target[name];
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
const fresh = store(raw, 'main', null, () => slow, () => claimed);
|
|
193
|
+
const taking = fresh.take('102', 'return');
|
|
194
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
195
|
+
// The claim settles 4.6 s in.
|
|
196
|
+
skew += 4600;
|
|
197
|
+
settle();
|
|
198
|
+
assert.deepEqual(await taking, pose, 'the slow claim leaves the take its whole budget');
|
|
199
|
+
const moved = { at: { x: 1, y: 1, z: 1 }, facing: 0 };
|
|
200
|
+
await fresh.end('102', moved, Date.now(), 'return');
|
|
201
|
+
assert.deepEqual(await store(raw, 'main').take('102'), moved, 'its revision is kept for the next departure');
|
|
202
|
+
} finally {
|
|
203
|
+
Date.now = realNow;
|
|
204
|
+
}
|
|
205
|
+
console.log('resumePose: a slow claim keeps the take\'s budget passed');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// An end asked while a take waits for the claim runs after that take: the
|
|
209
|
+
// departure's pose is saved, not dropped for want of a revision.
|
|
210
|
+
{
|
|
211
|
+
const shared = poseStorage();
|
|
212
|
+
const raw = { storage: { deck: shared } };
|
|
213
|
+
const first = store(raw, 'main');
|
|
214
|
+
await first.take('102');
|
|
215
|
+
await first.end('102', pose);
|
|
216
|
+
let settle;
|
|
217
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
218
|
+
const fresh = store(raw, 'main', null, () => shared, () => claimed);
|
|
219
|
+
const taking = fresh.take('102', 'v2');
|
|
220
|
+
const moved = { at: { x: 2, y: 1, z: 2 }, facing: 1 };
|
|
221
|
+
const ending = fresh.end('102', moved, Date.now(), 'v2');
|
|
222
|
+
settle();
|
|
223
|
+
assert.deepEqual(await taking, pose);
|
|
224
|
+
await ending;
|
|
225
|
+
assert.deepEqual(await store(raw, 'main').take('102'), moved, 'the quick departure\'s pose was saved');
|
|
226
|
+
console.log('resumePose: an end during a take\'s claim wait runs after it passed');
|
|
227
|
+
}
|
|
@@ -47,7 +47,10 @@ function connect(s, id, transport = true) {
|
|
|
47
47
|
if (transport) s.server.transportJoin?.(s.session, player(id));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// knownLost false: the place never learned of the other claim before the
|
|
51
|
+
// player came back alone (no write failed here), so the fresh arrival finds
|
|
52
|
+
// it out by revalidating, and reclaims without the notice.
|
|
53
|
+
async function retainedReplacement(name, hub, liveElsewhere, entryPath, knownLost = true) {
|
|
51
54
|
const events = [], state = new Map(), pending = [], loads = [], leaves = [], arrivalState = [];
|
|
52
55
|
const a = boot(`${name}-old`, true, '101', false, { hub, hooks: {
|
|
53
56
|
arrive(ctx, group) {
|
|
@@ -71,7 +74,7 @@ async function retainedReplacement(name, hub, liveElsewhere, entryPath) {
|
|
|
71
74
|
assert.ok(state.has('101'), 'the old visits own authored state');
|
|
72
75
|
const b = boot(`${name}-other`);
|
|
73
76
|
await b.ctx.saves.deck('101').set({ progress: 42 });
|
|
74
|
-
await assert.rejects(a.ctx.saves.fence('101'), { code: 'CAULDRON_STORAGE_WRITER_LOST' });
|
|
77
|
+
if (knownLost) await assert.rejects(a.ctx.saves.fence('101'), { code: 'CAULDRON_STORAGE_WRITER_LOST' });
|
|
75
78
|
drop(a, 'p1'); drop(a, 'p2'); a.tick();
|
|
76
79
|
assert.ok(!events.some(e => e.startsWith('leave:')), 'both dropped visits are retained');
|
|
77
80
|
if (!liveElsewhere) await b.server.shutdown();
|
|
@@ -83,8 +86,12 @@ async function retainedReplacement(name, hub, liveElsewhere, entryPath) {
|
|
|
83
86
|
if (entryPath === 'tick') a.tick();
|
|
84
87
|
a.hello('fresh'); await flush(); a.tick(2000); a.tick(300);
|
|
85
88
|
await Promise.all(pending);
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
if (knownLost) {
|
|
90
|
+
assert.deepEqual(events, ['leave:p1', 'leave:p2', 'claim', 'arrive:fresh'], `${entryPath}: cleanup and reopening precede arrival`);
|
|
91
|
+
} else {
|
|
92
|
+
assert.deepEqual(events.filter(e => e !== 'arrive:fresh'), ['leave:p1', 'leave:p2', 'claim'], `${entryPath}: cleanup precedes the revalidated claim`);
|
|
93
|
+
}
|
|
94
|
+
assert.deepEqual(leaves, [['p1', knownLost], ['p2', knownLost]], 'leave hooks ran under the old lease');
|
|
88
95
|
assert.deepEqual(arrivalState.at(-1), ['fresh', false], 'leave cleared authored per-account state before arrival');
|
|
89
96
|
assert.deepEqual(loads.at(-1), ['fresh', 42], 'fresh arrival loads the other instance\'s saves');
|
|
90
97
|
assert.equal(a.calls.claim.length, 2);
|
|
@@ -150,6 +157,96 @@ async function replacementProgress(name, hub, entryPath) {
|
|
|
150
157
|
assert.equal(a.ctx.saves.lost('101'), false);
|
|
151
158
|
await a.server.shutdown();
|
|
152
159
|
}
|
|
160
|
+
// A fenced Town must not move the durable resume pose revision: its end and
|
|
161
|
+
// a same-playerId resume's take go through the writer lease.
|
|
162
|
+
async function poseFenced() {
|
|
163
|
+
const rows = new Map(), revisions = new Map(), sent = [];
|
|
164
|
+
const deck = (name) => {
|
|
165
|
+
const raw = fixture.root(`${name}-pose-deck`).storage.deck;
|
|
166
|
+
return { ...raw,
|
|
167
|
+
async snapshot({ prefix }) {
|
|
168
|
+
return { access: 'x', targets: [{ revision: revisions.get(prefix) ?? null,
|
|
169
|
+
rows: Object.fromEntries([...rows].filter(([k]) => k.startsWith(prefix))) }] };
|
|
170
|
+
},
|
|
171
|
+
async transaction({ changes }) {
|
|
172
|
+
const { prefix, expectedRevision, replace } = changes[0];
|
|
173
|
+
sent.push([name, prefix]);
|
|
174
|
+
if ((revisions.get(prefix) ?? null) !== expectedRevision) throw Object.assign(Error('conflict'), { code: 'SAVE_CONFLICT' });
|
|
175
|
+
for (const k of [...rows.keys()]) if (k.startsWith(prefix)) rows.delete(k);
|
|
176
|
+
for (const [k, v] of Object.entries(replace)) rows.set(k, v);
|
|
177
|
+
const revision = `r${sent.length}`;
|
|
178
|
+
revisions.set(prefix, revision);
|
|
179
|
+
return { revisions: [{ revision }] };
|
|
180
|
+
} };
|
|
181
|
+
};
|
|
182
|
+
const a = boot('pose-old', true, '101', false, { hub: { resumePose: true }, storage: { deck: deck('a') } });
|
|
183
|
+
await flush(); a.tick(2000); a.tick(300); await flush();
|
|
184
|
+
assert.ok(sent.some(([n]) => n === 'a'), 'arrival takes the pose lease');
|
|
185
|
+
const other = boot('pose-other', true, '101', false, { hub: { resumePose: true }, storage: { deck: deck('b') } });
|
|
186
|
+
await flush(); other.tick(2000); other.tick(300); await flush();
|
|
187
|
+
await assert.rejects(a.ctx.saves.fence('101'), { code: 'CAULDRON_STORAGE_WRITER_LOST' });
|
|
188
|
+
const before = sent.filter(([n]) => n === 'a').length;
|
|
189
|
+
drop(a, 'p1'); a.tick(); await flush();
|
|
190
|
+
connect(a, 'p1'); a.hello('p1', { resume: true }); a.tick(); await flush();
|
|
191
|
+
assert.equal(sent.filter(([n]) => n === 'a').length, before, 'a fenced Town sends no pose transaction');
|
|
192
|
+
await a.server.shutdown(); await flush();
|
|
193
|
+
assert.equal(sent.filter(([n]) => n === 'a').length, before, 'nor at shutdown');
|
|
194
|
+
await other.server.shutdown();
|
|
195
|
+
assert.ok(sent.filter(([n]) => n === 'b').length > 1, 'the current writer still saves its pose');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// A lone quick return (a new player id before any tick saw the old socket
|
|
199
|
+
// go): the held visits end their pose under their claim, and the arrival's
|
|
200
|
+
// take, made while the claim revalidates, follows it (or its replacement).
|
|
201
|
+
async function poseQuickReturn(taken) {
|
|
202
|
+
const rows = new Map(), revisions = new Map(), results = [];
|
|
203
|
+
const deck = (name) => {
|
|
204
|
+
const raw = fixture.root(`${name}-quick-deck`).storage.deck;
|
|
205
|
+
return { ...raw,
|
|
206
|
+
async snapshot({ prefix }) {
|
|
207
|
+
return { access: 'x', targets: [{ revision: revisions.get(prefix) ?? null,
|
|
208
|
+
rows: Object.fromEntries([...rows].filter(([k]) => k.startsWith(prefix))) }] };
|
|
209
|
+
},
|
|
210
|
+
async transaction({ changes }) {
|
|
211
|
+
const { prefix, expectedRevision, replace } = changes[0];
|
|
212
|
+
const ok = (revisions.get(prefix) ?? null) === expectedRevision;
|
|
213
|
+
results.push([name, Object.keys(replace).length ? 'end' : 'take', ok]);
|
|
214
|
+
if (!ok) throw Object.assign(Error('conflict'), { code: 'SAVE_CONFLICT' });
|
|
215
|
+
for (const k of [...rows.keys()]) if (k.startsWith(prefix)) rows.delete(k);
|
|
216
|
+
for (const [k, v] of Object.entries(replace)) rows.set(k, v);
|
|
217
|
+
const revision = `r${results.length}`;
|
|
218
|
+
revisions.set(prefix, revision);
|
|
219
|
+
return { revisions: [{ revision }] };
|
|
220
|
+
} };
|
|
221
|
+
};
|
|
222
|
+
const a = boot(`quick-${taken}`, true, '101', false, { hub: { resumePose: true }, storage: { deck: deck('a') } });
|
|
223
|
+
for (let i = 0; i < 3; i++) { await flush(); await new Promise(r => setImmediate(r)); a.tick(2000); a.tick(300); }
|
|
224
|
+
if (taken) {
|
|
225
|
+
const other = boot(`quick-${taken}-other`);
|
|
226
|
+
await other.ctx.saves.ready('101');
|
|
227
|
+
await other.server.shutdown();
|
|
228
|
+
}
|
|
229
|
+
results.length = 0;
|
|
230
|
+
drop(a, 'p1'); drop(a, 'p2');
|
|
231
|
+
connect(a, 'fresh'); a.hello('fresh');
|
|
232
|
+
for (let i = 0; i < 4; i++) { await flush(); await new Promise(r => setImmediate(r)); }
|
|
233
|
+
a.tick(2000); a.tick(300);
|
|
234
|
+
for (let i = 0; i < 4; i++) { await flush(); await new Promise(r => setImmediate(r)); }
|
|
235
|
+
const ends = results.filter(([, kind]) => kind === 'end');
|
|
236
|
+
if (taken) {
|
|
237
|
+
assert.equal(ends.length, 0, 'the held visits\' pose ends were refused by their taken claim');
|
|
238
|
+
} else {
|
|
239
|
+
// Two visits of one account: only the later take's revision can end it.
|
|
240
|
+
assert.ok(ends.some(([, , ok]) => ok), 'the held pose was ended before it was forgotten');
|
|
241
|
+
}
|
|
242
|
+
assert.ok(results.some(([, kind, ok]) => kind === 'take' && ok), 'the arrival took the pose lease');
|
|
243
|
+
assert.equal(a.ctx.saves.lost('101'), false);
|
|
244
|
+
results.length = 0;
|
|
245
|
+
drop(a, 'fresh'); a.tick(); await flush(); await new Promise(r => setImmediate(r));
|
|
246
|
+
assert.deepEqual(results.filter(([, kind]) => kind === 'end').map(([, , ok]) => ok), [true], 'the arrival can save its pose on departure');
|
|
247
|
+
await a.server.shutdown();
|
|
248
|
+
}
|
|
249
|
+
|
|
153
250
|
const a = boot('a'), b = boot('b'), disabled = boot('off', false);
|
|
154
251
|
const guest = boot('guest', true, 'dev-guest-1', true), anonymous = boot('anon', true, '102', true);
|
|
155
252
|
try {
|
|
@@ -189,6 +286,11 @@ try {
|
|
|
189
286
|
assert.equal(a.ctx.saves.lost('101'), false);
|
|
190
287
|
assert.ok(!a.sent.some(([to, msg]) => to === 'p1' && msg.k === 'hub-hud' && msg.hud?.text === NOTICE), 'a fresh visit is not warned');
|
|
191
288
|
console.log('writer lease hub: opt-in, visits, persistent HUD, reconnect and transport rejoin passed');
|
|
289
|
+
await poseFenced();
|
|
290
|
+
await poseQuickReturn(false);
|
|
291
|
+
await poseQuickReturn(true);
|
|
292
|
+
console.log('writer lease hub: a quick lone return keeps the held pose and the arrival keeps its pose lease');
|
|
293
|
+
console.log('writer lease hub: a fenced Town leaves the durable resume pose to the current writer');
|
|
192
294
|
|
|
193
295
|
for (const [mode, hub] of [['pose', { resumePose: true }], ['keep', { resume: { keep: true }, result: { score: { unit: 's', better: 'lower' } } }]]) {
|
|
194
296
|
for (const liveElsewhere of [false, true]) {
|
|
@@ -196,6 +298,8 @@ try {
|
|
|
196
298
|
const name = `${mode}-${liveElsewhere ? 'C' : 'D'}-${path}`;
|
|
197
299
|
await retainedReplacement(name, hub, liveElsewhere, path);
|
|
198
300
|
console.log(`writer lease hub: ${name} held visits forgotten, claim reopened, arrival reload and saves passed`);
|
|
301
|
+
await retainedReplacement(`${name}-unknown`, hub, liveElsewhere, path, false);
|
|
302
|
+
console.log(`writer lease hub: ${name} lone return to a claim taken elsewhere revalidates and saves without the notice`);
|
|
199
303
|
}
|
|
200
304
|
}
|
|
201
305
|
for (const path of ['hello', 'transport', 'tick']) {
|