Implement RevertToCheckpoint functionality and improve error handling#9286
Open
khanaffan wants to merge 6 commits into
Open
Implement RevertToCheckpoint functionality and improve error handling#9286khanaffan wants to merge 6 commits into
khanaffan wants to merge 6 commits into
Conversation
| * See LICENSE.md in the project root for license terms and full copyright notice. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { DbResult, GuidString, Id64, Id64String } from "@itwin/core-bentley"; | ||
| import { DbResult, Guid, GuidString, Id64, Id64String, Logger, LogLevel, OpenMode } from "@itwin/core-bentley"; |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an @Alpha backend API to revert a briefcase to a checkpoint by diffing against a target checkpoint and applying the inverse, along with new standalone tests validating revert behavior (including schema + data reverts, and error cases).
Changes:
- Added
BriefcaseDb.revertToCheckpoint(...)and newRevertToCheckpointArgstype (file-path or V2-checkpoint changeset index). - Added standalone tests covering revert-to-checkpoint flows and rejection cases (unsaved changes, pending txns).
- Updated API extraction outputs and added a rush change file.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts | Adds revertToCheckpoint test suite validating revert + push/pull behavior and error handling scenarios. |
| core/backend/src/IModelDb.ts | Introduces BriefcaseDb.revertToCheckpoint implementation with precondition checks and V2-checkpoint support. |
| core/backend/src/BriefcaseManager.ts | Defines RevertToCheckpointArgs discriminated union for checkpoint target selection. |
| common/changes/@itwin/core-backend/affank-revert-to-version_2026-05-12-01-44.json | Adds changelog entry (type none). |
| common/api/summary/core-backend.exports.csv | Exposes new alpha export RevertToCheckpointArgs. |
| common/api/core-backend.api.md | Updates extracted API to include revertToCheckpoint and RevertToCheckpointArgs. |
| * See LICENSE.md in the project root for license terms and full copyright notice. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { DbResult, GuidString, Id64, Id64String } from "@itwin/core-bentley"; | ||
| import { DbResult, Guid, GuidString, Id64, Id64String, Logger, LogLevel, OpenMode } from "@itwin/core-bentley"; |
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.
imodel-native: iTwin/imodel-native#1419
This pull request introduces new APIs and implementations for efficiently reverting an iModel database to a previous version by computing and applying the difference between versions, with robust error handling and test coverage. The main changes include new diffing methods in
ChangeTracker, theRevertToVersionimplementation inTxnManager, and comprehensive tests to validate the new functionality. Node.js bindings are also updated to expose the new revert capability.