ident
All repositories: gitoria
8.6 KB
# Report 009: ident code order, no behaviour change**Where:** commits on main in loreana:/media/STORAGE/projects/ident.worldapi.org:- `9101716`: file moves (1/4)- `d2e7f91`: topics, map and thin wrappers (2/4)- `fe18351`: `let` (3/4)- the docs + tests commit (4/4), which also holds this report and the mission briefNot pushed, not deployed. No `.env` read (the real-data runs use code-only copies without `.env`). Only ports 8750–8759 were used. Every server was stopped by its PID; nothing of mine is still running, and 8750–8759 are free.## Counts (before → after; `python3 tests/letcount.py .`)| | before (f8bdcbc) | after ||---|---|---|| `.hl` files in the root | 10 | **1** (project.hl) || project.hl lines | 338 | **132** (index comment, PWA config, routes, mailer, audience, server, one hook) || `let` total | 453 | 164 || `let` never reassigned | **290** | **0** |The 164 `let`s left are all needed:- 99 are reassigned;- 49 are in a loop body (Hybriel refuses a plain declaration there on the 2nd pass);- 14 have the name of a member of the file: `me` in the faces, which is also a component member;- 2 are declared twice in one function (see "Found").`tests/letcount.py` (from gitoria) now has the kinds `member` and `twice` too, so "never" means "should be plain".## LayoutThe full file map is in README "Files". Imports go one way only:- util ← identities-helpers ← identities ← accounts ← login-helpers ← login- util ← apps-helpers ← invites-helpers ← invites ← apps ← selector / notify ← api-helpers ← api ← project.hl**Topic files** (each holds its central logic and every write to its tables):- **`lib/login.hl`**: the code tables otp / sends / ipsends, the limits, `checkCode` and the pending sign-in.- It gained `signInWithCode`, the logic of the verifyCode face.- Helpers: `lib/login-helpers.hl` (`newOtp`, `otpHash`, `ipBucket`).- **`lib/accounts.hl`**: the accounts table, the sessions and sign out everywhere.- It gained `createAccount`, which before was inside `checkCode`.- `dropUserSessions` moved here from project.hl. project.hl hands it the server by reference.- **`lib/identities.hl`**: the identities table, the short ids and the identity CRUD.- It gained `addDefaultIdentity` (was in `checkCode`) and `identityRecord` / `accountOfIdentity` (were in notify.hl).- Helpers: `lib/identities-helpers.hl` (fields, avatar, label, the short id's alphabet).- **`lib/apps.hl`**: apps, connections, requests, grants, the login button and the exchange.- `appOfSecret` moved here from notify.hl.- The person's side of an invite moved here (`openInvite`, `grantInvite`), because it creates and uses login requests.- `grantRequest` is the dispatch that was in the chooseIdentity face.- Helpers: `lib/apps-helpers.hl` (app form, origins, return URL, keys).- **`lib/invites.hl`** now owns its table. `invitesTable` was declared in apps.hl, and apps.hl deleted invites directly.- Now `deleteApp` calls `dropInvitesOf`, and `acceptInvite` writes the acceptance.- Helpers: `lib/invites-helpers.hl`.- **`lib/selector.hl`**: the pick ids, the list and `codeOfPick` (was a loop inside the endpoint).- **`lib/notify.hl`**: kinds, effective settings, sending, the inbox and the per-app page.- Helpers: `lib/notify-helpers.hl` (checks, stamp, the two hand sorts, on/off).**Shared and routes:**- **`lib/util.hl`**: `dir`, `envNumber`, `countOf` / `first` / `merged`, `str`, `isId` / `isList` / `isObject`, `oldestFirst`, `hasControl`, `urlChars`, `normEmail` / `validEmail`, `checkTimeZone`.- Before, `isList`, `isObject` and `str` existed twice (apps / notify / store).- **`lib/api.hl`**: every function route from project.hl, as thin wrappers.- Also the selector's two CORS endpoints (were in selector.hl).- Also `codePage(route, req, &srv, Home)`.- **`lib/api-helpers.hl`**: the old api.hl, plus `inviteCaller`, `field`, `baseOf`, `hexId` and the selector's CORS answers and caller check.**Moved, unchanged:**- `mail.hl` → `lib/mail.hl`- `jsoncheck.hl` → `lib/jsoncheck.hl`- `styles.hl` → `components/styles.hl`- `tools/` import from `lib/`**Faces made thin:**- verifyCode → `signInWithCode`- chooseIdentity → `grantRequest`The one-line `signOut` session write stays in its face. A face's `session` is the framework's own (as gitoria did it).## Tests| test | result ||---|---|| gate `tests/browser.mjs` (8750, 8751, Chrome 8752–8759) | **152 passed, 0 failed** before and after each step || apps / selector / migration / iplimit / notify | **107 / 99 / 33 / 39 / 130, 0 failed** before and after each step || hardening / signoutall / shortid / invites | **17 / 6 / 19 / 44, 0 failed** before and after each step || live-data reads + writes, old vs new | **291 / 291 the same** |How the other nine gates run: `.scratch/m009/runall.mjs` runs them as temporary port-remapped copies (8750–8757), one by one. Outputs are in `.scratch/m009/gate-<name>-<before|step1|step2|step3>.txt`. The commands are in README "Test" → "Same output".**Live-data comparison** (new `tests/realdata-baseline.mjs` + `tests/realdata-compare.py`):- **Data:** a copy of Byrodin's `storage/mpackdb`, taken 2026-10-03. Each run gets a fresh copy.- **Code:** each tree runs from a code-only copy without `.env`. Mail goes to a sink file.- **Reads (187):**- every page, signed in as az5b2 (session file for account 0mufd5afy0xm) and signed out: `/`, `/start`, `/apps`, `/inbox`, the 8 live connection pages, `/code`, `/signin/…`;- the browser modules, the worker and the manifest;- every live app's `/login` variants and selector calls (in / out / foreign origin / preflight);- the refused API calls.- **Writes (104):**- identities and the time zone;- a new app with its secret and new secret;- the login button and the exchange, the selector choose and exchange;- kinds and notifications (also urgent, unregistered and refused ones);- inbox mark, switches and override;- invites (create, mail, list, open, accept, get, revoke) and migrate-ids;- the OTP login of a new address and of the creator's: wrong code, right code, the code page before and after;- the app login on `/signin/<rid>/code` and "Other address";- the address and IP limits;- sign out everywhere, disconnect, app delete;- finally the whole stored state (`tools/dump-store.hl` on a copy).- **Masks:** only what changes per run (times, random ids, codes, keys, short ids of new identities, source positions, module hashes). Two runs of the OLD tree compare clean (291/291).- **After step 2:**- 4 browser modules differ, but only in source positions and the import tables (the comparator checks the code and the imported functions);- the worker's `hl-shell-<hash>` cache name differs (it follows the code hash).- **After step 3:**- also `var` → `const` in the client code of main.hl;- 0 real differences.## Found (in STATUS "Lessons")1. **A plain declaration may not repeat a name inside one function.** In `lib/notify.hl sendNotification`, both `if` blocks declare `c` (`checkUrl` of the icon, then of the link). As plain declarations, the second one aborts with "Cannot reassign immutable variable 'c'". It showed up as notify gate 45/3 and a 500 on the real-data `w-notify`. Both stay `let`. `.scratch/m009/twice.py` searched every file: this was the only case.2. **A `let` with a member's name must stay.** Without `let`, `me = accountOfSession(session)` in a face would assign the component's member. gitoria's `unlet.py` already refuses these (CLASH, 14 cases).3. Moving statics between lib files did not change the browser modules at all; only the component's own line shifts move source positions.## Open- **Not deployed** (that is the architect's job). Use the normal `./deploy.sh`. There is no data change.- deploy.sh's rsync does not delete, so the 9 old root files stay on Byrodin: api.hl, apps.hl, invites.hl, jsoncheck.hl, mail.hl, notify.hl, selector.hl, store.hl, styles.hl. They are unused; delete them by hand after the deploy.- **Long files left as they are:**- `components/home.hl` (587 lines; it is UI);- `lib/notify.hl` (384);- `lib/apps.hl` (276).- **Not touched:** `testapp/` (a test app with its own project.hl). It is outside the scan, like in tickets and gitoria.- **Scratch** (gitignored) in `.scratch/m009/`. The folder also holds the 2026-09-24 UUID-migration files (old mission 009: deploy-*, rehearsal-*, cmp009.py …); they were not touched. Mine:- `old/` (the old tree, code only);- `gates.sh`, `runall.mjs`, `step.sh`;- `unlet.py`, `twice.py`, `letcount.py`;- the gate outputs.- **Deleted after the run:** the live-data copy, the dump and every baseline output (they hold live data).
Branches
Latest commits
- 40627a89ident#33: the time zone section's spacing moves into timezone.hlmre
- d389db08ident#33: the identity page's rules and the Notif. chip move into identity.hl's Stylemre
- ddda0b5bident#33: the identity row's parts move into identitylist.hl's Stylemre
- 47e516afident#33 ident#34: the identity form's avatar rules move into identityform.hl; the preview and Remove button are hidden with the hidden attribute instead of built class strings (avatarPreviewClass, avatarRemoveClass gone)mre
- 5cb5cf0eident#33: the code field's look moves into codestep.hl's Stylemre
- f421cd60ident#33: the shell's own rules (user menu address, offline note, network probe) move into main.hl's Stylemre
- c512fb96Merge branch 'f4-homesplit' into mainIdent
- 07d1717c|||PR ident#40 home.hl is split into components, one per area: email step, identity form, identity list, app identity choice, time zone; each moves its faces with it, the email step is shared with embed.hl (#40.3, rest of #40.2)mre
- 59e8fcc1ident#40.3: the app's identity choice is one component (components/chooseidentity.hl); its face chooseIdentity moves with itmre
- e23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmre
- e24b59a6ident#40.3: the time zone is one component (components/timezone.hl); its face changeTimeZone moves with itmre
- 8cbc5717ident#40.3: the email step is one component (components/emailstep.hl) placed by home.hl and embed.hlmre
- 6fad3bd2Merge branch 'f3-codestep' into mainIdent
- 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
- c28bddeeMerge branch 'f2-shell' into mainIdent
- c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
- 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
- 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
- edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
- 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre