Skip to content

Remove obsolete check_refcount command from archived runtime pruning system#3852

Merged
jolestar merged 2 commits into
mainfrom
copilot/remove-check-refcount-command
Dec 8, 2025
Merged

Remove obsolete check_refcount command from archived runtime pruning system#3852
jolestar merged 2 commits into
mainfrom
copilot/remove-check-refcount-command

Conversation

Copilot AI commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Summary

Removes the check_refcount command, a diagnostic tool for the archived runtime pruning system that has been superseded by offline GC.

  • Closes #<issue_number>

Changes

  • Deleted crates/rooch/src/commands/db/commands/check_refcount.rs (198 lines)
  • Removed module and command registrations from db/commands/mod.rs and db/mod.rs

The command compared state_node, node_refcount, and smt_stale column families to identify refcount inconsistencies. Runtime pruning's refcount system is non-functional in the current offline GC architecture - functions like inc_node_refcount and dec_node_refcount are never called.

No functional impact. The command accessed relics of the old architecture with no integration to current systems.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libobject-a25e7f31e2204719.rlib /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libmemchr-1f1858edbb50ccb5.rlib /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libaddr2line-1319b75889377807.rlib /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libgimli-c9972d847170eb93.rlib /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/librustc_demangle-0868a75d0b80f801.rlib ipt_build-81472a11ec80f9bf.build_script_build.34e35a76a1578e34-cgu.0.rcgu.o ipt_build-81472a11ec80f9bf.build_script_build.34e35a76a1578e34-cgu.1.rcgu.o ipt_build-81472a11ec80f9bf.build_script_build.34e35a76a1578e34-cgu.2.rcgu.o ipt_build-81472a11ec80f9bf.build_script_build.34e35a76a1578e34-cgu.3.rcgu.o ipt_build-81472a11ec80f9bf.cj2ba1zxmi56yjp5qyclbbif0.rcgu.o /home/REDACTED/.rustup/toolchains/1.82.0-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libunwind-d2b4a3bc57672e2c.rlib 64-u�� 64-REDACTED-linux-gnu/lib/libstd-22be60875a4ac8d7.rlib 64-REDACTED-linux-gnu/lib/libpanic_unwind-4b832a03827ff95e.rlib 64-REDACTED-linux-gnu/lib/libobject-a25e7f31e2204719.rlib 64-REDACTED-linux-gnu/lib/libmemchr-1f1858edbb50ccb5.rlib 64-REDACTED-linux-gnu/lib/libaddr2line-1319b75889377807.rlib 64-REDACTED-linux-gnu/lib/libgimli-c9972d847170eb93.rlib 64-REDACTED-linux-gnu/lib/librustc_demangle-0868a75d0b80f801.rlib (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>commands/db: Remove obsolete check-refcount command from runtime pruning system</issue_title>
<issue_description>## Summary

The check-refcount command under db is a diagnostic tool for the old runtime pruning system that has been archived and replaced by offline GC. This command serves no purpose in the current architecture and should be removed to reduce codebase complexity.

Problem Description

The check-refcount command is a remnant of the runtime pruning architecture that was designed to:

  1. Compare state_node, node_refcount, and smt_stale column families
  2. Identify inconsistencies in node reference counts
  3. Detect stale nodes that aren't properly tracked

However, the runtime pruning system has been completely archived in favor of offline GC, making this command obsolete.

Why This Command Should Be Removed

1. Runtime Pruner is Archived

  • The pruning system now uses offline GC with "stop-the-world" Mark-Sweep approach
  • According to pruner_guide.md: "Runtime pruner: archived. The code path is disabled by default and kept only for historical reference"
  • Runtime pruning caused safety issues with refcount races

2. Refcount System is Not Functional

  • Functions like inc_node_refcount, dec_node_refcount are never called in the current codebase
  • The node_refcount column family is maintained but serves no purpose
  • Offline GC doesn't rely on refcount consistency checks

3. No Current Integration

  • Command accesses column families that are relics of the old architecture
  • No integration with current offline GC system
  • Not documented or tested anywhere

4. Architectural Incompatibility

  • New offline GC explicitly avoids complex refcount tracking for safety reasons
  • Documentation states: "Refcounts cannot be trusted under races"
  • System moved to offline GC for safety and simplicity

Files to Remove

Primary Command File:

  • crates/rooch/src/commands/db/commands/check_refcount.rs

Registration Points:

  • crates/rooch/src/commands/db/commands/mod.rs (remove module import)
  • crates/rooch/src/commands/db/mod.rs (remove command registration)

Impact Assessment

✅ ZERO IMPACT - Removal will have no negative effects because:

  • Command is not used by any current functionality
  • Offline GC operations don't depend on refcount consistency
  • Refcount system is already non-functional
  • No tests or documentation reference this command

Benefits of Removal

  1. Reduced Maintenance - One less command to maintain and explain
  2. Reduced Confusion - Operators won't accidentally use diagnostics for an obsolete system
  3. Cleaner Codebase - Remove dead code with no functional purpose
  4. Architectural Alignment - Codebase reflects the move to offline GC

Alternative Considered

Keep for Historical Reference: Rejected because:

  • The command is already non-functional
  • Keeping it creates confusion about current architecture
  • Historical reference can be preserved in git history
  • No value in keeping non-working diagnostics

Migration Steps

  1. Remove the command implementation file
  2. Remove module imports and command registration
  3. Update any documentation that might reference it (unlikely to exist)
  4. Run tests to ensure no regression

Risk Assessment

LOW RISK - This is pure removal of dead code:

  • No functional dependencies
  • No API changes affecting users
  • No database schema changes
  • Safe to remove in any release

Expected Outcome

  • Cleaner codebase that reflects current architecture
  • Reduced maintenance burden
  • No confusion about diagnostic tools for obsolete systems
  • Better alignment with offline GC-based pruning strategy</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Dec 8, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview Comment Dec 8, 2025 5:18am
test-portal Ready Ready Preview Comment Dec 8, 2025 5:18am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rooch Ignored Ignored Preview Dec 8, 2025 5:18am

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Co-authored-by: jolestar <77268+jolestar@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove obsolete check-refcount command from runtime pruning system Remove obsolete check_refcount command from archived runtime pruning system Dec 8, 2025
Copilot AI requested a review from jolestar December 8, 2025 05:16
@jolestar jolestar marked this pull request as ready for review December 8, 2025 06:56
Copilot AI review requested due to automatic review settings December 8, 2025 06:56

Copilot AI 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.

Pull request overview

This PR removes the obsolete check-refcount command, a diagnostic tool for the archived runtime pruning system that has been superseded by offline garbage collection. The command compared reference counts across various database column families to identify inconsistencies, but this functionality is no longer relevant as the runtime pruner has been disabled and the refcount tracking system is non-functional in the current offline GC architecture.

Key Changes:

  • Deleted the entire check_refcount.rs command implementation (198 lines)
  • Removed all registrations and references to the command from the DB command infrastructure

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/rooch/src/commands/db/commands/check_refcount.rs Complete deletion of the obsolete refcount diagnostic command implementation
crates/rooch/src/commands/db/mod.rs Removed import, enum variant, and match arm for CheckRefcountCommand
crates/rooch/src/commands/db/commands/mod.rs Removed module declaration for check_refcount

@jolestar jolestar merged commit a0f1387 into main Dec 8, 2025
37 of 38 checks passed
@jolestar jolestar deleted the copilot/remove-check-refcount-command branch December 8, 2025 12:23
jolestar added a commit that referenced this pull request Dec 8, 2025
Re-implement the check_refcount command that was removed in commit #3852
to provide database consistency checking for reference counts used by
the garbage collection system.

This command helps identify inconsistencies between actual node presence
and reference counts, providing health assessment and detailed reporting
for database maintenance operations.

Features:
- Comprehensive reference count consistency checking
- JSON and table output formats
- Configurable limits and batch processing
- Health assessment and issue reporting
- Support for error-only reporting mode

Fixes #3850

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

commands/db: Remove obsolete check-refcount command from runtime pruning system

3 participants