You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
… converter (no behavior change)
Extract two pure functions out of HandleTransmissionTask:
- ShouldReplicateNamespace: the replicate/skip gate (global + has-peer + not-deleted)
- NamespaceDetailToTaskAttributes: the NamespaceDetail -> NamespaceTaskAttributes
wire conversion consumed by the receiver-side apply-if-higher logic
and rewrite HandleTransmissionTask to call them. Behavior is unchanged; only the
DELETED short-circuit moved ahead of the gate (outcome-equivalent: DELETED always
skips, and non-global/single-cluster still skip only when !forceReplicate).
This is groundwork for an eventual CHASM-based namespace replication transport:
that path will share the same gate and the same detail->wire converter so the two
transports can never diverge on which mutations replicate or on the payload shape
they emit. Today only the legacy queue path calls the extracted functions.
Proof of no behavior change: the pre-existing transmission_task_handler_test.go
(which pins the exact Publish(&ReplicationTask{...}) payload via gomock) is
unchanged and still green. Adds conversion_test.go (direct unit tests for both
extracted functions, including the NORMAL-only replication-State special case)
and 3 gate cases (ForceReplicate_BypassesGate, ForceReplicate_DeletedNotReplicated,
DeletedNotReplicated) covering the reordered force/deleted/gate branch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n's field-access style
Two review-follow-up tweaks on the shared-converter extraction, both no
behavior change:
- Fold forceReplicate into ShouldReplicateNamespace with the DELETED check
ahead of it, so force can never bypass the never-replicate-deleted rule.
Previously the gate was called as `!forceReplicate && !ShouldReplicate...`,
which let a caller bypass the gate's DELETED semantics under force; the
committed code masked that with a separate top-level DELETED guard. Making
the single shared gate own the whole force/deleted/global/peer decision is
the point of the extraction: the eventual CHASM transport shares this exact
function and cannot accidentally drop part of the decision.
- Revert the getters the extraction introduced (config.GetRetention() etc.)
back to direct field access (config.Retention) so NamespaceDetailToTaskAttributes
reads line-for-line like the original inline block on main and the diff is a
pure move, not a style change.
All four force/deleted/gate outcomes are identical to main and to the prep
commit; the gomock payload test is unchanged and green. golangci-lint (pinned
v2.9.0, --new-from-rev=main) reports 0 issues.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
med — Forced replication no longer preserves legacy behavior for deleted namespaces.
Before this extraction, the deleted-state check was nested inside if !forceReplicate, so forceReplicate=true always reached Publish. Checking deletion first now skips the force-plus-deleted case, contradicting the PR's no-behavior-change contract and changing the exported replicator's semantics even though today's frontend callers pass false.
Suggestion: Check forceReplicate before the deleted state, then update the new tests and comments to assert the legacy ordering. common/namespace/nsreplication/conversion_test.go:109
Details
small — Independent table cases should run in parallel.
These cases have no shared mutable state, so running them sequentially conflicts with the project's test convention for plain t.Run cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: PR0 of 7
Summary
common/namespace/nsreplicationTests
go test -tags test_dep ./common/namespace/nsreplication/... ./chasm/lib/namespacereplication/...make fmt-importsmake lint-code-fastOperational impact
No behavior change; this is shared preparation for the CHASM namespace-replication stack.