Skip to content

fix(checkpoints): preserve cumulative transforms across repeated saves#225

Open
nodesagar wants to merge 1 commit intoc2siorg:mainfrom
nodesagar:fix/checkpoint-cumulative-saves
Open

fix(checkpoints): preserve cumulative transforms across repeated saves#225
nodesagar wants to merge 1 commit intoc2siorg:mainfrom
nodesagar:fix/checkpoint-cumulative-saves

Conversation

@nodesagar
Copy link
Copy Markdown
Contributor

Summary

This PR fixes a checkpoint/history regression where a later save could silently discard transforms that were already included in an earlier checkpoint.

Before this patch, POST /projects/{project_id}/save rebuilt project state from the original CSV plus only the unapplied change-log entries. In a flow like renameCol -> save -> addCol -> save, the second save dropped the earlier rename because only the pending addCol log was replayed.

This patch makes checkpoint creation preserve the current working copy as the source of truth and only use save to mark pending logs as applied.

Closes #224.

What changed

  • updated save_project() to read the current working copy instead of rebuilding from only the unapplied log tail
  • added a focused regression test covering the two-save case where an earlier rename must survive a later save
  • replaced the assert in the save path with an explicit 500 error if the working copy path is misconfigured

Validation

  • ruff check .
  • ruff format --check .
  • pytest tests/test_save_revert.py -q
  • pytest -q -k 'not test_add_column_without_name_returns_422'
  • npm run lint
  • npm run test -- --run
  • manual two-save repro confirmed the final saved columns remain ['name', 'years', 'city', 'country']
  • manual revert repro confirmed the latest checkpoint still restores ['name', 'years', 'city', 'country']

Note on baseline

main currently has one unrelated backend test failure in tests/test_new_features.py::TestAddDeleteColumnEndpoint::test_add_column_without_name_returns_422, which belongs to the separate addCol validation bug fixed in PR #221. Excluding that known baseline failure, the remaining backend suite passed locally on this branch.

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.

Repeated saves drop previously checkpointed transforms by rebuilding from only pending logs

1 participant