Skip to content

fix(delete)!: keep draining pending drops past a record that cannot be resolved - #1045

Merged
QuantumExplorer merged 3 commits into
developfrom
fix/flush-pending-drops-unresolved-record
Nov 13, 2026
Merged

QuantumExplorer merged 3 commits into
developfrom
fix/flush-pending-drops-unresolved-record

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: A flat drop removes a tree in one step and leaves a small record saying "this tree's storage can be reclaimed". GroveDb::flush_pending_prefix_drops later walks those records and reclaims the storage. Before reclaiming, it checks that nothing lives at the dropped path any more. If that check failed for one record, the whole call stopped with the error, and since the record stayed in the queue, every later call stopped at the same place. The records after it were never reclaimed. Now each record is handled on its own: one that cannot be checked is counted and left for the next call, and the rest are reclaimed.

Value: One record can no longer hold up reclamation for the whole database. Disk space of unrelated dropped trees is freed as intended, and the caller gets a count (and the first error) of the records that could not be checked, instead of a bare failure.

Risks: Low. The rule that protects live data is unchanged: storage is reclaimed only when the check proves that the dropped path resolves to nothing. No root hash, proof or cost can change (see below). The report struct gains two fields and loses Copy, which is a source-level break only for code that builds the struct by hand.

Issue being fixed or feature implemented

flush_pending_prefix_drops loops over the pending records in key order. For each it calls get_raw(parent_path, key) to see whether the dropped path is live again. Four errors mean "absent" (PathKeyNotFound, PathNotFound, PathParentLayerNotFound, InvalidParentLayerPath). Any other error did return Err(e) in the middle of the loop.

One ordinary sequence produces such an error:

  1. Flat-drop [a, parent, nested] inside a caller transaction, so its record waits for a flush.
  2. Delete the now empty tree [a, parent] and insert an item at the same key.
  3. Flush. Opening the Merk at [a, parent] finds an item where a tree should be and returns CorruptedPath("cannot open a subtree as parent exists but is not a tree").

That record is never removed, so every flush from then on returns the same error at the same record, and the records after it in key order stay in the queue with their storage.

What was done?

In grovedb/src/operations/delete/flat_drop.rs:

  • The liveness check moved into dropped_path_is_live, which returns Ok(true) (live), Ok(false) (proved absent) or Err (no answer).
  • A parent key that holds an element that is not a tree now counts as proved absent: nothing resolves below an item, so the dropped path cannot be live. CorruptedPath alone is not taken as that proof, because the variant carries free text and is raised in other places of the crate. When get_raw returns it, the path above the dropped key is read again from the root down, each layer inside a tree that the step before found. The record is reclaimed only if that walk finds a layer that is absent from its parent tree or holds an element that is not a tree. Anything else is "no answer". Reading from the root matters when a higher layer was flat-dropped in turn: its storage is still there and can show the parent as an item, while the layer itself can no longer be opened.
  • "No answer" no longer ends the loop. The record is left exactly as it is, counted in unresolved_records, the first such error is kept in first_unresolved_error, and the loop goes on. The next call checks the record again.
  • A failure of the drain itself still returns Err: listing the records, writing a range tombstone (delete_prefix_ranges) or removing a record (remove_pending_prefix_drop_record). These are faults of the storage layer, not of one record's check, and are likely to repeat for every record. Records reclaimed earlier in that call stay reclaimed, as before.

Before and after

Four pending records, visited in this order: [a, parent, nested], then three unrelated trees under [a]. [a, parent] was replaced by an item before the flush.

let report = db.flush_pending_prefix_drops(grove_version);
Before After
result Err(CorruptedPath("cannot open a subtree as parent exists but is not a tree")), on every call Ok(report)
reclaimed_records none, 4 records stay queued 4
unresolved_records (field did not exist) 0

The same four records, but the check of the first one fails with a read error (in the test, the parent Merk's root node does not decode):

Before After
result Err(..) on every call Ok(report)
reclaimed_records none 3
unresolved_records (field did not exist) 1, with first_unresolved_error: Some("dropped path [..]: ..")
next call, fault still there Err(..) Ok, 0 reclaimed, 1 unresolved
next call, fault gone Ok, 1 reclaimed, 0 unresolved

Why no root hash or cost can change

The function stays ungated, as its doc says, and this change keeps the reasons true:

  • It reads through get_raw and discards the read costs. It returns no OperationCost, and nothing it does is added to any operation's cost.
  • Its only writes are range tombstones over the prefixes listed in a record and the removal of that record from the reserved namespace of the meta column family. No Merk node is written, so no hash changes.
  • A prefix is tombstoned only when the dropped path is proved to resolve to nothing, so no live element can read from it. The new "parent is not a tree" case fits this: a path below a non-tree element cannot resolve.
  • Flat drops are refused before GROVE_V4, so under GROVE_V1..GROVE_V3 there are no records and the function is a no-op, before and after.

Public interface changes

grovedb::PendingPrefixDropsReport (also at grovedb::operations::delete::PendingPrefixDropsReport)

// before
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct PendingPrefixDropsReport {
    pub reclaimed_records: u64,
    pub skipped_live: u64,
}

// after
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct PendingPrefixDropsReport {
    pub reclaimed_records: u64,
    pub skipped_live: u64,
    pub unresolved_records: u64,
    pub first_unresolved_error: Option<String>,
}
  • New unresolved_records: u64: records left in the queue because their liveness check gave no answer. Their storage is untouched.
  • New first_unresolved_error: Option<String>: the dropped path and the error text of the first unresolved record of that call, meant for a log line. None when unresolved_records is 0. It is a String because grovedb::Error is neither Clone nor PartialEq, and the report keeps both.
  • The struct no longer derives Copy (it holds a String). Debug, Default, Clone, PartialEq and Eq stay.
  • Source break: a struct literal or an exhaustive destructuring pattern of the report needs the two new fields, and code that relied on implicit copies needs .clone(). Reading fields is unaffected.

GroveDb::flush_pending_prefix_drops

  • Signature unchanged: fn flush_pending_prefix_drops(&self, grove_version: &GroveVersion) -> Result<PendingPrefixDropsReport, Error>.
  • Behaviour change: an error from one record's liveness check is no longer returned. It is reported through the two new fields and the call returns Ok. A caller that treated Err as "some record could not be checked" should look at unresolved_records instead.
  • Err now means only that the drain itself failed (records could not be listed, or a tombstone or record removal could not be written).
  • A record whose parent key holds an element that is not a tree is reclaimed and counted in reclaimed_records. Before, it made the call fail.

What stays the same: drop_flat_subtree, the batch DropFlat behaviour, the record format, skipped_live and the rule behind it (a dropped path that resolves to an element is skipped on every call and never tombstoned), the internal best-effort flush after a drop that owns its transaction, and every GroveVersion table.

For Dash Platform: rs-drive-abci calls the function after finalizing a block and when the platform is opened, and reads reclaimed_records and skipped_live from the result. rs-drive names the type in two test helpers. Nothing builds, destructures or copies the report, so the current code compiles unchanged against this. With the next GroveDB pin, the log line after a block can also print unresolved_records and first_unresolved_error.

How Has This Been Tested?

New tests in grovedb/src/tests/flat_drop_tests.rs:

  • should_reclaim_unrelated_drops_when_an_ancestor_of_a_dropped_path_holds_an_item: the sequence above, with the affected record first in drain order. Fails on develop with the CorruptedPath error; now all four records are reclaimed, the item is untouched and verify_grovedb is clean.
  • should_reclaim_a_record_when_a_higher_ancestor_of_its_path_holds_an_item: the trees above the dropped one are emptied and removed, and an item takes the key two layers up. The record is reclaimed.
  • should_reclaim_a_record_below_an_item_when_a_dropped_ancestor_holds_an_item_too and should_reclaim_a_record_below_an_item_when_a_dropped_ancestor_is_gone: the parent holds an item and the layer above it was flat-dropped as well, then replaced by an item or left absent. With a check of the immediate parent only, the record stayed unresolved on every call; read from the root, it is reclaimed.
  • should_count_a_record_whose_liveness_check_fails_and_keep_draining: the first record's check hits a read error. It is counted as unresolved and keeps its record and storage, the three later records are reclaimed, a second call reports it again, and once the fault is repaired the next call reclaims it.
  • should_skip_a_recreated_path_as_live_while_other_records_drain: a re-created path is skipped as live on every call and its data survives, while a record below an item and an ordinary record are reclaimed in the same call.
  • should_reclaim_an_ordinary_drop_and_report_nothing_unresolved: the plain case, with the full report compared.

Run: cargo test -p grovedb --lib flat_drop (27 tests pass, the 20 existing ones included) and cargo clippy -p grovedb --all-targets (no warnings in the touched files). The full workspace suite was not run locally.

Breaking Changes

PendingPrefixDropsReport has two new public fields and no longer implements Copy. Code that only reads its fields, which is every known caller, compiles unchanged. No stored data, root hash, proof or cost changes.

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 made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · e11b547

  • Bots — coderabbitai skipped after its own rate limit · thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Build green
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

… resolved

`GroveDb::flush_pending_prefix_drops` returned the first error its
liveness check hit, so one record stopped every record after it from
being reclaimed, on that call and on every later one.

A record whose parent key came to hold an element that is not a tree
made the check fail with `CorruptedPath`. Nothing resolves below such an
element, so the record is now reclaimed; the parent's element is read to
confirm it is a non-tree. A record whose check fails any other way is
left in place, counted in `PendingPrefixDropsReport::unresolved_records`
(first error in `first_unresolved_error`) and checked again by the next
call, while the records after it are reclaimed.

A path that resolves to a live element is still never tombstoned. No
root hash or cost changes: the drain only reads, and writes only to
storage that no element reaches.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7d46eb5e-2545-4164-b25d-ff68ed1ee0cb
Commits

Reviewing files that changed from the base of the PR and between 3d035d5 and e11b547.

Files selected for processing: 4

  • CHANGELOG.md
  • grovedb-query/src/query.rs
  • grovedb/src/operations/delete/flat_drop.rs
  • grovedb/src/tests/flat_drop_tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 13, 2026
@thepastaclaw

thepastaclaw commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit e11b547)

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

