Skip to content

[MOD-17681] UnionTrimmed: refuse suspend/resume - #10893

Merged
LukeMathWalker merged 1 commit into
masterfrom
luca-reval-union-trimmed
Aug 17, 2026
Merged

LukeMathWalker merged 1 commit into
masterfrom
luca-reval-union-trimmed

Conversation

@LukeMathWalker

@LukeMathWalker LukeMathWalker commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: UnionTrimmed is the one iterator whose revalidate panics — trimmed unions are only built for the partial-range (numeric SORTBY) optimization, whose pipeline drains all upstream results inside a single locked sendChunk call, so the spec read lock is never released underneath one. It has no place in the suspend/resume hierarchy yet.
  2. Change: it joins the hierarchy, but both transitions refuse to run. resume cannot be implemented at all: a trimmed union yields documents out of doc-id order and its skip_to panics, so there is no position to re-derive after the children move. With no resume, suspending would only manufacture a state nothing can consume — so suspend panics too, at the call that requested the unsupported transition rather than one lock cycle later. A trimmed union is also always the root iterator (QOptimizer_Iterators only trims when the AST root is a numeric node whose iterator is the union itself), so no composite parent has to transition it as a child slot either.
  3. Outcome: no user-visible change. UnionTrimmed now satisfies the RQEIteratorBoxed bound that suspendable parents are generic over, without pretending to support a cycle it cannot complete.

Which additional issues this PR fixes

  1. MOD-16713

Main objects this PR modified

  1. UnionTrimmed::suspend — panics, mirroring the existing revalidate. The comment carries the two independent reasons (never suspended in practice; nothing could be done with the result) and defers the pipeline argument to revalidate, which owns it.
  2. RawUnionTrimmed<Suspended, _>'s RQESuspendedIterator impl — kept only to name a type satisfying RQEIteratorBoxed::Suspended's bound; no value of it can be built, so resume panics and the two accessors stay plain field reads.
  3. No const layout-invariant proof and no unsafe: with neither transition reinterpreting an allocation, there is no cast whose soundness a proof would guard.
  4. tests/integration/union_trimmed.rs — one suspend_panics test over type-erased children (the shape production hands the union) replaces the suspend round-trip, child-window, box-address, and suspended-accessor tests. resume's panic is not reachable from any value the crate can build, so it is untestable by construction.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e2c946a92

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codecov

codecov Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.19%. Comparing base (5a83a5b) to head (238882e).
⚠️ Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
...c/redisearch_rs/rqe_iterators/src/union_trimmed.rs 13.33% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10893      +/-   ##
==========================================
- Coverage   83.16%   82.19%   -0.97%     
==========================================
  Files         606      635      +29     
  Lines       80987    82293    +1306     
  Branches    36248    37505    +1257     
==========================================
+ Hits        67350    67639     +289     
- Misses      13290    14307    +1017     
  Partials      347      347              
Flag Coverage Δ
flow 84.36% <ø> (-0.03%) ⬇️
unit 55.74% <13.33%> (-0.55%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LukeMathWalker
LukeMathWalker force-pushed the luca-reval-union-trimmed branch from 1e2c946 to 238882e Compare August 17, 2026 10:40
@LukeMathWalker LukeMathWalker changed the title [MOD-16713] UnionTrimmed: suspend/resume [MOD-16713] UnionTrimmed: refuse suspend/resume Aug 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 238882e892

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +363 to +365
unreachable!(
"suspend is not supported on UnionTrimmed — trimmed unions are not subject to GC"
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Implement the advertised suspend transition

When a composite parent suspends a child slot containing UnionTrimmed, this implementation unconditionally panics instead of returning the Suspended type promised by RQEIteratorBoxed, making the newly advertised capability unusable and aborting that operation. Unlike the previously reviewed implementation, the current diff has replaced the unsafe child conversion with this unconditional panic; implement the transition for every owned child, including children outside the active trim window, rather than codifying the failure in suspend_panics.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That'd be useless, since resume panics unconditionally, as revalidate used to do.

@LukeMathWalker LukeMathWalker changed the title [MOD-16713] UnionTrimmed: refuse suspend/resume [MOD-17681] UnionTrimmed: refuse suspend/resume Aug 17, 2026
fn suspend(self: Box<Self>) -> Box<Self::Suspended> {
// Unreachable for the reason `RQEIterator::revalidate` documents: the
// partial-range pipeline never releases the spec read lock underneath a
// trimmed union. A trimmed union is also always the *root* iterator —

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.

Technically if wrapped by Profile then it's not longer the root iterator.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

True, but semantically I'd say this stands, no?

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.

Yes, I think so, the logic is sound.

@sonarqubecloud

Copy link
Copy Markdown

@LukeMathWalker
LukeMathWalker added this pull request to the merge queue Aug 17, 2026
Merged via the queue into master with commit 7a42bb9 Aug 17, 2026
60 of 61 checks passed
@LukeMathWalker
LukeMathWalker deleted the luca-reval-union-trimmed branch August 17, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants