From 32915c9310ee4cf1d4be479791695e705129be0b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 10:36:54 +0000 Subject: [PATCH] Remove the unused generation getter on the directions object Runtime coverage across every driven state (normal ranking, both swipe verdicts, the way screen, the deck/list, room detail and day nav, the location and building pickers, every refusal screen, ?dev=1, a blocked- network boot, and an offline reload) never calls the getter, and a repo- wide grep turns up no production reader either -- app.js calls invalidate() but never reads .generation back. invalidate() already returns the new count, so callers never needed the getter in the first place; only a test read it directly. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_018uATJfgH74g8DjKBWwoN3e --- js/directions.js | 13 ++++++------- scripts/test/directions.test.mjs | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/js/directions.js b/js/directions.js index 11d2d34..5e29746 100644 --- a/js/directions.js +++ b/js/directions.js @@ -105,13 +105,12 @@ export function createDirections({ key, consent = () => false, maps = loadMaps, const ready = () => (consent() && globalThis.navigator?.onLine !== false ? maps(key, doc) : Promise.reject(new Error('unavailable'))); return { - // Bumped by the caller whenever the origin or the date moves. A response - // that comes back against an old generation is dropped rather than - // rendered, which is the rule docs/research/walking-routes-115.md sets: a - // stale answer must never reorder or relabel a list already on screen. - get generation() { - return generation; - }, + // Bumped by the caller whenever the origin or the date moves, and handed + // back so the caller can tell generations apart without this object + // keeping a second, readable copy of the count. A response that comes + // back against an old generation is dropped rather than rendered, which + // is the rule docs/research/walking-routes-115.md sets: a stale answer + // must never reorder or relabel a list already on screen. invalidate() { generation += 1; return generation; diff --git a/scripts/test/directions.test.mjs b/scripts/test/directions.test.mjs index 1b75f33..7443bc5 100644 --- a/scripts/test/directions.test.mjs +++ b/scripts/test/directions.test.mjs @@ -139,10 +139,8 @@ test('an answer against an old generation is dropped', async () => { test('invalidate counts up so a caller can tell generations apart', () => { const { maps } = fakeMaps({ leg: LEG }); const d = createDirections({ key: 'k', consent: yes, maps }); - assert.equal(d.generation, 0); assert.equal(d.invalidate(), 1); assert.equal(d.invalidate(), 2); - assert.equal(d.generation, 2); }); // --- the matrix, all or nothing