gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2f2959c52f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre2f2959c5/missions/R52-apptoken-restart.md

2.7 KB

  1. # R52 — app token unknown after a restart (blocks the day52 deploy)
  2. Task line: obvious bug in the live app (CONDUCTOR.md: "Obvious bugs in the live app: fix without asking").
  3. ## Symptom (Gitoria, 2026-11-08 12:20, measured)
  4. `node tests/status.mjs` step "after a restart the token still works, the PUT replaces the stored row" (tests/status.mjs ~line 220-225: stop(); startServer(ENV); await up(); PUT status with the app token tPub issued before the restart) fails in about half the runs: the PUT gets 401 `unauthorized` "missing, unknown or expired token". Same rate on day50 bin (2 of 4) and day52 bin (3 of 4), so not a day52 regression. V37 (2026-11-02) saw the same in status-keyed ("token unknown after the second restart"). Live risk: after every deploy/restart, apps' (Kunibert's) tokens may be lost or not found.
  5. Code: lib/app-tokens.hl (MPackDB apptokens.db, primaryKey @id, indexes ['!hash','app','repo']; issueToken put, rowOfToken find('hash', sha256(token)); sweepExpired), lib/app-auth.hl.
  6. Read first, fully: /media/STORAGE/projects/WorldAPI/worldapi-conductor/archive/2026-10-31/WORKER-RULES.md; /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md; the hl:mpackdb README in plugins/mpackdb (durability, close/flush, shutdown, index rebuild).
  7. ## Work (git worktree `../gitoria-R52`, branch r52 from main; bin/ is not in git: copy main's bin/ folder (day52) into the worktree; never edit LOG.md/STATUS.md)
  8. 1. Find the mechanism: is the row missing in apptokens.db after the restart (not flushed before SIGTERM/stop?), present but not found by the '!hash' index (index not persisted/rebuilt?), or something else (expires clock, a sweep deleting it, a second process)? Prove with a minimal instrumented run (inspect the db file before/after, log in a scratch copy only). Check how tests stop the server (signal, wait) vs how docker stops it live.
  9. 2. If it is gitoria's code: fix it the framework's way (copy a working shape from the docs; gap → DOCS line). If it is a framework (mpackdb/runtime) bug: minimal repro in .scratch/ (a tiny .hl app: put, stop the same way, start, find by unique index) and STOP; no workaround.
  10. 3. Proof: tests/status.mjs and tests/status-keyed.mjs 10 runs each, all 0 failed; then the full gates (LC_ALL=C, ports 8720-8739 only, `ss -ltn` first; port 8700 is taken: use the GITORIA_GATE_* variables as V52 did): `node theme/check-theme.mjs .`, `node tests/browser.mjs`, and every gate in deploy.sh's GATES list, all 0 failed.
  11. 4. Commit on branch r52 (subject names the cause, no ticket number). Do NOT merge, push or deploy.
  12. ## Report
  13. reports/R52-REPORT.md (≤25 lines): mechanism with evidence, fix or repro path, run counts, gate numbers, live impact (were tokens lost at past deploys?), risks. Then stop. Budget ~60 requests.

Branches

Latest commits

  • 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre
  • f7c6ca07Merge branch 'ident-chooser-selector' into mainGitoria
  • 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
  • 16a3530fMerge branch 'heap-revert' into mainGitoria
  • 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
  • 13f0c342Merge branch 'hl25-records' into mainGitoria
  • a002ecb7|||PR records: HL25 report, heap helper, logmre
  • 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
  • fefaedd2log: tracker PR-only, HL25 startedmre
  • 21aa57calog: parkmre
  • e9f950a8reports: G25c soakmre
  • a7783686log: deploy 9f41ffcmre
  • 9f41ffc1log: W30b mergedmre
  • bef635c1Merge branch 'w30b'mre
  • 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
  • c4f6d9e3reports: G25c growth huntmre
  • b88e39f1log: privacy cleanup donemre
  • bfd7826ddocs: neutral example organisation namemre
  • 01b71c2edocs: neutral wording in missions, reports and logmre
  • 3eeea733log: 2026-11-09 PR flow plan and membersmre