calendar
All repositories: gitoria
7.4 KB
# Report 001 (w085): calendar code order, no behaviour change**Where:** commits on main in loreana:/media/STORAGE/projects/calendar.worldapi.org (parent d6c5929):- `c6fbd01`: file moves (1/4)- `f5ce6b1`: topics, map and thin faces (2/4)- `3b2a4cd`: `let` (3/4)- the docs + tests commit (4/4), which also holds this report and the mission briefNot pushed, not deployed. No `.env` read. Only ports 8760–8764 and 8767–8769 were used (8765/8766 skipped). Every server was stopped by its PID; nothing of mine is still running. This ran after notes mission 002, in the same session.## Counts (before → after; `python3 tests/letcount.py .`, which now also scans sub-folders)| | before (d6c5929) | after ||---|---|---|| `.hl` files in the root | 4 | **1** (project.hl) || project.hl lines | 107 | **65** (index comment, PWA config, routes, audience, server) || `let` total | 256 | 110 || `let` never reassigned | **147** (52 of them in components/month-view/month-view.hl) | **0** |The 110 `let`s left are all needed:- 67 are reassigned;- 43 are re-bound in a loop body (hybriel#128).## LayoutThe full file map is in README "Layout". Imports only go one way: util ← users, settings, events-helpers ← events ← api-helpers ← api ← project.hl.- **`lib/events.hl`**: the table and every write to it.- Holds `saveEvent`, `createEvent`, `changeEvent`, `deleteEvent`, `eventsBetween` and `upcoming`.- `soonOf` is here now (before, it was in the calendar component).- The faces' answers are `calendarView` and `settingsView`. Before, all five faces built the same object of four calls themselves.- **`lib/events-helpers.hl`**: `build`, `viewOf`, `isLocalId`, `validWindow` (out of the component), the size limits, and `byStart` (the hand sort that was inside `eventsBetween`).- **`lib/settings.hl`**: the settings table and the default reminders: `settingsOf`, `defaultsOf`, `saveDefaults`. Before, these were in events.hl.- **`lib/users.hl`**: users and ident.- `userOfLoginCode` is new here: the single exchange + `ensureUser` step. Before, the login route and the `calendarLogin` face each had their own copy.- `tagOf` moved here out of project.hl.- **`lib/api.hl`**: `/login/callback` and `loginFailed` (this was `failed`). Both take `&req` and `&sessions`.- **`lib/api-helpers.hl`**: `safePath`.- **`lib/util.hl`**: `envOr`, `storageDir`, `countOfList`, `firstOf`, `isHex`, `isIdentId`. Before, these were in users.hl.- **Moved:** `styles.hl` → `components/styles.hl`. `tools/migrate-short-ids.hl` now imports from `lib/`.- **`components/month-view/` stays as it is.** It is the vendored month view, extended here, with its own README. Its `dates.hl`, `reminders.hl` and `clock.hl` are shared with the server. Only its imports changed, and its `let`s.- **Faces made thin:**- `calLoad`, `calSave`, `calDelete`, `calSettingsLoad`, `calSettingsSave`, `calSaveQueued`: check the session and the input, call `lib/`, answer;- `calendarLogin` → `userOfLoginCode`. The session writes stay in the face.## Tests| test | result ||---|---|| gate `tests/browser.mjs` (app 8760, ident 8761, Chrome 8767–8769) | **78 passed, 0 failed** before and after steps 1 and 2. After step 3: 3 of 4 runs 78/0; 1 run 36/1 || `tests/short-id-switch.mjs` (8760/8761) | **18/0** before and after each step || live-data reads + writes | identical, except **the intended differences** (below) |**The failed gate run:** it timed out on "next month". That is the known flake on a loaded machine (STATUS 2026-09-26). The three re-runs were green, and the live-data run covers paging through `calLoad`.**Live-data comparison** (new `tests/realdata-baseline.mjs` and `tests/realdata-compare.py`; how to run: README "Run, test, deploy" → "Same output"):- **Data:** a copy of Byrodin's `storage/mpackdb`: 1 user, 6 events, no settings row.- **Ident:** a fake ident on port + 5.- **Reads** (53):- `/` signed in, signed out, and in de and fr;- `/login/failed`, the static files, the manifest, `/__hl/sw.js` and the browser modules;- `calLoad` for all events and for every month that has one, plus 5 other or bad windows, and signed out;- `calSettingsLoad`;- `/login/callback` failing six ways, with and without a session.- **Writes** (69):- creating an appointment, an all-day event over three days, a one-day event, an overnight event in Tokyo, own reminders, and none;- 18 field refusals;- not an object, a bad window, signed out;- an edit;- the offline queue (`calSaveQueued` with a `local-` id, again, then an edit and a delete with that id);- deletes: again, unknown, null, bad window, signed out;- a live event changed and deleted;- the defaults saved, saved again, refused twice, refused signed out;- logins through the button, with `next` values and with a session;- the login face, four ways; logout;- the reads that follow.- **Masks:** two runs of the OLD code compare clean (122/122).- What they mask: source positions, `?v=` and `hl-shell-` hashes, the request times (also double-escaped), the port in the echoed Host header, and for writes the new ids, ms stamps and login tags.- The structural module check now ignores `this.x` and the component's own methods. Before, month-view's method `build` clashed with the imported `build` of events-helpers.**The intended differences:**1. **The failed-login reason is kept** (3 answers, the same fix as gitoria 002 and notes 002).- **What changed:** `/login/failed`, opened after a failed `/login/callback` in a browser that has a session, now shows the reason. Example: "ident refused the login (403: code expired)".- **Before:** it said "the login did not finish — try again".- **To undo it:** pass `req` by value to `loginFailed`.2. **The calendar component's browser module** no longer carries `validWindow` and `soonOf`. They moved to `lib/`, and only the server faces ever called them.**Step 3 (`let`) against step 2:** 0 different, including every browser module.**Other checks:**- A server without `CALENDAR_STORAGE` still reads its own `./storage/mpackdb`: 6 events, on the old tree and the new one.- In the compiled month view, every `build(…)` call is still `this.build` (checked in the module).## Found (in STATUS)1. **A plain declaration that is used AFTER its block breaks in the browser.** The browser target makes it a block-scoped `const`. `.scratch/w085/unlet.py` now keeps `let` in that case. A small test proved the check works; nothing in calendar needed it.2. **The browser module hoists the imports of every imported file as module constants.** For example `const build=$_N.build` from events-helpers sits next to month-view's own method `build`. This is harmless, because the method is called as `this.build`, but it confuses a by-name comparison.3. **The old #48 audit missed the lost `failed(req)` write.** README now notes this.## Not done / open- **Not deployed** (that is the architect's job). Use the normal `./deploy.sh`. There is no data change.- rsync does not delete, so the old root `events.hl`, `users.hl` and `styles.hl` stay on Byrodin. They are unused and can be removed by hand.- The service worker's cache name changes with the new module hashes, as it does after any code change.- **The "next month" gate flake is still open** (pre-existing).- **Scratch** (gitignored) in `.scratch/w085/`:- `old/`;- `gates.sh`, `step.sh`, `unlet.py` (with the after-the-block check), `nostore.mjs`;- the gate outputs.- **Deleted after the run:** the live-data copy and every baseline output.
Branches
Latest commits
- 186f969bcalendar mission 007: signed-in gate for the first-pointer race (fails on 3c5604f), README theme section, reportmre
- ba9b4955calendar mission 006: first pointer event no longer re-runs the month (stale overwrite race), gate check, e2e settings cleanup, reportmre
- bd730759calendar mission 006: theme move (WIP): brief, report, LOG, STATUSmre
- b117b153calendar mission 006 WIP: reminder row fields keep 44 px; e2e script flagsmre
- 53e3b0debrowser gate: Log out through the user menu, theme colour rgb(15, 20, 25)mre
- 90bf9e2ecalendar mission 006 WIP: theme dbe3de7, theme shell (AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst), styles cut to the app's own rules, check-theme gate, e2e toolsmre
- 3c5604f9identkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
- 4996bbe7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- f5bf0803calendar mission 004: re-vendor Hybriel to the shared static build 0f396652; compose cache volume + tmpfs; notify-paths gate in deploy.sh; gate start waits 150 s; reportmre
- eb86526fmission brief 004mre
- 2f953b16deploy.sh: wait up to DEPLOY_URL_WAIT (120 s) for 200 after the restart, as the other apps (cold compile, hybriel#148)mre
- 9078e1b7calendar mission 003 (2/2): report, LOG, STATUS (cause: timers only in an open, front, touched page; gate old 5/2 new 7/0; Hybriel gaps Web Push + page-shown hook, STOP)mre
- 31ffe910calendar mission 003 (1/2): calendar#9 — missed reminders shown when the app is back, timers set again when it is shownmre
- 26c997d3mission brief 003mre
- c6809c76calendar mission 002: report, LOG, STATUS (test bug; fixed gate 78/0 at 00:30 05:40 12:00 19:59 20:01; 23:30 not run, quota stop)mre
- 00f72783calendar mission 002 (2/2): TEST bug — the reminder steps get their own identity (carol): alice's all-day Vacation (20th-22nd) from the events steps added 2 reminders from the 12th 20:00 to the 19th 23:00; Tokyo check no longer skipped in the Tokyo eveningmre
- 54fb0ce1calendar mission 002 (1/2): gate clock override GATE_CLOCK=HH:MM (this process and every page get Date shifted to that local time today)mre
- c838ee79mission brief 002mre
- f2bc67ecdocker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
- 2881119fcalendar mission 001 (4/4): code order — README layout + same-output test, STATUS, LOG, report; tests/letcount.py (sub-folders), tests/realdata-baseline.mjs, tests/realdata-compare.pymre