Skip to content

fix(chronicle): backup append entries to mktemp, not entries/#32

Merged
argen merged 1 commit into
mainfrom
fix/chronicle-append-backup-mktemp
May 20, 2026
Merged

fix(chronicle): backup append entries to mktemp, not entries/#32
argen merged 1 commit into
mainfrom
fix/chronicle-append-backup-mktemp

Conversation

@argen

@argen argen commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #30. A code-review agent flagged that `cp "$target" "${target}.append-backup"` was collision-prone: if a prior `chronicle.sh append` was killed between the cp and the success path (OS signal, validator hung), the next run would silently clobber the orphaned backup with the (possibly already mutated) live entry, destroying the only good copy.

Fix: use `mktemp -t` for both the backup and the awk tmp file so they land in $TMPDIR with unique names. Collisions are impossible, and `chronicle/entries/` stays free of script-internal files even after a crash.

Commits

  • `8374a6b` — single-file change in `scripts/chronicle.sh`.

Test plan

  • `scripts/test-chronicle.sh` — 33/33 still pass
  • After merge: run `chronicle.sh append` against a seeded entry, simulate a kill mid-run, confirm next run completes without clobbering

🤖 Generated with Claude Code

A reviewer flagged that \`cp "\$target" "\${target}.append-backup"\` was
collision-prone — if a prior \`chronicle.sh append\` was killed between
the cp and the success path (OS signal, validator hung), the next run
would silently clobber the orphaned backup with the (possibly already
mutated) live entry, destroying the only good copy.

Fix: use \`mktemp -t\` so backup and tmp files land in \$TMPDIR with
unique names. Collisions are now impossible, and chronicle/entries/
stays free of script-internal files even after a crash.

No test changes; harness still 33/33.
@argen argen merged commit 290be64 into main May 20, 2026
1 check failed
@argen argen deleted the fix/chronicle-append-backup-mktemp branch May 20, 2026 22:06
argen added a commit that referenced this pull request May 20, 2026
…#37)

Three PRs landed this session (#30 chronicle append-semantics, #31
resources layer PR 2, #32 mktemp fix) and the front-door docs hadn't
caught up. Updated counts and added coverage for what shipped:

- README:
  - Skill count: 37 → 38 PM (added hubspot-pipeline-readout in #31).
  - Cross-role count: 8 → 16 (added ingest, prep, review,
    hypothesis-track, stakeholder-update, customer-update,
    query-issue-tracker, query-warehouse).
  - Slash commands: 6 → 12 (matched the new skills).
  - Themes table: hubspot-pipeline-readout added under Operations.
  - Cross-role list restructured into four sub-groups (harness
    primitives / chronicle write+read / chronicle append-shaped /
    chronicle workflow / cross-system primitives).
  - Resources table: jira/bigquery/snowflake/hubspot promoted to
    stable with their consumer skills named; github added explicitly;
    claude.ai-native cards (canva, gmail, google-calendar,
    google-drive, intercom) folded into the stable group.
  - Chronicle section rewritten to cover all four entry types
    (decision / hypothesis / stakeholder / customer), the sourcing
    hierarchy, and the append exception with the three append-shaped
    skills.
  - New /catalog table rows for /ingest, /prep, /review, and the
    three append commands.

- DISPATCHER: "eight cross-role" → "sixteen cross-role".

- playbooks/onboarding.md, role-cheatsheet.md: skill counts updated
  to match.

No content changes outside doc strings; smoke-check still 12/12.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant