Repository navigation
node-ctl: split facets.rs into facet and local-state modules (pure move) - #563
Conversation
f01d43b to
87185fb
Compare
facets.rs holds the facet registry and dispatch together with every facet's implementation. Keep the registry, dispatch and shared publish types in facets.rs and move each facet into its own child module: network_policy, template_desired_state, sandbox_desired_state, cluster_deleted_eviction, port_exposure, inventory_publish and the local_state reads they share. Generated by scripts/split_rust_module.py (#562) from the spec in the pull request. Items move verbatim. The only edits keep each item's reach: 101 private items, fields or methods become pub(super). The parent re-exports the moved items, so no caller changes.
87185fb to
1576058
Compare
nickdujay-pplx
left a comment
There was a problem hiding this comment.
Reviewed at 157605880120760bec2c9411c0e0ae5e0bd91e3e; no blocking findings.
Verified all 129 original top-level items survive the split with their contents unchanged apart from the documented visibility adjustments and formatting. Checked module/re-export wiring and the module-sensitive macros; reconciliation decisions, retries, RPC payloads, and snapshot/inventory handling are unchanged.
Validation: independently reproduced the split across all 8 Rust files, then ran all 93 node-ctl tests with real PostgreSQL, all features, and SPACE_CI_REQUIRE_TEST_DEPS=1: 93 passed, 0 skipped. Current CI checks are green.
No schema, configuration, or protocol migration is introduced, so this does not add a deployment-order or rollback dependency. The documented tracing-target and diagnostic-location changes remain; I found no exact old-target selectors in this repository.
ReviewNo findings. Verified against What I ran:
I also checked that the docs fixups the body lists as follow-ups are still the only stale pointers: What I didn't check: whether the grouping is the right one. That's a design call, and I took the body's word for it. I also didn't rebuild or retest the crate; CI is green on this head. |
the-gigi-pplx
left a comment
There was a problem hiding this comment.
Approved. No findings; details in the review comment above.
Summary
crates/libs/node/ctl/server/src/facets.rs(2,765 code lines) holds node-ctl's facet registry and dispatch, and next to them every facet's implementation. The facets share nothing but the dispatch and a few local-state readers. This keeps the registry, dispatch and shared publish types infacets.rsand moves the facets, and the local-state reads they share, into child modules.facets.rsdrops to 413 code lines; the largest new file islocal_state.rsat 539.This is a pure move, generated by
scripts/split_rust_module.py(#562) from the spec below and proved by itsverify. It is part of splitting the largest production modules into smaller ones with one job each.What moved where
network_policytemplate_desired_statesandbox_desired_statecluster_deleted_evictionport_exposureinventory_publishlocal_statefacets.rs(parent)How to check it
The spec (item names, not lines):
The tool is
scripts/split_rust_module.pyfrom #562 (not on main yet).b9fc395e0, runsplit_rust_module.py apply spec.toml && cargo fmt --all. This reproduces the first commit.split_rust_module.py verify origin/main→regenerated and compared 8 files from 1 split parents: identical.verifyderives the spec from the diff, regenerates the split from the merge base, and requires HEAD's Rust files to equal the rustfmt'd result byte for byte.pub(super). Each keeps the reach the item had: one module deeper,pub(super)reaches exactly the old module.Observable changes
Log targets: 41
tracingevents without an explicittarget:now log under the new module paths (pplx_space_node_ctl_server::facets::<module>instead ofpplx_space_node_ctl_server::facets). Nothing in the repository selects on these targets exactly.Diagnostics name new locations:
code.filepath,code.linenoandcode.namespace;std::any::type_nameof a moved type names its new module;The reviews found nothing in the repository that depends on these.
Validation
Run on a Linux development machine at the PR head:
cargo check --workspace --all-targets --all-features --locked: pass, no warnings.run_clippy_checks(ci/scripts/run-rust-checks.sh) with-D warnings: pass.cargo check -p pplx-space-node-ctl-server --no-default-features --all-targets: pass.cargo nextest run -p pplx-space-node-ctl-server --all-featureswith Postgres andSPACE_CI_REQUIRE_TEST_DEPS=1: 93/93 passed, none skipped. No tests of this package are in the privileged group.file_sizeentry below.Interactions
No open pull request touches
facets.rs. Nothing outsidecrates/cites the file or a moved function.Follow-ups, kept out of this PR because
verifyallows no other Rust edits: a doc comment ininternal/api/server/src/node_local_backup_pending.rsstill pointscollect_pending_local_backupsatfacets.rs; and imports infacets.rsthat only the child modules use could move to them.The archcheck
file_sizebaseline entry for this file is now stale (an advisory finding). Split PRs leave that table alone, so they don't conflict with each other there; one follow-up prunes the stale entries after they land.Rollback
Revert the commit(s). No data, configuration, wire or public API change.
🤖 Generated with Claude Code