Skip to content

refactor(node): W1b-1 — seam content, ContentServer trait/handle carve (#1285) - #66

Merged
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b1-seam-content-impl
Jul 20, 2026
Merged

refactor(node): W1b-1 — seam content, ContentServer trait/handle carve (#1285)#66
MichaelTaylor3d merged 2 commits into
mainfrom
feat/w1b1-seam-content-impl

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

What

W1b-1 (2nd of the 7 W1b sub-PRs, #1285): carve `content_serve.rs`'s `impl Node` methods
into a `ContentServer` trait + handle under `seams/content/`, using the W1a `shared/`
types (`ContentResponse` etc.) as the only cross-seam vocabulary. Behaviour-preserving —
relocate + trait-extract only, no logic/algorithm change.

Depends on W1b-0 (merged, origin/main @ 0d58c7f).

Closes nothing yet (tracking #1285).

MichaelTaylor3dand others added 2 commits July 20, 2026 12:17
Co-Authored-By: Claude <noreply@anthropic.com>
…e (#1285, #1298)
Carves content_serve.rs's Node methods into the ContentServer trait (seam 5's
public surface), implemented by Node with the EXISTING method bodies unchanged
(serve_content_plaintext, manifest_paths, resource_generation) — behaviour-
preserving trait extraction, not a new implementation. async_trait-boxed
(matching shared::AnchoredRootResolver's pattern) so it stays dyn-compatible
for the Arc<dyn ContentServer> handle the W1c composition root will hold.
Private serve-tier helpers (decrypt_local, peer_serve_plaintext,
proxy_full_content) stay as an inherent impl Node block alongside the trait
impl — they are implementation details of this seam, not part of its public
surface. Every caller of the 3 trait methods (dig-node-core's own tests,
dig-node-service's server.rs) now brings `ContentServer` into scope; no
signature, behaviour, or call-site logic changed.
Depends on W1b-0 (merged, #1285).
Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d
MichaelTaylor3d marked this pull request as ready for review July 20, 2026 19:47

@MichaelTaylor3dMichaelTaylor3d left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

PASS (single correctness gate, medium effort) — behaviour-preserving trait extraction, zero logic change.

Verified by reading (no rebuild; CI already green):

  • Zero logic change: serve_content_plaintext, manifest_paths, resource_generation moved from impl Node into pub trait ContentServer + impl ContentServer for Node (seams/content/content_serve.rs) with byte-identical bodies. git diff -w on lib.rs collapses to 12 ins / 4 del (module re-exports + use crate::ContentServer in 6 unit tests); the full-file textual diff is trailing-whitespace/EOL noise only (Rustfmt gate green). Private helpers stay in impl Node.
  • Callers resolve, blast radius bounded: production use-site = dig-node-service/src/server.rs (adds ContentServer to the dig_node_core import); back-compat crate::content_serve/dig_node_core::content_serve paths preserved via re-export. content.rs and tests/content_serve.rs only reference the methods in doc comments — no import needed. No other callers.
  • Cross-seam field reaches (chain/rpc/capsule on Node inside serve_content_plaintext) unchanged — the expected-at-W1b pattern, isolated at W1c. Not a violation.
  • Versions: dig-node-core 0.13.3, dig-node-service 0.47.3, Cargo.lock agree; version-increment check green.
  • Gates green (Rustfmt/Clippy/Test+coverage/commitlint/CodeQL/version); platform .deb/.pkg/.msi builds still running (packaging, non-correctness). Zero review threads open.

Merge-ready once the pending packaging builds finish.

@MichaelTaylor3d
MichaelTaylor3d merged commit c0dc368 into mainJul 20, 2026
13 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the feat/w1b1-seam-content-impl branch July 20, 2026 20:08
MichaelTaylor3d added a commit that referenced this pull request Aug 6, 2026
…tadata (#185)
Closes dig_ecosystem#2145. Hardens two DoS gaps on the anonymous, internet-reachable public-manifest read path. The ticket's fix#1 (the manifest-memo byte budget: MANIFEST_MEMO_MAX_BYTES=32 MiB + MANIFEST_ENTRY_MAX_BYTES=4 MiB + LRU) was already on main; this closes the two remaining gaps:
1. cache.clear now drains the process-lifetime manifest memo (it previously left it intact, so an operator couldn't reclaim it).
2. dig.getMetadata gets a 3 MiB response ceiling. It was the only public-tier read with no response cap (~200 B in -> up to ~100 MB out). A whole JSON object can't be windowed, so an oversized section is refused with a bounded -32015 METADATA_TOO_LARGE. read_metadata_manifest_json returns the rendered Arc<str> so get_metadata checks the raw length BEFORE parsing, so the oversized body is never parsed + re-serialized. Normal metadata serves byte-identically.
Both gates PASS: loop-reviewer (correctness) + loop-security (the getMetadata ceiling is a hard pre-parse bound on every render path, no bypass; cache.clear is control-token-gated, not anonymous-reachable; every arm fails closed). The -32015 error is catalogued in docs.dig.net (companion PR #66). Non-gating follow-ups: #2217 (error-code drift), #2218 (gitnexus runner), #2219 (encoded-length pre-filter).
root [workspace.package].version 0.99.1 -> 0.99.2 (patch, fix).
Closes #2145
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for freeto 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

@MichaelTaylor3d