Skip to content

Fix manual checkpoint creation to detect actual workspace changes#4

Merged
christse merged 5 commits intofeature/track-stop-symbolsfrom
copilot/sub-pr-3
Feb 5, 2026
Merged

Fix manual checkpoint creation to detect actual workspace changes#4
christse merged 5 commits intofeature/track-stop-symbolsfrom
copilot/sub-pr-3

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 4, 2026

Manual checkpoints created with boxel history . -m "message" passed an empty changes array, resulting in incorrect metadata (0 files changed, always marked minor, missing file information for restore operations).

Changes

Added detectCurrentChanges() to CheckpointManager

  • Syncs workspace files and runs git status --porcelain to detect changes since last checkpoint
  • Parses all status codes: added, modified, deleted, renamed, copied, unmerged, type-changed
  • Returns accurate CheckpointChange[] for checkpoint creation

Updated manual checkpoint flow in history.ts

// Before
const checkpoint = manager.createCheckpoint('manual', [], options.message);

// After
const changes = manager.detectCurrentChanges();
const checkpoint = manager.createCheckpoint('manual', changes, options.message);

Manual checkpoints now show correct file counts, proper major/minor classification, and support accurate restoration.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] WIP Address feedback on track/stop commands Fix manual checkpoint creation to detect actual workspace changes Feb 4, 2026
Copilot AI requested a review from christse February 4, 2026 19:38
@christse christse marked this pull request as ready for review February 5, 2026 01:13
@christse christse requested a review from Copilot February 5, 2026 01:14
@christse christse merged commit bd52705 into feature/track-stop-symbols Feb 5, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where manual checkpoints created with boxel history . -m "message" were incorrectly reporting 0 files changed, always being marked as minor, and missing file information needed for restore operations. The issue was caused by passing an empty changes array to checkpoint creation.

Changes:

  • Added detectCurrentChanges() method to CheckpointManager that detects actual workspace changes by syncing files and parsing git status --porcelain output
  • Updated manual checkpoint creation in history.ts to use the new detection method instead of passing an empty array
  • The method properly handles all git status codes including added, modified, deleted, renamed, copied, unmerged, and type-changed files

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/lib/checkpoint-manager.ts Added detectCurrentChanges() method that syncs workspace files and uses git status to accurately detect changes since the last checkpoint
src/commands/history.ts Updated manual checkpoint creation to call manager.detectCurrentChanges() instead of passing an empty changes array

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@christse christse deleted the copilot/sub-pr-3 branch February 13, 2026 17:29
christse pushed a commit that referenced this pull request Apr 20, 2026
Six fixes in one commit, addressing every Copilot comment except #7
(dead code, deferred to a later cleanup pass).

#4 — manifest shape mismatch (critical):
  push.ts was still reading/writing the old manifest format
  (files[path] = hashString) while pull.ts and sync.ts use the new
  {localHash, remoteMtime} shape. push now uses the new shape,
  migrates old manifests on read (mirrors sync.ts detector), and
  refreshes remoteMtime via getRemoteMtimes() after a successful
  upload so the next pull/sync sees a consistent picture.

#3 — partial-success manifest (important):
  In --batch mode we were marking every instance as synced when
  result.uploaded > 0, even if some failed. Now we derive failed
  paths from result.errors and only add successes to the manifest.
  Failed uploads stay out and get retried on the next run.

#6 — ATOMIC_SOURCE_EXTENSIONS gap (important):
  EXTENSION_MAP was missing .tsx/.jsx/.cjs/.scss/.less/.sass, so
  those extensions got application/octet-stream and were routed
  through individual POST instead of /_atomic despite being listed
  as atomic-source compatible. Now mapped to
  application/typescript/javascript and text/x-* respectively, so
  isTextFile() returns true and they take the atomic path.

#2 — CLI --version out of sync:
  program.version() was hardcoded to '1.0.0' while package.json is
  at 1.0.1. Now reads from package.json via createRequire so
  boxel --version stays accurate on every release.

#1 — --batch-size NaN guard:
  parseInt on bad input (e.g. "abc") returned NaN, which bypasses
  `?? 10` and flows into the uploader as NaN. Now uses a
  parsePositiveInt parser that throws InvalidArgumentError with
  a friendly message on non-positive-integer input.

#5 — invalid-JSON test expectation:
  The test expected data.type='file' but the code (correctly) emits
  'source' because /_atomic only accepts 'card' and 'source'
  resource types. Test updated to match the correct contract.

All 164 tests pass (was 163/164 before this commit).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
christse pushed a commit that referenced this pull request Apr 20, 2026
Six fixes in one commit, addressing every Copilot comment except #7
(dead code, deferred to a later cleanup pass).

#4 — manifest shape mismatch (critical):
  push.ts was still reading/writing the old manifest format
  (files[path] = hashString) while pull.ts and sync.ts use the new
  {localHash, remoteMtime} shape. push now uses the new shape,
  migrates old manifests on read (mirrors sync.ts detector), and
  refreshes remoteMtime via getRemoteMtimes() after a successful
  upload so the next pull/sync sees a consistent picture.

#3 — partial-success manifest (important):
  In --batch mode we were marking every instance as synced when
  result.uploaded > 0, even if some failed. Now we derive failed
  paths from result.errors and only add successes to the manifest.
  Failed uploads stay out and get retried on the next run.

#6 — ATOMIC_SOURCE_EXTENSIONS gap (important):
  EXTENSION_MAP was missing .tsx/.jsx/.cjs/.scss/.less/.sass, so
  those extensions got application/octet-stream and were routed
  through individual POST instead of /_atomic despite being listed
  as atomic-source compatible. Now mapped to
  application/typescript/javascript and text/x-* respectively, so
  isTextFile() returns true and they take the atomic path.

#2 — CLI --version out of sync:
  program.version() was hardcoded to '1.0.0' while package.json is
  at 1.0.1. Now reads from package.json via createRequire so
  boxel --version stays accurate on every release.

#1 — --batch-size NaN guard:
  parseInt on bad input (e.g. "abc") returned NaN, which bypasses
  `?? 10` and flows into the uploader as NaN. Now uses a
  parsePositiveInt parser that throws InvalidArgumentError with
  a friendly message on non-positive-integer input.

#5 — invalid-JSON test expectation:
  The test expected data.type='file' but the code (correctly) emits
  'source' because /_atomic only accepts 'card' and 'source'
  resource types. Test updated to match the correct contract.

All 164 tests pass (was 163/164 before this commit).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.

3 participants