Strip v0's [tz=…] markers from log lines (migration rule + clean the live Home) #151

Closed
opened 2026-10-14 06:01:22 +00:00 by kayg · 2 comments
Owner

kayg: "why did you add 'tz=Asia/Kolkata' to so many of my notes' log lines? it is terrible UI/UX. it sounds like data and not information, it sounds like code even which belongs to frontmatter and not in the note body?"

Cause: v0 wrote [tz=Asia/Calcutta] into its log lines. migrate-v0 kept the marker and only renamed the zone, so 9+ day notes on calternal.cloud now read - 09:30 - 13:30 [tz=Asia/Kolkata] ….

Fix:

  1. New migration rule M10: strip [tz=…] markers from log lines.
    • The day's zone already lives in frontmatter (date: carries +05:30).
    • If a line's zone differs from the note's zone, convert its times to the note's zone instead of keeping a marker, and list it in the report. In kayg's notes they are all IST.
  2. No new marker, ever: check that the daily/log plugin and the → smart note (#149) never write one. Zone data goes in frontmatter only.
  3. Clean up the live Home on calternal.cloud (user f09d9f1c-7c76-420a-a16f-8c793e541fa3). Go through the notes plugin, never by writing files behind a live room: a bulk-edit job, or a one-off action, that rewrites only those markers. It is journaled and can be undone. Ship it as a calternal admin command that Claude runs on the server.
    • Dry run first; post the count and a sample of lines changed.
  4. Tests: migrate fixtures that include [tz=Asia/Calcutta] and [tz=Europe/Berlin], plus the live clean-up on a running server with a client typing in the same note.
kayg: "why did you add 'tz=Asia/Kolkata' to so many of my notes' log lines? it is terrible UI/UX. it sounds like data and not information, it sounds like code even which belongs to frontmatter and not in the note body?" **Cause:** v0 wrote `[tz=Asia/Calcutta]` into its log lines. `migrate-v0` kept the marker and only renamed the zone, so 9+ day notes on calternal.cloud now read `- 09:30 - 13:30 [tz=Asia/Kolkata] …`. **Fix:** 1. **New migration rule M10:** strip `[tz=…]` markers from log lines. - The day's zone already lives in frontmatter (`date:` carries +05:30). - If a line's zone differs from the note's zone, convert its times to the note's zone instead of keeping a marker, and list it in the report. In kayg's notes they are all IST. 2. **No new marker, ever:** check that the daily/log plugin and the → smart note (#149) never write one. Zone data goes in frontmatter only. 3. **Clean up the live Home on calternal.cloud** (user f09d9f1c-7c76-420a-a16f-8c793e541fa3). Go through the notes plugin, never by writing files behind a live room: a bulk-edit job, or a one-off action, that rewrites only those markers. It is journaled and can be undone. Ship it as a `calternal` admin command that Claude runs on the server. - Dry run first; post the count and a sample of lines changed. 4. **Tests:** migrate fixtures that include `[tz=Asia/Calcutta]` and `[tz=Europe/Berlin]`, plus the live clean-up on a running server with a client typing in the same note.
Author
Owner

PR #179 (branch issue/151-strip-tz-markers). Not merged, not deployed, prod untouched.

Why a socket, not an authenticated action

The command has to work while the server runs, and must never write note files behind a live room. So the server does the work; the command only asks. I picked a Unix socket in the data folder (<data>/system/admin.sock, mode 0600, and the server also checks the peer is the same Unix user) over a new HTTP action:

  • nothing new is reachable from the network or through Traefik;
  • a CLI has no passkey or session, so an HTTP action would need a new admin-token concept to mint, store and leak. The file permission is the credential instead (whoever can open it can already read every note);
  • the work itself is still an ordinary bulk-edit job in the notes plugin, so history, undo and live merging are the same as for rename.
    If the data path is too long for a socket (108 bytes), it falls back to a private 0700 folder in the temp dir (found that on my own perf run).

Migration rule M10

Strips the marker; converts times when the marker's zone differs from the note's date: zone. Zones known without a tz database: Asia/Kolkata, Asia/Calcutta, UTC/GMT, Asia/Dubai, Singapore, Tokyo, and EU zones with summer time (Berlin, Paris, London...). Anything else is left as written and counted, never guessed. In kayg's notes they should all be IST, so I expect 0 lines left.

Evidence

  • Tests pass: cargo test -p calternal-migrate-v0 (36), -p calternal --bin calternal (8), --test fix_tz_live (2); clippy clean on the touched crates.
  • Perf on the 10k fixture Home (copy, 304 notes given 2 marker lines each), debug build on a machine at load ~65, so read these as an upper bound:
step time
dry run, cold (includes the Home's first scan) 34.7 s
dry run, warm 4.9 s
real run (304 notes, 608 markers, 304 lines converted) 6.7 s
undo 2.0 s
dry run after undo (finds the same 304 again) 6.8 s

It reads every note through its room once (about 0.5 ms a note in debug). It is a one-off admin command and touches no hot path, so no budget in perf/budgets.json is affected.

What kayg runs on prod (after Claude deploys this build)

The server runs in a rootless container named calternal as the host user calternal. Run the command inside that container, so it is the same user and sees the same socket:

ssh root@10.69.69.83
CAL='sudo -u calternal XDG_RUNTIME_DIR=/run/user/$(id -u calternal) podman exec calternal /usr/local/bin/calternal'
U=f09d9f1c-7c76-420a-a16f-8c793e541fa3

# 1. dry run: counts and a sample of lines, changes nothing
$CAL fix strip-tz-markers --user $U --data /data --dry-run

# 2. (optional) snapshot first
tar -C /srv/calternal-app/data -czf /srv/calternal-app/pre-151-$(date +%F).tgz users/$U

# 3. the real run; prints the job id
$CAL fix strip-tz-markers --user $U --data /data

# 4. take it back, if needed (job id from step 3)
$CAL fix undo --user $U --job JOB_ID --data /data

Please paste the step 1 output here (counts and sample). The podman-exec path is the one thing I could not test from here; the command itself is tested against a real server process.

**PR #179** (branch `issue/151-strip-tz-markers`). Not merged, not deployed, prod untouched. ### Why a socket, not an authenticated action The command has to work while the server runs, and must never write note files behind a live room. So the server does the work; the command only asks. I picked a **Unix socket in the data folder** (`<data>/system/admin.sock`, mode 0600, and the server also checks the peer is the same Unix user) over a new HTTP action: - nothing new is reachable from the network or through Traefik; - a CLI has no passkey or session, so an HTTP action would need a new admin-token concept to mint, store and leak. The file permission is the credential instead (whoever can open it can already read every note); - the work itself is still an ordinary bulk-edit job in the notes plugin, so history, undo and live merging are the same as for rename. If the data path is too long for a socket (108 bytes), it falls back to a private `0700` folder in the temp dir (found that on my own perf run). ### Migration rule M10 Strips the marker; converts times when the marker's zone differs from the note's `date:` zone. Zones known without a tz database: Asia/Kolkata, Asia/Calcutta, UTC/GMT, Asia/Dubai, Singapore, Tokyo, and EU zones with summer time (Berlin, Paris, London...). Anything else is left as written and counted, never guessed. In kayg's notes they should all be IST, so I expect `0 lines left`. ### Evidence - Tests pass: `cargo test -p calternal-migrate-v0` (36), `-p calternal --bin calternal` (8), `--test fix_tz_live` (2); clippy clean on the touched crates. - Perf on the 10k fixture Home (copy, 304 notes given 2 marker lines each), **debug build on a machine at load ~65**, so read these as an upper bound: | step | time | |---|---| | dry run, cold (includes the Home's first scan) | 34.7 s | | dry run, warm | 4.9 s | | real run (304 notes, 608 markers, 304 lines converted) | 6.7 s | | undo | 2.0 s | | dry run after undo (finds the same 304 again) | 6.8 s | It reads every note through its room once (about 0.5 ms a note in debug). It is a one-off admin command and touches no hot path, so no budget in `perf/budgets.json` is affected. ### What kayg runs on prod (after Claude deploys this build) The server runs in a rootless container named `calternal` as the host user `calternal`. Run the command **inside that container**, so it is the same user and sees the same socket: ``` ssh root@10.69.69.83 CAL='sudo -u calternal XDG_RUNTIME_DIR=/run/user/$(id -u calternal) podman exec calternal /usr/local/bin/calternal' U=f09d9f1c-7c76-420a-a16f-8c793e541fa3 # 1. dry run: counts and a sample of lines, changes nothing $CAL fix strip-tz-markers --user $U --data /data --dry-run # 2. (optional) snapshot first tar -C /srv/calternal-app/data -czf /srv/calternal-app/pre-151-$(date +%F).tgz users/$U # 3. the real run; prints the job id $CAL fix strip-tz-markers --user $U --data /data # 4. take it back, if needed (job id from step 3) $CAL fix undo --user $U --job JOB_ID --data /data ``` Please paste the step 1 output here (counts and sample). The podman-exec path is the one thing I could not test from here; the command itself is tested against a real server process.
kayg closed this issue 2026-10-14 08:22:55 +00:00
Author
Owner

Ran on calternal.cloud (build dacbc2e), 2026-10-14 08:30 UTC.

  • Dry run: 694 notes looked at; 9 would change. 79 markers to strip, 0 lines converted, 0 left as written.
  • Snapshot: /srv/calternal-app/pre-151-2026-10-14-1028.tgz.
  • Real run: job 01a13987-5649-751a-9907-d15580861c78, done, with the same counts.
  • Check: grep -rl '[tz=' *.md now finds 0 files.
Ran on calternal.cloud (build dacbc2e), 2026-10-14 08:30 UTC. - **Dry run:** 694 notes looked at; 9 would change. 79 markers to strip, 0 lines converted, 0 left as written. - **Snapshot:** `/srv/calternal-app/pre-151-2026-10-14-1028.tgz`. - **Real run:** job `01a13987-5649-751a-9907-d15580861c78`, done, with the same counts. - **Check:** `grep -rl '[tz=' *.md` now finds 0 files.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#151
No description provided.