Skip to content

fix(fts): use v3 as the capability gate#7866

Merged
Xuanwo merged 5 commits into
mainfrom
xuanwo/fts-v3-capability-gate
Jul 21, 2026
Merged

fix(fts): use v3 as the capability gate#7866
Xuanwo merged 5 commits into
mainfrom
xuanwo/fts-v3-capability-gate

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove FTS format v4 and make v3 the maximum supported capability version
  • use v3 for the code analyzer or 256-document posting blocks, while keeping text analysis with 128-document blocks on v2
  • allow v3 with both 128- and 256-document blocks; reject code analysis on v1/v2
  • update Rust, Python, Java, mem-wal handling, tests, and migration documentation

Root cause

The v4 bump conflated reader capability with a new physical file format. Code analyzer configuration is persisted in InvertedIndexDetails and changes token generation, not the posting or position schema. Configurable posting block size was already represented by v3 and persisted in metadata. For 128-document blocks, v3 uses the same fields and codecs as v2.

Since FTS v3 has not been formally released, v3 can be the capability gate for both code analyzer metadata and 256-document posting blocks without introducing v4.

Compatibility contract

  • v1/v2: 128-document posting blocks only; no code analyzer
  • v3: code analyzer supported; 128- and 256-document posting blocks supported
  • analyzer configuration: index details metadata
  • posting block size: physical encoding metadata
  • v4: unsupported; no alias or migration for the unreleased format

Validation

  • cargo fmt --all
  • focused lance-index tokenizer, physical-layout, merge, metadata, and plugin tests
  • focused lance code-analyzer optimize, mem-wal metadata, and flush tests
  • ./mvnw -Dtest=InvertedIndexParamsTest test
  • 17 focused Python FTS tests
  • uv run make format
  • uv run make lint

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: aa80bbe7-78ac-4760-af01-369648f88b2b

📥 Commits

Reviewing files that changed from the base of the PR and between 57cc616 and 346f266.

📒 Files selected for processing (2)
  • python/python/tests/test_scalar_index.py
  • rust/lance/src/dataset/mem_wal/memtable/flush.rs

📝 Walkthrough

Walkthrough

FTS format v4 support is removed. Format selection now uses v2 by default, v3 for code analysis or 256-document posting blocks, and preserves existing index formats during maintenance operations. Java, Python, Rust, tests, and migration documentation reflect the v1–v3 compatibility rules.

Changes

FTS format migration

Layer / File(s) Summary
Format model and physical layout
rust/lance-index/src/scalar/inverted/*
Inverted-index support is limited to formats v1–v3; v2 and v3 share the physical layout for 128-document blocks, while v3 supports 256-document blocks.
Format resolution and API validation
rust/lance-index/src/scalar/inverted/tokenizer.rs, java/src/main/java/org/lance/index/scalar/*, python/src/dataset.rs, python/python/lance/dataset.py, python/python/tests/test_scalar_index.py
Defaults, environment overrides, code-analyzer requirements, accepted values, and validation now follow the v1–v3 rules.
Metadata preservation and maintenance validation
rust/lance/src/dataset/mem_wal/*, rust/lance/src/index.rs, docs/src/guide/migration.md
Metadata parsing rejects v4, maintenance tests cover v2/v3 behavior, and migration guidance documents format preservation and compatibility rules.
Build validation support
.github/workflows/rust.yml
The Linux Rust build timeout increases from 60 to 75 minutes.

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

Sequence Diagram(s)

sequenceDiagram
  participant IndexCreator
  participant InvertedIndexParams
  participant CreationResolver
  participant FTSMetadata
  IndexCreator->>InvertedIndexParams: provide analyzer, block size, and optional format_version
  InvertedIndexParams->>CreationResolver: resolve default and environment override
  CreationResolver->>FTSMetadata: write compatible v2 or v3 format metadata
Loading

Possibly related PRs

Suggested labels: A-format

Suggested reviewers: bubblecal, hamersaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: making FTS v3 the capability gate and removing v4 support.
Description check ✅ Passed The description accurately summarizes the FTS v3/v4 migration, validation, and affected language bindings.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xuanwo/fts-v3-capability-gate

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

@github-actions github-actions Bot added A-python Python bindings A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-docs Documentation bug Something isn't working labels Jul 20, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review July 20, 2026 17:25

@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: 2

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
rust/lance/src/index.rs-5007-5011 (1)

5007-5011: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Assert that optimization preserves the actual FTS parameters.

The cases cover both block sizes and correctly expect V3, but the test never verifies that analyzer("code"), block_size, split_identifiers, and preserve_original remain unchanged after optimize_indices. A regression that resets the 256-document block size or drops analyzer settings would still pass.

This is required by the PR objective to preserve analyzer configuration and posting block size across optimization. As per coding guidelines, every feature must have corresponding tests.

Also applies to: 5034-5035, 5047-5053

🤖 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 `@rust/lance/src/index.rs` around lines 5007 - 5011, Enhance
test_optimize_empty_code_fts_index_preserves_params to inspect the optimized FTS
index after optimize_indices and assert that analyzer("code"), the parameterized
block_size, split_identifiers, and preserve_original match their configured
values. Keep the existing V3 assertion and both block-size cases.

Source: Coding guidelines

🤖 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 `@docs/src/guide/migration.md`:
- Around line 11-28: Update the FTS format migration guidance to explicitly
state that format v4 indexes are no longer supported or openable, and that
existing v4 indexes must be rebuilt or recreated using format v2 or v3. Place
this near the format-selection or existing-index operation guidance without
changing the other format behavior descriptions.

In `@rust/lance-index/src/scalar/inverted/builder.rs`:
- Around line 3455-3486: Convert test_v3_128_reuses_v2_physical_layout from
nested with_position/with_impacts loops to an rstest parameterized test. Add
named #[case] entries for all four boolean combinations so each case runs and
reports independently, while preserving the existing schema and metadata
assertions.

---

Other comments:
In `@rust/lance/src/index.rs`:
- Around line 5007-5011: Enhance
test_optimize_empty_code_fts_index_preserves_params to inspect the optimized FTS
index after optimize_indices and assert that analyzer("code"), the parameterized
block_size, split_identifiers, and preserve_original match their configured
values. Keep the existing V3 assertion and both block-size cases.
🪄 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: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: e0b24fe2-6fa4-4908-b891-f7f082111df9

📥 Commits

Reviewing files that changed from the base of the PR and between af6f0f7 and 855835a.

📒 Files selected for processing (17)
  • docs/src/guide/migration.md
  • java/src/main/java/org/lance/index/scalar/InvertedIndexParams.java
  • java/src/test/java/org/lance/index/scalar/InvertedIndexParamsTest.java
  • python/python/lance/dataset.py
  • python/python/tests/test_scalar_index.py
  • python/src/dataset.rs
  • rust/lance-index/src/scalar/inverted.rs
  • rust/lance-index/src/scalar/inverted/builder.rs
  • rust/lance-index/src/scalar/inverted/encoding.rs
  • rust/lance-index/src/scalar/inverted/impact.rs
  • rust/lance-index/src/scalar/inverted/index.rs
  • rust/lance-index/src/scalar/inverted/lazy_docset.rs
  • rust/lance-index/src/scalar/inverted/tokenizer.rs
  • rust/lance-index/src/scalar/inverted/wand.rs
  • rust/lance/src/dataset/mem_wal/index.rs
  • rust/lance/src/dataset/mem_wal/memtable/flush.rs
  • rust/lance/src/index.rs

Comment thread docs/src/guide/migration.md Outdated
Comment thread rust/lance-index/src/scalar/inverted/builder.rs
@github-actions github-actions Bot added the A-ci CI / build workflows label Jul 20, 2026
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.38843% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-index/src/scalar/inverted/index.rs 81.81% 2 Missing and 2 partials ⚠️
rust/lance-index/src/scalar/inverted/tokenizer.rs 94.00% 3 Missing ⚠️
rust/lance/src/dataset/mem_wal/index.rs 93.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@wjones127 wjones127 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.

I have some minor comments on the docs, but it looks functionally correct.

Comment thread docs/src/guide/migration.md Outdated
Comment thread docs/src/guide/migration.md Outdated
Comment thread rust/lance-index/src/scalar/inverted/tokenizer.rs
@Xuanwo
Xuanwo merged commit 647567d into main Jul 21, 2026
33 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/fts-v3-capability-gate branch July 21, 2026 03:40
wjones127 pushed a commit that referenced this pull request Jul 21, 2026
## Summary

- remove FTS format v4 and make v3 the maximum supported capability
version
- use v3 for the code analyzer or 256-document posting blocks, while
keeping text analysis with 128-document blocks on v2
- allow v3 with both 128- and 256-document blocks; reject code analysis
on v1/v2
- update Rust, Python, Java, mem-wal handling, tests, and migration
documentation

## Root cause

The v4 bump conflated reader capability with a new physical file format.
Code analyzer configuration is persisted in `InvertedIndexDetails` and
changes token generation, not the posting or position schema.
Configurable posting block size was already represented by v3 and
persisted in metadata. For 128-document blocks, v3 uses the same fields
and codecs as v2.

Since FTS v3 has not been formally released, v3 can be the capability
gate for both code analyzer metadata and 256-document posting blocks
without introducing v4.

## Compatibility contract

- v1/v2: 128-document posting blocks only; no code analyzer
- v3: code analyzer supported; 128- and 256-document posting blocks
supported
- analyzer configuration: index details metadata
- posting block size: physical encoding metadata
- v4: unsupported; no alias or migration for the unreleased format

## Validation

- `cargo fmt --all`
- focused `lance-index` tokenizer, physical-layout, merge, metadata, and
plugin tests
- focused `lance` code-analyzer optimize, mem-wal metadata, and flush
tests
- `./mvnw -Dtest=InvertedIndexParamsTest test`
- 17 focused Python FTS tests
- `uv run make format`
- `uv run make lint`

(cherry picked from commit 647567d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci CI / build workflows A-docs Documentation A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-python Python bindings bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants