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
- mainmain branch
Latest commits
- 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
- 3b2a4cd0calendar mission 001 (3/4): code order — let only where reassigned (147 dropped incl. components/month-view; 110 left: 67 reassigned, 43 loop-bound); gates 78/0 (3 of 4 runs; 1 known 'next month' flake) + 18/0, live-data run = step 2mre
- f5ce6b1dcalendar mission 001 (2/4): code order — topics, map, thin faces: lib/util.hl, lib/events(-helpers).hl (+calendarView/settingsView/soonOf), lib/settings.hl, lib/users.hl (+userOfLoginCode, tagOf), lib/api(-helpers).hl; project.hl = map; login route takes &req/&sessions (failed-login reason now kept); gates 78/0 + 18/0mre
- c6fbd011calendar mission 001 (1/4): code order — files moved: lib/events.hl, lib/users.hl, components/styles.hl (imports only); gates 78/0 + 18/0, live-data run identicalmre
- d6c59290calendar: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 78/0 + 18/0mre
- 7bd0337ccalendar: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gates 78/0 + 18/0mre
- ff41310ccalendar: Hybriel master 8efba065 (#126 memory, #48 lambda copy; audit: no & needed)mre
- 14ba08c7antcolony#40: mission references point to the moved missionsmre
- 99c73346antcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
- 76edaa62calendar: Hybriel master ff51cf46 (re-vendor round, static workaround removed)mre
- 90a3fc2cdeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
- 6722b72ddeploy.sh: never send .git or .gitignore to Byrodinmre
- be099807State of 2026-09-27, before the move to gitoriamre