Skip to content

test(drive): cover shared-prefix aggregate index insertion#3961

Open
thephez wants to merge 4 commits into
v3.1-devfrom
test/index-set-conflict
Open

test(drive): cover shared-prefix aggregate index insertion#3961
thephez wants to merge 4 commits into
v3.1-devfrom
test/index-set-conflict

Conversation

@thephez

@thephez thephez commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Adds regression coverage for #3960.

A data contract can currently be accepted with shared-prefix document indexes where a shorter aggregate index and a deeper range index produce a Drive layout that cannot be materialized during document insertion. The reported shape is a [resourceId] count+sum index combined with a [resourceId, rating] range-countable index.

This PR adds Drive e2e coverage for that accepted-but-uninsertable contract shape and related wrapper-matrix variants. The matrix is marked #[ignore] because it intentionally captures the current failing behavior and should not make unrelated Drive CI jobs red before the production fix lands.

What was done?

  • Added a new Drive contract insertion e2e test module for shared-prefix aggregate index layouts.
  • Registered the module under insert_contract/v0/tests.
  • Added the reported review contract shape as a regression case.
  • Expanded coverage into a matrix for count-only, sum-only, and count+sum prefix parents with plain, range-count, range-sum, and range count+sum child continuations.
  • Marked compatible controls as cases that must insert successfully.
  • Allowed unsupported layouts to pass only if they are rejected at contract creation or made insertable by Drive in a future fix.
  • Kept Drive apply_contract failures distinct from contract creation rejection in the test diagnostics.

How Has This Been Tested?

Default targeted command:

cargo test -p drive shared_prefix_aggregate_index_combinations_reject_or_insert -- --nocapture

Current result: passes with the regression matrix ignored, so normal CI remains green.

Manual diagnostic command:

cargo test -p drive shared_prefix_aggregate_index_combinations_reject_or_insert -- --ignored --nocapture

Current result: fails as expected, listing the accepted shared-prefix layouts that cannot be inserted today. The compatible control cases insert successfully.

Observed failing accepted layouts include:

  • count_parent_range_sum_child
  • count_parent_range_count_sum_child
  • sum_parent_plain_child
  • sum_parent_range_count_child
  • count_sum_parent_plain_child
  • count_sum_parent_range_count_child

These failures are the intended regression signal until the platform either rejects unsupported layouts during contract validation or supports them during Drive insertion.

Breaking Changes

None. This PR adds test coverage only.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Tests
    • Added a new end-to-end test suite for shared-prefix aggregate index layouts.
    • Covered multiple flag combinations using a review contract and verified Drive behavior for each case.
    • Improved assertions around contract application and document insertion outcomes, ensuring incompatible layouts are rejected and compatible ones insert successfully.

thephez added 2 commits June 24, 2026 16:54
Adds a Drive e2e regression test for the accepted contract shape from #3960: a count+sum prefix index combined with a deeper range-countable index sharing that prefix. The test currently fails with the unsupported NotCountedOrSummed wrapping error, documenting the gap until validation or layout support is fixed.
Extends the shared-prefix aggregate index regression coverage to exercise count-only, sum-only, and count+sum parent value trees against plain, range-count, range-sum, and combined range count+sum child continuations. The matrix distinguishes compatible cases that must insert from unsupported layouts that should either be rejected during contract validation or supported by Drive insertion.
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dbc09355-86b9-483b-b6a4-abff9a31306d

📥 Commits

Reviewing files that changed from the base of the PR and between bd2bd25 and 4c6620b.

📒 Files selected for processing (1)
  • packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs

📝 Walkthrough

Walkthrough

Adds a new end-to-end test module for insert contract v0 shared-prefix aggregate index layouts, wires it into the test suite, builds contracts from parent/child flag combinations, and exercises contract application plus document insertion across a case matrix.

Changes

Shared-prefix aggregate index coverage

Layer / File(s) Summary
Module registration and case setup
packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/mod.rs, packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs
Adds the new test module entry and defines the shared-prefix flags, case configuration, and outcome types.
Index and contract construction
packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs
Builds index values from flag combinations and assembles the review contract schema and indices.
Contract application and matrix
packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs
Applies the contract, inserts review documents for each case, and compares the observed result with the expected outcome matrix.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested reviewers

  • shumkov

Poem

I hopped through indexes, neat and bright,
With shared-prefix leaves in morning light.
I nibbled at cases, one by one,
Until the insert dance was done.
🐰📚 Hop hop—tests now run!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding Drive test coverage for shared-prefix aggregate index insertion.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 test/index-set-conflict

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.

@thephez thephez marked this pull request as ready for review June 24, 2026 21:13
@thephez thephez requested a review from QuantumExplorer as a code owner June 24, 2026 21:13
@thepastaclaw

thepastaclaw commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit 4c6620b)

@thephez thephez marked this pull request as draft June 24, 2026 22:12

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Test-only PR adds a regression matrix for shared-prefix aggregate index layouts in Drive. The test is intentionally committed in a known-failing state (6 of 12 cases fail today per the PR description, confirmed by Codex running the test), with no #[ignore] or #[should_panic] gating — merging as-is will break cargo test -p drive on the base branch. A secondary issue conflates two distinct failure modes into the same outcome variant, weakening the regression signal.

🔴 1 blocking | 🟡 1 suggestion(s)

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs`:
- [BLOCKING] packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs:263-359: Test is committed in a known-failing state and will break CI
  This is a plain `#[test]` with no `#[ignore]` or `#[should_panic]`, yet the PR description states the current result is failure and lists six cases that fail today (`count_parent_range_sum_child`, `count_parent_range_count_sum_child`, `sum_parent_plain_child`, `sum_parent_range_count_child`, `count_sum_parent_plain_child`, `count_sum_parent_range_count_child`). Codex independently ran `cargo test -p drive shared_prefix_aggregate_index_combinations_reject_or_insert` and confirmed it fails.

  The match arm at line 349 unconditionally treats `SharedPrefixOutcome::InsertFailed` as a failure regardless of `must_insert`, so all six cases will produce `assert!(failures.is_empty(), ...)` failures the moment this lands on `v3.1-dev`. Every unrelated PR running the Drive test job will go red until the upstream fix lands.

  The author calls this the "intended regression signal until the platform either rejects unsupported layouts during contract validation or supports them during Drive insertion" — but a green-required CI test is the wrong vehicle for that signal. Options: (a) gate with `#[ignore = "tracks #3960 ..."]`; (b) restructure so today's observed behavior is the *passing* state and the future fix flips the assertion; (c) land alongside the production fix so the matrix passes on merge.

  A secondary structural note: even when this is unblocked, a single `#[test]` looping over 12 cases produces one combined failure message rather than per-case test failures. Splitting into one `#[test]` per case (mirroring `range_countable_index_e2e_tests.rs`) would localize future regressions.
- [SUGGESTION] packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/shared_prefix_aggregation_e2e_tests.rs:211-220: `apply_contract` failure is conflated with schema-level `ContractRejected`
  `insert_review_document_for_case` maps two structurally different failure modes onto the same `SharedPrefixOutcome::ContractRejected` variant: factory-level rejection from `build_review_contract` (the genuine "reject at contract creation" fix path) and runtime failure from `drive.apply_contract` (a storage-layer failure, not validation rejection).

  The assertion at line 344 then treats `ContractRejected` as "OK, the contract was rejected at creation time" for `must_insert: false` cases. If a future change starts surfacing the bug at `apply_contract` time (e.g. Drive errors when materializing the index trees rather than during document insertion), this test will silently flip from red to green even though nothing has been fixed at the validation layer this PR is regression coverage for.

  Add an `ApplyFailed(String)` variant and treat it like `InsertFailed` in the assertion so the diagnostic output identifies precisely which Drive phase broke.

Comment on lines +263 to +359
#[test]
fn shared_prefix_aggregate_index_combinations_reject_or_insert() {
let cases = [
SharedPrefixCase {
name: "count_parent_plain_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::PLAIN,
must_insert: true,
},
SharedPrefixCase {
name: "count_parent_range_count_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: true,
},
SharedPrefixCase {
name: "count_parent_range_sum_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_SUM,
must_insert: false,
},
SharedPrefixCase {
name: "count_parent_range_count_sum_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_plain_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::PLAIN,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_range_count_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_range_sum_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "sum_parent_range_count_sum_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "count_sum_parent_plain_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::PLAIN,
must_insert: false,
},
SharedPrefixCase {
name: "count_sum_parent_range_count_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: false,
},
SharedPrefixCase {
name: "count_sum_parent_range_sum_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "count_sum_parent_range_count_sum_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: true,
},
];

let failures = cases
.iter()
.filter_map(|case| match insert_review_document_for_case(case) {
SharedPrefixOutcome::Inserted => None,
SharedPrefixOutcome::ContractRejected(_) if !case.must_insert => None,
SharedPrefixOutcome::ContractRejected(error) => Some(format!(
"{}: compatible shared-prefix aggregate indexes were rejected: {}",
case.name, error
)),
SharedPrefixOutcome::InsertFailed(error) => Some(format!("{}: {}", case.name, error)),
})
.collect::<Vec<_>>();

assert!(
failures.is_empty(),
"shared-prefix aggregate index contracts must either reject unsupported layouts at \
contract creation or allow document insertion; incompatible accepted layouts failed for:\n{}",
failures.join("\n")
);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Test is committed in a known-failing state and will break CI

This is a plain #[test] with no #[ignore] or #[should_panic], yet the PR description states the current result is failure and lists six cases that fail today (count_parent_range_sum_child, count_parent_range_count_sum_child, sum_parent_plain_child, sum_parent_range_count_child, count_sum_parent_plain_child, count_sum_parent_range_count_child). Codex independently ran cargo test -p drive shared_prefix_aggregate_index_combinations_reject_or_insert and confirmed it fails.

The match arm at line 349 unconditionally treats SharedPrefixOutcome::InsertFailed as a failure regardless of must_insert, so all six cases will produce assert!(failures.is_empty(), ...) failures the moment this lands on v3.1-dev. Every unrelated PR running the Drive test job will go red until the upstream fix lands.

The author calls this the "intended regression signal until the platform either rejects unsupported layouts during contract validation or supports them during Drive insertion" — but a green-required CI test is the wrong vehicle for that signal. Options: (a) gate with #[ignore = "tracks #3960 ..."]; (b) restructure so today's observed behavior is the passing state and the future fix flips the assertion; (c) land alongside the production fix so the matrix passes on merge.

A secondary structural note: even when this is unblocked, a single #[test] looping over 12 cases produces one combined failure message rather than per-case test failures. Splitting into one #[test] per case (mirroring range_countable_index_e2e_tests.rs) would localize future regressions.

Suggested change
#[test]
fn shared_prefix_aggregate_index_combinations_reject_or_insert() {
let cases = [
SharedPrefixCase {
name: "count_parent_plain_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::PLAIN,
must_insert: true,
},
SharedPrefixCase {
name: "count_parent_range_count_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: true,
},
SharedPrefixCase {
name: "count_parent_range_sum_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_SUM,
must_insert: false,
},
SharedPrefixCase {
name: "count_parent_range_count_sum_child",
prefix_flags: IndexFlags::COUNT,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_plain_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::PLAIN,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_range_count_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: false,
},
SharedPrefixCase {
name: "sum_parent_range_sum_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "sum_parent_range_count_sum_child",
prefix_flags: IndexFlags::SUM,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "count_sum_parent_plain_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::PLAIN,
must_insert: false,
},
SharedPrefixCase {
name: "count_sum_parent_range_count_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_COUNT,
must_insert: false,
},
SharedPrefixCase {
name: "count_sum_parent_range_sum_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_SUM,
must_insert: true,
},
SharedPrefixCase {
name: "count_sum_parent_range_count_sum_child",
prefix_flags: IndexFlags::COUNT_SUM,
child_flags: IndexFlags::RANGE_COUNT_SUM,
must_insert: true,
},
];
let failures = cases
.iter()
.filter_map(|case| match insert_review_document_for_case(case) {
SharedPrefixOutcome::Inserted => None,
SharedPrefixOutcome::ContractRejected(_) if !case.must_insert => None,
SharedPrefixOutcome::ContractRejected(error) => Some(format!(
"{}: compatible shared-prefix aggregate indexes were rejected: {}",
case.name, error
)),
SharedPrefixOutcome::InsertFailed(error) => Some(format!("{}: {}", case.name, error)),
})
.collect::<Vec<_>>();
assert!(
failures.is_empty(),
"shared-prefix aggregate index contracts must either reject unsupported layouts at \
contract creation or allow document insertion; incompatible accepted layouts failed for:\n{}",
failures.join("\n")
);
}
#[test]
#[ignore = "tracks #3960: shared-prefix aggregate index layouts are accepted at contract creation but currently fail during document insertion; un-ignore when contract validation rejects them or Drive supports them"]
fn shared_prefix_aggregate_index_combinations_reject_or_insert() {

source: ['claude', 'codex']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Resolved in 3ab8552Test is committed in a known-failing state and will break CI no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

Comment on lines +211 to +220
fn insert_review_document_for_case(case: &SharedPrefixCase) -> SharedPrefixOutcome {
let drive = setup_drive_with_initial_state_structure(None);
let pv = PlatformVersion::latest();
let contract = match build_review_contract(case.prefix_flags, case.child_flags) {
Ok(contract) => contract,
Err(error) => return SharedPrefixOutcome::ContractRejected(error),
};
if let Err(error) = apply_contract(&drive, &contract) {
return SharedPrefixOutcome::ContractRejected(error);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟡 Suggestion: apply_contract failure is conflated with schema-level ContractRejected

insert_review_document_for_case maps two structurally different failure modes onto the same SharedPrefixOutcome::ContractRejected variant: factory-level rejection from build_review_contract (the genuine "reject at contract creation" fix path) and runtime failure from drive.apply_contract (a storage-layer failure, not validation rejection).

The assertion at line 344 then treats ContractRejected as "OK, the contract was rejected at creation time" for must_insert: false cases. If a future change starts surfacing the bug at apply_contract time (e.g. Drive errors when materializing the index trees rather than during document insertion), this test will silently flip from red to green even though nothing has been fixed at the validation layer this PR is regression coverage for.

Add an ApplyFailed(String) variant and treat it like InsertFailed in the assertion so the diagnostic output identifies precisely which Drive phase broke.

Suggested change
fn insert_review_document_for_case(case: &SharedPrefixCase) -> SharedPrefixOutcome {
let drive = setup_drive_with_initial_state_structure(None);
let pv = PlatformVersion::latest();
let contract = match build_review_contract(case.prefix_flags, case.child_flags) {
Ok(contract) => contract,
Err(error) => return SharedPrefixOutcome::ContractRejected(error),
};
if let Err(error) = apply_contract(&drive, &contract) {
return SharedPrefixOutcome::ContractRejected(error);
}
fn insert_review_document_for_case(case: &SharedPrefixCase) -> SharedPrefixOutcome {
let drive = setup_drive_with_initial_state_structure(None);
let pv = PlatformVersion::latest();
let contract = match build_review_contract(case.prefix_flags, case.child_flags) {
Ok(contract) => contract,
Err(error) => return SharedPrefixOutcome::ContractRejected(error),
};
if let Err(error) = apply_contract(&drive, &contract) {
return SharedPrefixOutcome::ApplyFailed(error);
}

source: ['claude']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Resolved in 3ab8552apply_contract failure is conflated with schema-level ContractRejected no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (48f0cc3) to head (4c6620b).
⚠️ Report is 1 commits behind head on v3.1-dev.

Additional details and impacted files
@@            Coverage Diff             @@
##           v3.1-dev    #3961    +/-   ##
==========================================
  Coverage     87.17%   87.18%            
==========================================
  Files          2629     2632     +3     
  Lines        327221   327563   +342     
==========================================
+ Hits         285265   285592   +327     
- Misses        41956    41971    +15     
Components Coverage Δ
dpp 87.70% <ø> (ø)
drive 86.14% <ø> (ø)
drive-abci 89.45% <ø> (ø)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.20% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 49.55% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thephez thephez marked this pull request as ready for review June 25, 2026 15:56

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

PR adds a Drive e2e regression test for shared-prefix aggregate index layouts (#3960). Both prior blockers are resolved at 4c6620b: the test is gated with #[ignore] referencing #3960, and ApplyFailed is now a distinct outcome variant treated as a real failure. Only two low-value nitpicks remain on the ignored test itself; no in-scope blockers or suggestions. Note: codex-general and codex-rust-quality failed with authentication errors, so this verification reflects claude-only coverage.

Coverage note: Claude general and Claude rust-quality ran; Codex general and Codex rust-quality did not run because ACP returned Authentication required. The verifier evaluated the available reviewer outputs and the CodeRabbit zero-finding context.

💬 2 nitpick(s)

Comment on lines +132 to +133
let factory =
DataContractFactory::new(PROTOCOL_VERSION_V12).expect("expected to create factory");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

💬 Nitpick: Mixed protocol versions: factory pinned to V12 while apply/insert use latest()

build_review_contract constructs DataContractFactory::new(PROTOCOL_VERSION_V12) (line 133), while apply_contract and insert_review_document_for_case use PlatformVersion::latest() (lines 206, 214). Once the latest protocol version moves past 12, the factory will be building contracts on an older protocol but applying them against a newer one, which can mask or change the behavior this matrix is intended to pin down. For a deterministic regression test, pin everything to one fixed version (or thread PlatformVersion::latest().protocol_version through the factory call). Not a defect today since the test is #[ignore]d, but it will silently lose regression value at the next protocol bump.

source: ['claude']

Comment on lines +342 to +357
let failures = cases
.iter()
.filter_map(|case| match insert_review_document_for_case(case) {
SharedPrefixOutcome::Inserted => None,
SharedPrefixOutcome::ContractRejected(_) if !case.must_insert => None,
SharedPrefixOutcome::ContractRejected(error) => Some(format!(
"{}: compatible shared-prefix aggregate indexes were rejected: {}",
case.name, error
)),
SharedPrefixOutcome::ApplyFailed(error) => Some(format!(
"{}: contract application failed: {}",
case.name, error
)),
SharedPrefixOutcome::InsertFailed(error) => Some(format!("{}: {}", case.name, error)),
})
.collect::<Vec<_>>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

💬 Nitpick: must_insert: false + Inserted is silently accepted

The matrix treats (must_insert: false, Inserted) as a pass, matching the PR's stated intent. However, when the #3960 fix lands and previously-unsupported layouts become insertable, the test stays green without prompting anyone to flip those cases to must_insert: true and remove #[ignore]. Consider emitting a diagnostic (e.g., a println! under --nocapture) when a must_insert: false case successfully inserts so the matrix is self-cleaning after the fix.

source: ['claude']

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