Conversation
There was a problem hiding this comment.
🟡 Changes recommended
sqlite_file_index::status() can incorrectly report measures as current for unreadable/deleted files, and integer any_of query generation can create problematic SQL without consistent binding behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a reusable SQLite-backed file indexing subsystem for Ygor, including a generic query/predicate API, filesystem-derived builtin measures, and GPX-specific measures for geographic extents and coverage-cell indexing.
Changes:
- Add core SQLite-backed index storage, measure registration/extraction, and query execution with completeness policies.
- Add GPX indexing measures (latitude/longitude extents and coverage-cell rasterization) plus helpers to build coverage predicates from geographic bounds.
- Add doctest coverage for generic indexing/querying and GPX behavior, and wire SQLite3 into build/CI/packaging dependencies.
File summaries
| File | Description |
|---|---|
| tests2/YgorFileIndex.cc | Adds doctest coverage for generic and GPX file-index behaviors. |
| tests2/compile_and_run.sh | Includes the new file-index doctest unit in the tests2 build. |
| src/YgorFileIndex.h | Defines the public file index API (measures, predicates, policies, sqlite_file_index). |
| src/YgorFileIndex.cc | Implements predicate builders, sqlite_file_index orchestration, and builtin filesystem measures. |
| src/YgorFileIndexPrivate.hpp | Introduces internal SQLite helpers, validation, and the sqlite_file_index pimpl definition. |
| src/YgorFileIndexSQLite.cc | Implements SQLite schema init/versioning and fact/state persistence routines. |
| src/YgorFileIndexQuery.cc | Implements query SQL generation/execution, per-measure status, and completion tracking. |
| src/YgorFileIndexGPX.h | Declares GPX-specific measures and coverage predicate helpers. |
| src/YgorFileIndexGPX.cc | Implements GPX parsing, extents computation, and sparse segment coverage-cell rasterization. |
| src/CMakeLists.txt | Adds SQLite3 dependency discovery and links it into the Ygor library. |
| PKGBUILD | Adds sqlite to Arch package dependencies. |
| .gitlab-ci.yml | Installs SQLite dev/runtime packages in CI images. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+140
to
+150
| if(predicate.measure.kind == file_index_value_kind::integer){ | ||
| std::string out = "x.integer_value IN ("; | ||
| for(std::size_t i = 0; i < values.size(); ++i){ | ||
| if(i != 0){ | ||
| out += ','; | ||
| } | ||
| out += std::to_string(std::get<int64_t>(values[i])); | ||
| } | ||
| out += ')'; | ||
| return out; | ||
| } |
Comment on lines
+258
to
+267
| auto size = file_statement.column_int64(1); | ||
| auto mtime = file_statement.column_int64(2); | ||
| if(Does_File_Exist_And_Can_Be_Read(path)){ | ||
| const auto disk_size = static_cast<int64_t>(Size_of_File(path)); | ||
| const auto disk_mtime = static_cast<int64_t>(Last_Modification_Time(path)); | ||
| if((disk_size >= 0) && (disk_mtime >= 0)){ | ||
| size = disk_size; | ||
| mtime = disk_mtime; | ||
| } | ||
| } |
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.
Summary
Add a reusable, SQLite-backed file indexing layer to Ygor. The API keeps SQLite details private and exposes runtime-configurable typed measures, extractor registration, freshness tracking, generic predicates, and filename-only queries.
Generic index
missing,current,stale,failed, andknown_emptystatemissing,stale, andallrefresh policiesknown_only,include_unknown, andrequire_completequery policiesexists,equal,between,overlaps, andany_ofpredicatesapplication_id/user_versionGPX measures
Tests and build integration
tests2conventionsValidation
Performed lightweight local C++17 compilation/smoke checks of the new source units and core query/GPX behavior. Per the requested workflow, this PR was prepared without waiting for the full project build or CI test suites to complete.