Skip to content

feat: add SQLite ORM backend via ncruces/go-sqlite3#278

Draft
Copilot wants to merge 12 commits intomainfrom
copilot/add-sqlite3-backend-support
Draft

feat: add SQLite ORM backend via ncruces/go-sqlite3#278
Copilot wants to merge 12 commits intomainfrom
copilot/add-sqlite3-backend-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

  • Update config/generated.go to use fixed placeholder values (N/A, 0.0.1-SNAPSHOT) matching make restore-generated-file output
  • Verify config package compiles
  • LastFrameworkCommitLog/LastFrameworkVendorCommitLog remain in separate generated_framework-info.go (generated by Makefile, gitignored)

Copilot AI and others added 2 commits April 18, 2026 05:13
Implement a lightweight SQLite-based ORM storage backend as an
alternative to the existing Elasticsearch backend. The new module
follows the same orm.ORM interface pattern and is registered via
orm.Register("sqlite", handler).

Key features:
- JSON document storage with SQLite json_extract for queries
- Full ORM interface: CRUD, Search, SearchV2, DeleteByQuery
- QueryBuilder to SQL WHERE clause translation
- WAL mode for concurrent read performance
- Comprehensive test coverage (17 tests)

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/c7adba2d-c701-4bd0-9c10-ec59d79b4ae0

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
- Remove redundant variable assignment in RegisterSchemaWithName
- Fix Search and SearchWithResultItemMapper to return correct total
  count via separate COUNT query instead of counting fetched rows

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/c7adba2d-c701-4bd0-9c10-ec59d79b4ae0

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
@medcl medcl changed the title Add SQLite ORM backend via ncruces/go-sqlite3 feat: add SQLite ORM backend via ncruces/go-sqlite3 Apr 18, 2026
This file is in .gitignore and should not be tracked.
It is generated by the build process.

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Copilot AI and others added 2 commits April 18, 2026 16:25
…tterns

Add 12 new tests covering the complex nested query patterns used by
the security search operation hook (RegisterSearchOperationHook):
- Must wrapping ShouldQuery with minimum_should_match
- Owner-only queries (no sharing)
- Should with shared resource IDs
- Category filter with owner
- Nested BooleanQuery inside Should (folder access + deny rules)
- Should with MustNot folder deny rules
- Dotted field paths (_system.owner_id, _system.parent_path)
- Filter with MustQuery wrapper
- Full search hook simulation with all patterns combined
- Multiple folder allow/deny paths
- Category children sharing
- Empty ShouldQuery edge case

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/8d394cd4-0c76-4a0e-9db1-f463b0a2006f

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Copilot AI and others added 2 commits April 18, 2026 23:56
…e ORM

Add 7 new integration tests verifying the SQLite backend correctly
handles the patterns used by RegisterDataOperationPreHook for Create,
Update, and Save operations:
- System field round-trip (Create with _system.owner_id, Get, verify)
- Update preserving system fields after deserialization
- Save (upsert) with SystemFieldAccessor interface
- GetOwnerID and Object/SystemFieldAccessor interface after SQLite
  deserialization
- SearchV2 filtering by _system.owner_id via json_extract
- SearchV2 with ShouldQuery combining owner OR shared IDs
- DeleteByQuery filtering by _system.owner_id

Also add missing constants to config/generated.go for build
compatibility.

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/39670c0d-37f0-4903-969b-1c006bf7cdab

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Copilot AI and others added 2 commits April 19, 2026 01:22
Update clauseToSQL to properly read and respect the minimum_should_match
parameter from clause.Parameters:

- When minimum_should_match >= 1: should clauses are required (OR join)
- When only 1 should clause with min_should_match=1: treat as mandatory
  (no unnecessary OR wrapping)
- When minimum_should_match is unset and no must/filter exist: default
  to requiring at least 1 match (Elasticsearch semantics)
- When minimum_should_match is unset with must/filter present: should
  clauses are optional (scoring-only in ES, safely skipped in SQLite)

Add unit tests:
- SingleShouldMinShouldMatch1_IsMandatory
- SingleShouldWithFilterAndMinShouldMatch1
- OptionalShouldWithoutMinShouldMatch

Add integration test:
- SearchV2_SingleShouldOwnerIsMandatory (end-to-end with real SQLite DB)

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/dc353da8-ad60-4779-86ff-b7a7e5d614d2

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
This file is gitignored and regenerated at build time by the Makefile.
The LastFrameworkCommitLog and LastFrameworkVendorCommitLog constants
are generated separately into config/generated_framework-info.go.

Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/3922a466-05d7-40bf-8429-fc6e3821230d

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
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.

2 participants