Skip to content

refactor(mirror): rename source types to ledgerV2Http / ledgerV2Database#1590

Open
sylr wants to merge 1 commit into
release/v3.0from
feat/mirror-sources-list
Open

refactor(mirror): rename source types to ledgerV2Http / ledgerV2Database#1590
sylr wants to merge 1 commit into
release/v3.0from
feat/mirror-sources-list

Conversation

@sylr

@sylr sylr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Renames the two mirror source-type discriminators from http / postgres to ledgerV2Http / ledgerV2Database. The mirrorSource config stays a single object with one sub-property selecting the source type.

Supersedes the earlier multi-source (mirrorSources list) exploration on this branch — we decided not to implement several sources per mirror ledger for now. The history was rewritten to a single focused rename commit.

Why

http / postgres describe the transport, not what they connect to. ledgerV2Http / ledgerV2Database convey that both current sources read from a Ledger v2 system — via its HTTP API, or directly from its PostgreSQL database.

Scope

  • Proto (common.proto): oneof field names http/postgresledger_v2_http/ledger_v2_database. Tag numbers (2/3) are preserved, so the change is wire-compatible with existing persisted data — only the field names (JSON keys + Go accessors) change.
  • HTTP API: mirrorSource.type values → ledgerV2Http / ledgerV2Database (default ledgerV2Http).
  • ledgerctl: --mirror-source-type values + completions + help.
  • Operator CRD: spec.mirrorSource.ledgerV2Http / .ledgerV2Database sub-fields, plus a new CEL rule enforcing exactly one source type. Regenerated deepcopy + CRD YAML (config + helm, in sync).
  • Docs + openapi updated.

The underlying message/struct type names (HttpMirrorSourceConfig, PostgresMirrorSource, …) are intentionally unchanged — they are internal identifiers that never appear in JSON/YAML.

Compatibility

Breaking rename of the API/CRD discriminator on pre-GA v1alpha1; existing mirror Ledger CRs / API bodies using http/postgres must switch to ledgerV2Http/ledgerV2Database. Persisted proto data is unaffected (tag numbers unchanged).

Verification

  • Generated proto diff is minimal and canonical (commonpb only, no toolchain churn).
  • Build green (main + operator); touched unit/integration suites pass: admission, HTTP handler, FSM create/promote, ledgerctl flags, operator controller; e2e mirror suite compiles.
  • Report-only golangci-lint on the touched packages: 0 issues.

Note: the sandbox's proto/golangci toolchain drifted mid-session (a --fix tag-reorder + a golangci-lint linter-set change); those artifacts were kept out of this diff, which contains only the rename.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7bc17dd-e6fa-4849-a3f9-9c44cfcc8b41

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mirror-sources-list

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NumaryBot

NumaryBot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

✅ Approve — automated review

The rename of source types to ledgerV2Http / ledgerV2Database is consistently applied across all layers: proto definitions, HTTP and CLI handling, operator CRD/controller paths, admission logic, tests, docs, and OpenAPI specs. No correctness issues were identified by any reviewer, all modified lines are covered by tests, and project coverage remains at an acceptable level. No actionable findings remain.

No findings.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.48%. Comparing base (20c929c) to head (ca1468e).
⚠️ Report is 7 commits behind head on release/v3.0.

Additional details and impacted files
@@               Coverage Diff                @@
##           release/v3.0    #1590      +/-   ##
================================================
- Coverage         75.00%   74.48%   -0.52%     
================================================
  Files               429      430       +1     
  Lines             44956    45722     +766     
================================================
+ Hits              33719    34057     +338     
- Misses             8297     8629     +332     
- Partials           2940     3036      +96     
Flag Coverage Δ
e2e 74.48% <100.00%> (-0.52%) ⬇️
scenario 74.48% <100.00%> (-0.52%) ⬇️
unit 74.48% <100.00%> (-0.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sylr sylr force-pushed the feat/mirror-sources-list branch from 27f1e29 to c69b244 Compare July 15, 2026 09:51
@sylr sylr changed the title feat(mirror): restructure mirrorSource into a list of named mirrorSources refactor(mirror): rename source types to ledgerV2Http / ledgerV2Database Jul 15, 2026
The mirror source-type discriminators were named `http` / `postgres`, which
describe the transport rather than what they connect to. Rename them to
`ledgerV2Http` and `ledgerV2Database` so they convey that both read from a
Ledger v2 system (via its HTTP API or directly from its PostgreSQL database).

The `mirrorSource` config stays a single object with one sub-property selecting
the source type (multi-source support is intentionally not implemented). Renamed
across the proto oneof field names (JSON keys + Go accessors), the HTTP body
`type` values, the ledgerctl `--mirror-source-type` values, and the operator CRD
`spec.mirrorSource` sub-fields (+ a new CEL rule enforcing exactly one type). The
underlying message/struct type names (HttpMirrorSourceConfig, PostgresMirrorSource,
…) are unchanged — they are internal identifiers that never appear in JSON/YAML.

The proto change only renames oneof field names; tag numbers (2/3) are preserved,
so it is wire-compatible with existing persisted data.

Rejected: multiple mirror sources per ledger (mirrorSources list) | not needed for now
Rejected: rename the underlying config message/struct types | internal-only names, never user-visible
Confidence: high
Scope-risk: moderate
@sylr sylr force-pushed the feat/mirror-sources-list branch from c69b244 to ca1468e Compare July 15, 2026 10:34

@flemzord flemzord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed at ca1468e6. The rename is otherwise consistently propagated through proto, HTTP input, CLI, operator CRDs, docs, and generated artifacts, and all targeted tests plus CI pass. One OpenAPI response-contract gap remains; details are inline.

Comment thread openapi.yml
- postgres
default: http
description: Source type (defaults to "http" if omitted)
- ledgerV2Http

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Split the request and response mirror-source schemas

This schema is also referenced by LedgerInfo, but that response is not encoded through mirrorSourceBody. LedgerInfo.MarshalJSON calls protoFieldJSON, so the renamed proto oneof serializes as {\"ledgerV2Http\":{...}} (or ledgerV2Database), not the flat {\"type\":\"ledgerV2Http\",...} declared here. Generated clients therefore still cannot model mirror-ledger responses from this contract. Please give LedgerInfo a oneof-shaped response schema, or normalize response serialization to the flat discriminator.

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.

3 participants