Working copy and publishing for guides (#106) #112

Merged
miko merged 1 commit from feature/106-working-copy-and-publish into development 2026-11-05 13:31:46 +01:00
Owner

Closes #106

Edits to a published guide now go to its working copy. Readers, editors included, keep seeing the latest version until someone publishes again.

What changes

  • Storage: every publish stores the guide's content as a GuideVersion: a JSON snapshot plus who published it, when, and an optional note. Protective equipment (#95) counts as content.
  • Readers: the reading view, print and PDF, category grids, menu, search and /media all read the latest version.
  • Editor:
    • "Unpublished changes" badge
    • Publish dialog with an optional change note
    • Discard changes, after a confirmation
    • Preview
  • Reading view: editors get a hint with a link to the preview at /guides/<id>/preview. Guests get a 404 there, and preview is now a reserved slug.
  • Publishing rules: publishing only creates a version if the working copy changed. Unpublishing and soft delete keep the versions. The attribution line and "last edited" show who published the visible version, and when.
  • Image files: deleted only once neither a working copy nor a version references them.
  • Migration: the migration only creates the tables. Each published guide gets its first version at server start (ensureFirstVersions, src/instrumentation.ts), so MySQL and MariaDB don't each need their own SQL JSON building.
  • Docs: ADR-0020 supersedes ADR-0008. GLOSSARY gains Working Copy and Version, and Draft is clarified.

Tests

  • Unit tests: cover the snapshot (including JSON round-trip and float precision), the reader and list overlays, image access, and unreferenced files.
  • E2E: a new workingCopy.spec. access.spec is adjusted to the new behaviour, and the authoring.spec locator that had been failing since #90 is fixed.
  • 432 unit tests pass. The full e2e suite passed (55/55) on its last full run; after the review fixes only the unit tests and workingCopy.spec were rerun.

🤖 Generated with Claude Code

Closes #106 Edits to a published guide now go to its **working copy**. Readers, editors included, keep seeing the **latest version** until someone publishes again. ## What changes - **Storage:** every publish stores the guide's content as a `GuideVersion`: a JSON snapshot plus who published it, when, and an optional note. Protective equipment (#95) counts as content. - **Readers:** the reading view, print and PDF, category grids, menu, search and `/media` all read the latest version. - **Editor:** - "Unpublished changes" badge - **Publish** dialog with an optional change note - **Discard changes**, after a confirmation - **Preview** - **Reading view:** editors get a hint with a link to the preview at `/guides/<id>/preview`. Guests get a 404 there, and `preview` is now a reserved slug. - **Publishing rules:** publishing only creates a version if the working copy changed. Unpublishing and soft delete keep the versions. The attribution line and "last edited" show who published the visible version, and when. - **Image files:** deleted only once neither a working copy nor a version references them. - **Migration:** the migration only creates the tables. Each published guide gets its first version at server start (`ensureFirstVersions`, `src/instrumentation.ts`), so MySQL and MariaDB don't each need their own SQL JSON building. - **Docs:** ADR-0020 supersedes ADR-0008. GLOSSARY gains Working Copy and Version, and Draft is clarified. ## Tests - **Unit tests:** cover the snapshot (including JSON round-trip and float precision), the reader and list overlays, image access, and unreferenced files. - **E2E:** a new `workingCopy.spec`. `access.spec` is adjusted to the new behaviour, and the `authoring.spec` locator that had been failing since #90 is fixed. - 432 unit tests pass. The full e2e suite passed (55/55) on its last full run; after the review fixes only the unit tests and `workingCopy.spec` were rerun. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Edits to a published guide go to its working copy; readers keep seeing
the latest version until someone publishes again. Every publish stores
the content as a GuideVersion (JSON snapshot, publisher, optional note).
The reading view, print/PDF, category grids, menu, search and /media read
the latest version; editors get an "unpublished changes" badge with
Publish and Discard, and a preview of the working copy. Image files are
kept while a version references them. Published guides get their first
version at server start (ensureFirstVersions). ADR-0020 supersedes
ADR-0008; GLOSSARY gains Working Copy and Version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 28fdb7d38e into development 2026-11-05 13:31:46 +01:00
Sign in to join this conversation.
No reviewers
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
MassiveDynamic/kataba!112
No description provided.