Final validation — Phase 2 only (no Phase 1 for this repository)

The PR correctly isolates unresolved liveness checks, preserves those records, and continues reclaiming later records. One in-scope correctness gap remains: the new non-tree handling only checks the immediate parent, so a non-tree higher ancestor can leave safely reclaimable records unresolved indefinitely. No code checks have failed; several CI checks are still queued.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a contained but behavior-changing storage-reclamation and error-handling fix with substantial tests, and it does not directly alter a critical surface listed for the critical tier.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `grovedb/src/operations/delete/flat_drop.rs`:
- [SUGGESTION] grovedb/src/operations/delete/flat_drop.rs:469-490: Walk higher ancestors before treating CorruptedPath as absence
  The `CorruptedPath` branch only calls `holds_a_non_tree_element` for the immediate parent path. For a dropped path such as `[a, b, c, dropped]`, if `[a, b]` has been replaced by an item, reading `[a, b, c]` correctly returns `CorruptedPath`, but checking `[a, b, c]` itself requires opening that same invalid descendant path and therefore also fails. The helper returns false, so the record is classified as unresolved even though the live graph proves that no element can exist below the non-tree ancestor `[a, b]`; its storage and pending record are never reclaimed. Walk the path prefixes from the root, or otherwise identify the first successfully readable non-tree ancestor, and return `Ok(false)` only after that proof while retaining unresolved handling for genuine read failures.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Log unresolved pending-drop records in rs-drive-abci — The current rs-drive-abci finalization and startup callers only treat reclaimed or live-skipped records as report-worthy. A pass containing only unresolved_records therefore returns successfully without logging the new diagnostic fields, leaving first_unresolved_error unused in the current integration.
    • Follow-up: Update rs-drive-abci after the next GroveDB pin to include unresolved_records and first_unresolved_error in pending-drop finalization and startup-flush logging.

Comment on lines +469 to +490
Err(Error::CorruptedPath(_))
if self.holds_a_non_tree_element(parent_segments, grove_version) =>
{
Ok(false)
}
Err(e) => Err(e),
}
}

/// Whether the committed state holds, at `path`, an element that is
/// not a tree. `false` for the root, for an absent element, for any
/// tree and when the read fails.
fn holds_a_non_tree_element(&self, path: &[Vec<u8>], grove_version: &GroveVersion) -> bool {
let Some((key, parent_segments)) = path.split_last() else {
return false;
};
let parent_path: SubtreePath<Vec<u8>> = parent_segments.into();
matches!(
self.get_raw(parent_path, key, None, grove_version).unwrap(),
Ok(element) if element.root_key_and_tree_type().is_none()
)
}

@thepastaclaw thepastaclaw Nov 13, 2026 •

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.

✅ Resolved at e11b5473; see the replies below.

🟡 Suggestion: Walk higher ancestors before treating CorruptedPath as absence

The CorruptedPath branch only calls holds_a_non_tree_element for the immediate parent path. For a dropped path such as [a, b, c, dropped], if [a, b] has been replaced by an item, reading [a, b, c] correctly returns CorruptedPath, but checking [a, b, c] itself requires opening that same invalid descendant path and therefore also fails. The helper returns false, so the record is classified as unresolved even though the live graph proves that no element can exist below the non-tree ancestor [a, b]; its storage and pending record are never reclaimed. Walk the path prefixes from the root, or otherwise identify the first successfully readable non-tree ancestor, and return Ok(false) only after that proof while retaining unresolved handling for genuine read failures.

source: gpt-6.1-sol (phase2-reviewer: general, architecture-layering, platform-versioning, rust-quality)

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.

Resolved (re-reviewed at e11b5473): The new path_stops_before_its_end helper walks every ancestor from the root and only treats CorruptedPath as proof of absence after confirming that an ancestor is missing or no longer a tree. This addresses the previous immediate-parent-only check.

@github-actions

Copy link
Copy Markdown

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.89189% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.22%. Comparing base (3d035d5) to head (e11b547).

Files with missing lines Patch % Lines
grovedb/src/operations/delete/flat_drop.rs 91.66% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1045      +/-   ##
===========================================
- Coverage    93.32%   93.22%   -0.10%     
===========================================
  Files          366      366              
  Lines       112843   112274     -569     
===========================================
- Hits        105308   104666     -642     
- Misses        7535     7608      +73     
Components Coverage Δ
grovedb-core 91.53% <91.66%> (-0.17%) ⬇️
merk 94.43% <ø> (+0.09%) ⬆️
storage 91.94% <ø> (+0.25%) ⬆️
commitment-tree 94.86% <ø> (-0.77%) ⬇️
mmr 95.12% <ø> (-0.14%) ⬇️
bulk-append-tree 94.32% <ø> (-0.27%) ⬇️
element 97.40% <ø> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…a tree

The drain treated `CorruptedPath` as "not live" only when the dropped
path's immediate parent could be read as a non-tree element. When the
layer above that parent was no longer a tree either (it was flat-dropped
in turn, so its storage still showed the parent as an item), that read
failed the same way and the record stayed unresolved on every pass.

The path above the dropped key is now read from the root down, each layer
inside a tree the step before found. The record is reclaimed when a layer
is absent from its parent tree or holds an element that is not a tree.
Any other read failure still leaves the record unresolved.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Nov 13, 2026
The stable clippy that CI now installs reports `needless_bool` on the
`if .. { return true; } false` form. Same change as on the sibling pull
requests, so the branches merge without a conflict.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

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

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

The higher-ancestor liveness check now correctly prevents unsafe reclamation, and the prior finding is fixed. One operational integration gap remains: existing rs-drive-abci callers only treat Err as a failed flush, so a pass containing only unresolved records can be silently ignored despite the new report fields. CI build, test, formatting, and lint checks are successful.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The change modifies pending-drop storage reclamation and error-handling logic across production code and extensive tests, making it an ordinary but nontrivial correctness-sensitive change without meeting the defined critical-surface criteria.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `grovedb/src/operations/delete/flat_drop.rs`:
- [SUGGESTION] grovedb/src/operations/delete/flat_drop.rs:424-431: Propagate unresolved flush reports to host callers
  This change intentionally converts a per-record liveness-check failure into Ok(report) and records it in unresolved_records and first_unresolved_error. The existing rs-drive-abci callers still only handle Err: finalize_block logs a successful report only when reclaimed_records or skipped_live is nonzero, and the startup path warns only on Err. Consequently, a flush containing only unresolved records is silently ignored even though it may indicate persistent storage corruption or a read fault. Update the rs-drive-abci block-finalization and startup callers to emit a warning or metric when unresolved_records > 0 and include first_unresolved_error.

Comment on lines +424 to 431
Err(e) => {
report.unresolved_records += 1;
if report.first_unresolved_error.is_none() {
report.first_unresolved_error = Some(format!(
"dropped path {:?}: {e}",
DebugByteVectors(record.path)
));
}

@thepastaclaw thepastaclaw Nov 13, 2026 •

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.

⏸️ Needs a tracking issue (not yet deferred) at e11b5473; see the replies below.

🟡 Suggestion: Propagate unresolved flush reports to host callers

This change intentionally converts a per-record liveness-check failure into Ok(report) and records it in unresolved_records and first_unresolved_error. The existing rs-drive-abci callers still only handle Err: finalize_block logs a successful report only when reclaimed_records or skipped_live is nonzero, and the startup path warns only on Err. Consequently, a flush containing only unresolved records is silently ignored even though it may indicate persistent storage corruption or a read fault. Update the rs-drive-abci block-finalization and startup callers to emit a warning or metric when unresolved_records > 0 and include first_unresolved_error.

source: gpt-6.1-sol (phase2-reviewer: architecture-layering)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. Both callers are in Platform, which pins a GroveDB revision without these fields, so the warning goes in with Platform's next GroveDB pin bump.

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.

That deferral is reasonable because both callers are in Platform and will be updated with its next GroveDB pin. Before I mark this deferred, it needs a tracking issue in dashpay/platform; please link one or say so and I’ll file it.

Not deferred yet: a deferral needs a tracking issue for the follow-up; until then the finding stands.

@github-actions

Copy link
Copy Markdown

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 13, 2026
@QuantumExplorer
QuantumExplorer merged commit 8fd6fe4 into develop Nov 13, 2026
18 of 19 checks passed
@QuantumExplorer
QuantumExplorer deleted the fix/flush-pending-drops-unresolved-record branch November 13, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants