Skip to content

Add NativeChangesetReader API with filtering#9140

Merged
soham-bentley merged 101 commits into
masterfrom
soham/native-ec-reader
Apr 27, 2026
Merged

Add NativeChangesetReader API with filtering#9140
soham-bentley merged 101 commits into
masterfrom
soham/native-ec-reader

Conversation

@soham-bentley

@soham-bentley soham-bentley commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

imodel-native: iTwin/imodel-native#1368

In Phase 1 (this PR):

  • We give lazy property loading - using three property filters(InstanceKey, BisCoreElement, All)
  • We can now open multiple changeset files in the form of a changeset group
  • We can decode arrays properly.
  • We use the standard EC-to-JSON adaptor
  • We give data on a row by row basis using our JSON adaptor
  • We support rich metadata like operation type and isIndirectChange flag
  • We support filtering based on operation(Inserted or Updated or Deleted), table names and classNames.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new native-backed EC changeset/txn reader to core/backend and a unifier utility to merge per-table partial EC change rows into complete EC instances, with a standalone test validating openTxn() behavior against a locally-saved transaction.

Changes:

  • Introduces ECChangesetReader (openFile/openGroup/openLocalChanges/openInMemoryChanges/openTxn) implementing ECNativeChangeSource.
  • Adds ECNativePartialChangeUnifier plus in-memory and SQLite-backed cache implementations for merging partial instances.
  • Adds a standalone test exercising openTxn() + unification for an inserted element and updated model rows.

Reviewed changes

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

File Description
core/backend/src/ECChangesetReader.ts New native changeset/txn reader + partial-change unifier + cache implementations.
core/backend/src/test/standalone/ECChangesetReader.test.ts New standalone test validating openTxn() reading and unification results.

Comment thread core/backend/src/ECChangesetReader.ts Outdated
Comment thread core/backend/src/ECChangesetReader.ts Outdated
Comment thread core/backend/src/ECChangesetReader.ts Outdated
Comment thread core/backend/src/ECChangesetReader.ts Outdated
Comment thread core/backend/src/test/standalone/ECChangesetReader.test.ts Fixed
@soham-bentley soham-bentley marked this pull request as ready for review April 3, 2026 17:23
@soham-bentley soham-bentley requested a review from a team as a code owner April 3, 2026 17:23
@soham-bentley

Copy link
Copy Markdown
Contributor Author

@khanaffan @rschili I have added as much extensive testing as possible. But still if you fee something more can or should be tested
Please feel free to mention it in the PR

@soham-bentley

soham-bentley commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

I have taken absolutely separate code path in my new ChangesetReader and unifier API
Because the existing ChangesetECAdaptor and unifier API will be deprecated and removed in some time, so forcefully unifying the logic didn't make sense. It would have made the code unnecessarily complex. Instead this new unifier and ChangesetReader API and its exported types can become the standard going forward (if everybody agrees).

soham-bentley and others added 8 commits April 23, 2026 11:21
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
Comment thread core/backend/src/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.ts Dismissed
soham-bentley and others added 3 commits April 23, 2026 21:16
Co-authored-by: Copilot <copilot@github.com>
ChangesetReader -> SqliteChangesetReader
ECChangesetreader -> ChangesetReader
As per Affan's request

Co-authored-by: Copilot <copilot@github.com>
@soham-bentley soham-bentley changed the title Add NativeECChangesetReader API with filtering Add NativeChangesetReader API with filtering Apr 24, 2026
@imodeljs-admin imodeljs-admin requested review from a team, aruniverse and wgoehrig as code owners April 27, 2026 09:04
@soham-bentley soham-bentley enabled auto-merge (squash) April 27, 2026 11:14
@soham-bentley soham-bentley merged commit 4e55029 into master Apr 27, 2026
18 checks passed
@soham-bentley soham-bentley deleted the soham/native-ec-reader branch April 27, 2026 13:18
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.

8 participants