Skip to content

feat: wrap ResultExportConfig around use-case sub-structs#110

Merged
bdchatham merged 1 commit intomainfrom
feat/result-export-shadow-result
Apr 21, 2026
Merged

feat: wrap ResultExportConfig around use-case sub-structs#110
bdchatham merged 1 commit intomainfrom
feat/result-export-shadow-result

Conversation

@bdchatham
Copy link
Copy Markdown
Collaborator

Summary

Applies the sibling-wrapper pattern from #108 to ResultExportConfig. The flat { CanonicalRPC string } becomes a wrapper around a ShadowResult *ShadowResultConfig sub-struct, which carries the canonical-RPC endpoint. Future result-export flavors slot in as siblings (scheduled, per-use-case comparisons, etc.) without renaming existing fields.

  • Types: ResultExportConfig is now a wrapper; ShadowResultConfig owns canonicalRpc. Both in api/v1alpha1/common_types.go.
  • Stale docs removed: the old godoc described a "scheduled mode" reachable by omitting canonicalRpc, but canonicalRpc was CRD-required (MinLength=1), so scheduled mode was never actually reachable through the CRD. Removed the prose; didn't preserve the behavior.
  • Validation: replayerPlanner.Validate (the sole consumer today) rejects an empty resultExport: {} wrapper via the context-free validateResultExport helper + caller-wrap with replayer: prefix — same pattern as validateSnapshotGeneration.
  • Samples: pacific-1-shadow-replayer.yaml updated to the nested shape.
  • Generated: CRDs and DeepCopy regenerated via make manifests generate.
  • No sidecar wiring changed: ResultExportConfig has no active consumer today (was removed with the monitor-task subsystem in feat: remove monitor task system #89); this is schema-only.

Shape

# Before
resultExport:
  canonicalRpc: "http://rpc.pacific-1.prod.platform.sei.io:26657"

# After
resultExport:
  shadowResult:
    canonicalRpc: "http://rpc.pacific-1.prod.platform.sei.io:26657"

Verification

  • make build — succeeds
  • make lint — 0 issues
  • make test — all packages pass, including the new TestReplayerPlanner_Validate_ResultExport covering nil / valid-shadow-result / empty-wrapper-rejection

Context

Identified in the extensibility audit after #108 merged. Both the kubernetes-specialist and platform-engineer flagged ResultExportConfig as the most direct clone of the anti-pattern #108 fixed: two behaviors discriminated by presence of a string field. No launched product, no backward-compat concerns.

Test plan

  • Apply pacific-1-shadow-replayer.yaml and confirm it accepts the new nested shape
  • Apply a manifest with resultExport: {} (no sub-struct) and confirm the planner rejects it with a replayer: resultExport is set but has no sub-struct error
  • Review the regenerated CRD YAML (manifests/sei.io_seinodes.yaml, sei.io_seinodedeployments.yaml) for the resultExport.shadowResult.canonicalRpc path
  • Confirm no existing test fixtures still use the flat ResultExportConfig{ CanonicalRPC: ... } shape (grep verified clean)

🤖 Generated with Claude Code

Refactors the flat ResultExportConfig into a wrapper around use-case
sub-structs, following the pattern merged in #108. First (and currently
only) use case is ShadowResultConfig, which carries the CanonicalRPC
endpoint for app-hash divergence detection.

Removes stale "monitor mode" / "scheduled mode" godoc that described
a scheduled-export behavior that was never reachable (canonicalRpc is
CRD-required via MinLength=1, so "without canonicalRpc" was never a
valid input).

Adds cross-field validation to replayerPlanner.Validate rejecting an
empty resultExport wrapper, mirroring validateSnapshotGeneration at
planner.go:331. Context-free helper, caller wraps with replayer:
prefix — no shared helper takes a mode parameter.

No sidecar code currently consumes ResultExport (was removed with the
monitor-task subsystem in #89); this is a schema-only refactor to
prepare for future use-case sub-structs without needing to rename
existing fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham merged commit cc90017 into main Apr 21, 2026
2 checks passed
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