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
- edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
- bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre
- 5d8579d7README: login.js stays by caramboleyo's explicit rulemre
- cc759328Merge sb3-standby: calendar deploys through its standbymre
- f2fcdc6dcalendar: a standby container (port 45015, profile standby, reminder clock off) and a /health page; deploy hands over through standby-swap.sh without a gapmre
- 229643f7Merge branch 'cal-14'mre
- 1110b26fcalendar#14: the month name no longer breaks into two lines on a phone (Reminder settings drops to its own row when the header is too narrow), gate checks for one-line title and all header controls on screenmre
- 490c658aident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
- 18095868calendar: Reminder settings button opens its dialog again (the dialog's open handler still closed the removed user menu and stopped); old e2e and gate scripts use the new headermre
- 6eee4b5acalendar header: the selector alone top right plus Log out as before the theme missions; Reminder settings back on the month page (WIP: the settings test still fails)mre
- 0b909decident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
- 0c8f9364Merge branch 'sy-sync'mre
- 9fab1c8fsync components.hybriel 4922f9c into the month view: prev / next 44 px targets, names formatted in UTC (a UTC+12 zone showed the wrong first weekday); the calendar keeps its own language handling (Accept-Language / browser) and the P1/C13 reminder code; gate: 44 px check (SY)mre
- 27d3e294theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 2ac9c1bbdeploy: security gate (tests/security.mjs)mre
- 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