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
- 6b0a2571merge sc-sec (calendar security) with 99-year sessionsmre
- 92001e52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 0f76c99dSecurity audit SC: push endpoint SSRF guard, uploadMax 0, Secure cookie, login session rotation + rate limit, event cap, nosniff, security gatemre
- 2dd53dccP1: one reminder shows once: arm() one at a time, the page skips reminders the server already pushed; push-twice gatemre
- 3a29760aC13 report (handoff)mre
- 33ab66ffCalendar: notification controls move from the month view into Reminder settings (user menu), one consistent state, state read when the dialog opensmre
- 682a5b43reports: calendar gate countsmre
- 876d22b2reports/H1-hydrate.mdmre
- ef0cae45tests/dst.mjs: wait for hydration instead of a fixed 2.5 s sleep before clicking #gomre
- d9cadecatests/cdp.mjs: HL_CPU_THROTTLE=<rate> optional CPU throttling for gate runsmre
- efa61227re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- 7808adbecalendar#12: report 011, LOG, STATUS, push-shots-testmre
- df2e4fa0calendar#12: test push rate limit (1 per 30 s per device), owner-only gate checksmre
- acb957cfcalendar#12: Send a test notification on a subscribed device (one push in ~10 s, owner's own device), push gate part 4mre
- 0b222eb8tests: e2e-theme CDP port default from E2E_THEME_CDP_PORT (8756 unchanged)mre
- 8b8a5abare-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- a69b27f9docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 1a97edfdcalendar mission 010: reminder rows at 390 px (the 7-column month grid no longer catches the reminder lists), gate checks, settings-shots, reportmre
- 61b21404calendar mission 009: reminder times on hl:time in the browser (lib/push-plan.hl and the Intl code removed), DST gate tests/dst.mjs, E2E script, reportmre
- 875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre