Skip to content

refactor(domain): extract GetMBCUIDFromCronJobName from controller#295

Merged
llamerada-jp merged 1 commit into
mainfrom
add-domain-GetMBCUIDFromCronJobName
Jun 16, 2026
Merged

refactor(domain): extract GetMBCUIDFromCronJobName from controller#295
llamerada-jp merged 1 commit into
mainfrom
add-domain-GetMBCUIDFromCronJobName

Conversation

@ushitora-anqou

@ushitora-anqou ushitora-anqou commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Extract the CronJob-name-to-MBC-UID mapping logic from the inline closure in SetupWithManager into a domain-layer function.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors MantleBackupConfig controller wiring by moving CronJob-name → MantleBackupConfig UID parsing into the domain layer, making the mapping reusable and directly testable.

Changes:

  • Replaced inline CronJob name parsing in SetupWithManager with domain.GetMBCUIDFromCronJobName.
  • Added GetMBCUIDFromCronJobName to the domain reconciler module alongside the existing CronJob naming helper.
  • Added unit tests for valid/invalid parsing and a round-trip with GetMBCCronJobName.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/controller/mantlebackupconfig_controller.go Uses the extracted domain helper instead of inline prefix parsing in the watch mapper.
internal/controller/domain/mbc_primary_reconciler.go Introduces the exported domain function to parse MBC UID from CronJob names.
internal/controller/domain/mbc_primary_reconciler_test.go Adds unit tests covering the new parsing helper (valid/invalid/round-trip).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/domain/mbc_primary_reconciler_test.go Outdated
Extract the CronJob-name-to-MBC-UID mapping logic from the inline
closure in SetupWithManager into a domain-layer function.

Signed-off-by: Ryotaro Banno <ryotaro.banno@gmail.com>
@ushitora-anqou ushitora-anqou force-pushed the add-domain-GetMBCUIDFromCronJobName branch from cee9268 to 71452dc Compare June 15, 2026 09:09
@ushitora-anqou ushitora-anqou marked this pull request as ready for review June 16, 2026 00:27
@ushitora-anqou ushitora-anqou requested a review from a team as a code owner June 16, 2026 00:27
@ushitora-anqou ushitora-anqou requested review from llamerada-jp and removed request for a team June 16, 2026 00:27
@llamerada-jp llamerada-jp merged commit 1bd7c7e into main Jun 16, 2026
15 checks passed
@llamerada-jp llamerada-jp deleted the add-domain-GetMBCUIDFromCronJobName branch June 16, 2026 01:09
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