Skip to content

feat(clp-s::filter): Add interfaces and definitions for the top-level… - #2381

Open
ShangDanLuXian wants to merge 3 commits into
y-scope:mainfrom
ShangDanLuXian:top_level_indexing
Open

feat(clp-s::filter): Add interfaces and definitions for the top-level…#2381
ShangDanLuXian wants to merge 3 commits into
y-scope:mainfrom
ShangDanLuXian:top_level_indexing

Conversation

@ShangDanLuXian

@ShangDanLuXian ShangDanLuXian commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds the core definitions and interfaces for a top-level indexing framework for clp-s.
The framework will allow indexes to be built over groups of archives and packed into a single
"Packed Filter" object, which can then be used at search time to prune archives that cannot
contain any results matching a query. This is the first PR in a series; it contains only
headers (interfaces and definitions) and a unit test, with no behavior changes.

Specifically, this PR adds:

  • IndexDefs.hpp: Core types for the framework:
    • index_id_t, a 16-bit index-type identifier whose ID space is partitioned into reserved
      ranges (official open-source, official closed-source, and custom indices).
    • index_version_t and archive_version_t, 32-bit semantic versions encoded the same way as
      clp-s archive versions, with constexpr helpers to encode and decompose them.
    • ArchiveSection and archive_section_bitmap_t, a flag set describing which sections of an
      archive an index needs to read while building.
  • IndexBuilder.hpp: The interface for building an index. The framework feeds an implementation
    one archive at a time, and the implementation produces one self-delimiting serialized blob per
    archive.
  • IndexRunner.hpp: The interface for using a deserialized index at filtering time. A runner
    narrows the set of candidate archives for a query by clearing bits in a
    CandidateArchiveBitmapView (built on the BitmapView class introduced in feat(clp-s::filter): Add BitmapView class for bitmaps passed across FFI boundaries. #2337).
  • IndexBuilderSpecification.hpp: Describes a registered IndexBuilder implementation: the
    archive sections it reads, the half-open range of archive versions it supports, its index
    version, and a factory for creating instances of it.
  • PackedFilterSpecification.hpp: A framework-provided description of the Packed Filter being
    built (archive count and the shared archive version).

Follow-up PRs will add the index registry, the Packed Filter on-disk format (writer/reader), and
a first concrete index implementation (a Bloom filter over each archive's variable dictionary).

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Ran the new unit test (test-clp_s-index_defs.cpp); all 3 test cases (15 assertions) pass. The
    test covers index-version encode/decode round-tripping, Index ID range classification
    (including range boundaries), and ArchiveSection bitmap composition and membership checks.

Summary by CodeRabbit

  • New Features

    • Added foundational support for defining, versioning, and classifying Packed Filter indexes.
    • Added interfaces for building per-archive index data and filtering candidate archives.
    • Added Packed Filter metadata for archive counts and versions.
    • Added archive-section bitmap utilities and index version compatibility checks.
  • Tests

    • Added coverage for index versioning, ID classification, and archive-section bitmap operations.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Packed Filter index foundations

Layer / File(s) Summary
Index metadata contracts
components/core/src/clp_s/filter/IndexDefs.hpp, components/core/src/clp_s/filter/PackedFilterSpecification.hpp, components/core/src/clp_s/filter/IndexBuilderSpecification.hpp
Adds index IDs, version encoding, archive-section bitmaps, Packed Filter metadata, version-range checks, and builder factory creation.
Index builder and runner interfaces
components/core/src/clp_s/filter/IndexBuilder.hpp, components/core/src/clp_s/filter/IndexRunner.hpp
Defines interfaces for producing archive index blobs and filtering candidate archive bitmaps.
Build integration and utility validation
components/core/cmake/Options/options.cmake, components/core/src/clp_s/filter/CMakeLists.txt, components/core/src/clp_s/CMakeLists.txt, components/core/src/clp_s/filter/tests/test-clp_s-index_defs.cpp
Registers the new sources, links nlohmann-json, enables its dependency flag, and tests index utility behaviour.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: gibber9809

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: new clp-s::filter interfaces and definitions for the top-level indexing framework.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ShangDanLuXian
ShangDanLuXian marked this pull request as ready for review July 20, 2026 12:51
@ShangDanLuXian
ShangDanLuXian requested review from a team and gibber9809 as code owners July 20, 2026 12:51

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/core/src/clp_s/filter/PackedFilterSpecification.hpp`:
- Line 6: Change intra-target includes to quoted relative headers: in
components/core/src/clp_s/filter/PackedFilterSpecification.hpp lines 6-6 use
"IndexDefs.hpp"; in
components/core/src/clp_s/filter/IndexBuilderSpecification.hpp lines 10-12 use
"IndexBuilder.hpp", "IndexDefs.hpp", and "PackedFilterSpecification.hpp"; and in
components/core/src/clp_s/filter/IndexRunner.hpp lines 9-9 use "BitmapView.hpp".
Keep angle brackets only for external-target dependencies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6b3be727-c21c-4f2f-b732-dffb015a37de

📥 Commits

Reviewing files that changed from the base of the PR and between e60de7d and 9edc654.

📒 Files selected for processing (9)
  • components/core/cmake/Options/options.cmake
  • components/core/src/clp_s/CMakeLists.txt
  • components/core/src/clp_s/filter/CMakeLists.txt
  • components/core/src/clp_s/filter/IndexBuilder.hpp
  • components/core/src/clp_s/filter/IndexBuilderSpecification.hpp
  • components/core/src/clp_s/filter/IndexDefs.hpp
  • components/core/src/clp_s/filter/IndexRunner.hpp
  • components/core/src/clp_s/filter/PackedFilterSpecification.hpp
  • components/core/src/clp_s/filter/tests/test-clp_s-index_defs.cpp


#include <cstddef>

#include <clp_s/filter/IndexDefs.hpp>

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.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use quoted relative includes for headers within the same CMake target.

Based on learnings, headers within components/core/src/clp_s/** should use quoted relative includes (e.g., "IndexDefs.hpp") when including other headers from the same CMake target, and reserve angle-bracket includes for external targets. Since these files and their dependencies belong to the clp_s_filter target, they should use relative quotes for these intra-target dependencies.

  • components/core/src/clp_s/filter/PackedFilterSpecification.hpp#L6-L6: replace <clp_s/filter/IndexDefs.hpp> with "IndexDefs.hpp".
  • components/core/src/clp_s/filter/IndexBuilderSpecification.hpp#L10-L12: replace the angle-bracket includes with "IndexBuilder.hpp", "IndexDefs.hpp", and "PackedFilterSpecification.hpp".
  • components/core/src/clp_s/filter/IndexRunner.hpp#L9-L9: replace <clp_s/filter/BitmapView.hpp> with "BitmapView.hpp".
📍 Affects 3 files
  • components/core/src/clp_s/filter/PackedFilterSpecification.hpp#L6-L6 (this comment)
  • components/core/src/clp_s/filter/IndexBuilderSpecification.hpp#L10-L12
  • components/core/src/clp_s/filter/IndexRunner.hpp#L9-L9
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/core/src/clp_s/filter/PackedFilterSpecification.hpp` at line 6,
Change intra-target includes to quoted relative headers: in
components/core/src/clp_s/filter/PackedFilterSpecification.hpp lines 6-6 use
"IndexDefs.hpp"; in
components/core/src/clp_s/filter/IndexBuilderSpecification.hpp lines 10-12 use
"IndexBuilder.hpp", "IndexDefs.hpp", and "PackedFilterSpecification.hpp"; and in
components/core/src/clp_s/filter/IndexRunner.hpp lines 9-9 use "BitmapView.hpp".
Keep angle brackets only for external-target dependencies.

Source: Learnings

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