Skip to content

feat(hunts): implement versioning for hunt edits with restore functio… - #1213

Merged
Samuel1-ona merged 1 commit into
Samuel1-ona:mainfrom
directorfloo:FEATUndoandversionhistoryforhuntedits
Aug 27, 2026
Merged

feat(hunts): implement versioning for hunt edits with restore functio…#1213
Samuel1-ona merged 1 commit into
Samuel1-ona:mainfrom
directorfloo:FEATUndoandversionhistoryforhuntedits

Conversation

@directorfloo

Copy link
Copy Markdown

Closes #1195

Add Hunt Version History and Restore

Summary

Adds durable version history for creator hunt edits and allows creators to restore previous versions.

Each submitted hunt snapshot is stored in PostgreSQL with a per-hunt version number, creator address, and timestamp. Restoring a version creates a new version instead of overwriting history.

Acceptance Criteria

Criterion Status
Hunt edits are versioned Complete via PATCH /api/v1/hunts/[id]
Creator can restore a previous version Complete via POST /api/v1/hunts/[id]/versions/[version]/restore
History has a documented retention period Complete; versions are retained for 90 days

API Changes

  • PATCH /api/v1/hunts/[id]

    • Stores a submitted hunt snapshot as the next version.
    • Requires actorAddress.
    • Verifies the actor matches the hunt creator.
  • GET /api/v1/hunts/[id]/versions

    • Lists version metadata, newest first.
    • Requires the creator address.
  • POST /api/v1/hunts/[id]/versions/[version]/restore

    • Restores the selected snapshot by creating a new version.
    • Does not delete or overwrite existing history.

Persistence

Added the hunt_versions PostgreSQL table with:

  • Per-hunt version numbers
  • Full JSONB hunt snapshots
  • Creator wallet address
  • Creation timestamp
  • Indexes for history and retention cleanup

Version numbering uses PostgreSQL advisory locks to prevent duplicate versions during concurrent edits.

On-chain hunt creation records remain immutable. This feature versions the mutable application snapshot.

Documentation

Updated:

  • docs/api.md
  • docs/persistence-strategy.md

The documented retention period is 90 days. Expired versions are excluded from reads and removed during subsequent writes.

Validation

  • Editor diagnostics: passed
  • git diff --check: passed
  • Typecheck: blocked because tsc is unavailable in the current environment
  • Tests: blocked because vitest is unavailable in the current environment

@Samuel1-ona
Samuel1-ona merged commit 0b8ed30 into Samuel1-ona:main Aug 27, 2026
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.

[FEAT] Undo and version history for hunt edits

2 participants