Skip to content

refactor(node): W1b-4 — seam capsule, CapsuleStore trait/handle carve (#1285)#69

Merged
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b4-seam-capsule
Jul 20, 2026
Merged

refactor(node): W1b-4 — seam capsule, CapsuleStore trait/handle carve (#1285)#69
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b4-seam-capsule

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

What

W1b-4 (5th of the 7 W1b sub-PRs, #1285): carve the cache_*/gap_fill/backfill `impl Node`
methods into a `CapsuleStore` trait + handle under `seams/capsule/`, and land the
`set_self_ref`/`arc_self` deferral from W1b-2 (this is their home per the locked plan's
tangle (b)). Byte-identical bodies relocated, no logic change.

Depends on W1b-3 (merged, origin/main @ 335ac46).

Closes nothing yet (tracking #1285).

MichaelTaylor3d and others added 2 commits July 20, 2026 14:43
Co-Authored-By: Claude <noreply@anthropic.com>
… (#1285, #1298)

Carves the on-disk capsule cache Node methods (cache_list_cached,
cache_remove_cached, cache_fetch_and_cache, gap_fill_generation) into the
CapsuleStore trait (seam 6's public surface), implemented by Node with the
EXISTING method bodies moved unchanged from lib.rs. Also relocates
maybe_backfill_capsule (previously in download.rs's `impl crate::Node`
block) into the same trait, byte-identical.

Lands the W1b-2-deferred self-reference bring-up hooks (set_self_ref/
arc_self) here, per the locked plan's tangle (b): they exist ONLY to let
`&self` capsule read handlers spawn an owned-Arc background pull — a
capsule-store concern, not a peer-network one. They stay a plain
Weak<Node>/Arc<Node> pair for this behaviour-preserving pass; full struct
decomposition into Arc<dyn CapsuleStore> is W1c's job.

async_trait-boxed (matching the other seam traits) so it stays dyn-compatible
for the future Arc<dyn CapsuleStore> handle (W1c).

Every caller now brings CapsuleStore into scope: same-crate (peer.rs's
set_self_ref call, content_serve.rs's maybe_backfill_capsule calls,
chainwatch.rs's NodeGapFiller::gap_fill delegating to gap_fill_generation)
via `use crate::CapsuleStore`, and the two EXTERNAL crates that call the
cache_* methods directly on a dig_node_core::Node — dig-node-service's
control.rs and dig-wallet's lib.rs — via `use dig_node_core::CapsuleStore`.
No signature or behaviour changed anywhere.

Depends on W1b-3 (merged, #1285).

Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d
MichaelTaylor3d marked this pull request as ready for review July 20, 2026 22:14

@MichaelTaylor3d MichaelTaylor3d left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PASS (single correctness gate, §1.10 — behaviour-preserving trait-extraction).

Verified read-only against HEAD 79af7c4:

  1. Zero logic change. All 5 method bodies (cache_list_cached, cache_remove_cached, cache_fetch_and_cache, gap_fill_generation, maybe_backfill_capsule) carved into seams/capsule/capsule_store.rs are byte-identical modulo path-qualification only: module_pathcrate::module_path, backfill_on_miss_enabled()crate::download::backfill_on_miss_enabled(), crate::Bytes32(..)Bytes32(..) (import from digstore_core; crate::Bytes32 is a re-export of digstore_core::Bytes32 per lib.rs:40 — identical type), std::sync::Weak::upgradeWeak::upgrade. No changed assertions/control flow.

  2. 8 cross-crate use-sites are import-only. dig-node-service/src/control.rs (use dig_node_core::{CapsuleStore, Node}) and dig-wallet/src/lib.rs (use dig_node_core::CapsuleStore) add ONLY the use line so the now-trait methods resolve; no call-site signature/behaviour change. Internal seams (chainwatch.rs, peer.rs, content_serve.rs) likewise add CapsuleStore to their use crate::{...} — import-only.

  3. set_self_ref/arc_self behaviour-preserving. Moved from the inline impl Node in lib.rs into the trait as plain Weak<Node>/Arc<Node> (full Arc<dyn CapsuleStore> correctly deferred to W1c). Bodies identical.

  4. Back-compat re-export pub use seams::capsule::CapsuleStore at crate root keeps the path importable; visibility not widened beyond the move.

  5. Versions agree (core 0.13.6, binary 0.47.6); version-increment gate green; 0 unresolved review threads; correctness CI green (Clippy, CodeQL, Analyze rust/actions/js, Test+coverage, Rustfmt, commitlint).

Merge-ready. NB for orchestrator: the three package-build jobs (.msi/.deb/.pkg) were still pending at review time — confirm green before merge per branch protection.

@MichaelTaylor3d
MichaelTaylor3d merged commit 8319345 into main Jul 20, 2026
12 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the feat/w1b4-seam-capsule branch July 20, 2026 22:20
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.

1 participant