feat(#233): expand snapshot JSON to capture timeline state (Phase 1 of Resource Optimiser)#234
Merged
NickMonrad merged 2 commits intomainfrom Apr 29, 2026
Merged
Conversation
- Snapshot JSON now versioned (schemaVersion: 2) - Captures: project settings, resource types, named resources, timeline entries, story timeline entries, epic deps, feature deps, overhead items - Rollback restores all captured state in a transaction - Auto-creates pre_rollback snapshot before applying any rollback - CSV import snapshot now uses shared buildSnapshot() to ensure full state capture - Backwards compatible with v1 (array-shape) snapshots — legacy ones treated as epics-only Prerequisite for #233 Phase 2-4 (Resource Optimiser). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of 4 for Resource Optimiser (#233). Expands
BacklogSnapshot.snapshotJSON to capture full project timeline state so future optimiser runs can be safely rolled back.No schema change — purely an expansion of the existing JSON blob shape, gated behind
schemaVersion: 2. Legacy v1 snapshots (top-level epic array) are still readable and rollback-able.Changes
Snapshot v2 shape
buildSnapshot()now captures:epics— full epic/feature/story/task tree (existing)project— project-level scheduling fields (hoursPerDay,startDate, etc.)resourceTypes— all RTs with counts, allocations, named resource refsnamedResources— start/end weeks, allocationstimelineEntries+storyTimelineEntries— current scheduleepicDependencies+featureDependencies— manual dep linksoverheadItems— project overhead configRollback handler
Array.isArray()/schemaVersioncheck$transaction:rtNameMapfor FK resolution)cuid()s, ID maps for FKs)epicIdMap/storyIdMap)trigger: 'pre_rollback') created BEFORE the transaction; deleted if transaction failsCSV import refactor
csv.tsnow calls sharedbuildSnapshot()for its auto-snapshot instead of inline epic-only capture.Test mocks
setup.tsupdated withupsert,deleteMany,createManystubs for the new transaction methods.Review fixes applied (sub-agent code review cycle)
findUnique+ branch with atomicprisma.upsertfor RT and NamedResource (avoids TOCTOU)Tests
npx tsc --noEmit— ✅ cleannpm test(server) — ✅ 142/142 passingPhases
POST /projects/:id/optimiseendpoint with modes (Speed / Utilisation / Balanced)Refs #233