Skip to content

Consolidate history and baseline into single file#14

Merged
rwdaigle merged 6 commits intomainfrom
ryan/baseline-docs
Feb 4, 2026
Merged

Consolidate history and baseline into single file#14
rwdaigle merged 6 commits intomainfrom
ryan/baseline-docs

Conversation

@rwdaigle
Copy link
Contributor

@rwdaigle rwdaigle commented Feb 4, 2026

Summary

  • Rename .history to history (non-hidden file)
  • Consolidate baseline metadata directly into the history file using a special line format: baseline: version timestamp [summary]
  • Add automatic migration from legacy .history and .baseline files for backwards compatibility
  • Simplify state management with unified HistoryState struct

Test plan

  • All 46 tests pass, including integration and fixture operation tests
  • Backwards compatibility verified: legacy files are automatically migrated and deleted on first read
  • Pre-commit hooks (formatting, clippy, tests) all pass

🤖 Generated with Claude Code


Open with Devin

rwdaigle and others added 2 commits February 4, 2026 09:36
Rename .history to history and integrate baseline metadata directly into the history file as a special line format (baseline: version timestamp [summary]). Provides backwards compatibility by automatically migrating legacy .history and .baseline files on first read. Simplifies state management by using a unified HistoryState struct containing both applied migrations and baseline information.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
README.md and CLAUDE.md still referenced the old .history and .baseline
files. Updated to document the new unified `history` file format.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View issue and 4 additional flags in Devin Review.

Open in Devin Review

rwdaigle and others added 4 commits February 4, 2026 09:42
Use origin/main instead of main for all git diff commands to ensure
comparisons are against the actual remote state, not a potentially
stale local branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate history and baseline into single file format.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, the migration condition only checked for .history files,
causing .baseline-only scenarios to be silently ignored. This could
happen if a user created a baseline without ever running migrations.

Now properly migrates legacy .baseline files even when no .history
file exists.

Adds test coverage for this edge case.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rwdaigle rwdaigle merged commit ad410cc into main Feb 4, 2026
4 checks passed
@rwdaigle rwdaigle deleted the ryan/baseline-docs branch February 4, 2026 14:47
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View issue and 8 additional flags in Devin Review.

Open in Devin Review

Choose a reason for hiding this comment

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

🔴 validate_baseline fails to account for migrations covered by existing baseline

The validate_baseline function prevents moving a baseline forward when migrations covered by an existing baseline are not in the applied history.

Click to expand

Scenario

  1. User creates a baseline at version 1f700 (migration files deleted, baseline recorded)
  2. User applies new migrations 1f710 and 1f720 (these get recorded in history)
  3. User tries to move baseline forward to 1f720
  4. Validation fails with "Cannot baseline: migration '1f700-xxx' has not been applied"

Root Cause

At src/baseline.rs:64-71, the validation checks that ALL migrations at or before the target version are in the applied list:

for migration in available {
    if version_lte(&migration.version, version) && !applied_ids.contains(migration.id.as_str())
    {
        bail!("Cannot baseline: migration '{}' has not been applied", migration.id);
    }
}

However, the function receives existing_baseline (line 41) but only uses it to check for backward movement (lines 50-57). It doesn't consider that migrations at or before the existing baseline version should be treated as "applied" for validation purposes.

Impact

Users cannot advance their baseline once they have an initial baseline set, unless all prior migrations happen to still exist in the applied history. This breaks the intended workflow of progressively moving baselines forward over time.

(Refers to lines 64-71)

Recommendation: Modify the validation to also consider migrations covered by the existing baseline as 'applied'. Add a check like: if let Some(b) = existing_baseline { if version_lte(&migration.version, &b.version) { continue; } } before checking the applied_ids.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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