Skip to content

chore(deploy): remove orphaned internal/deploy package#1246

Open
cristim wants to merge 1 commit into
mainfrom
chore/arch-13-fix
Open

chore(deploy): remove orphaned internal/deploy package#1246
cristim wants to merge 1 commit into
mainfrom
chore/arch-13-fix

Conversation

@cristim

@cristim cristim commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

Code-review finding ARCH-13 (P3, informational): the internal/deploy package (Docker build/push, ECR login and repository management, frontend S3 + CloudFront upload, deployment profile config) is orphaned dead code. It has zero importers outside its own test files; actual deployment is handled by the GitHub workflows and terraform/. About 26KB of code plus 55KB of tests were still compiled, run in CI, and repeatedly re-assessed in security scans for no benefit.

Fix

Delete the internal/deploy package (11 files, ~2800 lines) and run go mod tidy. The cloudfront, ecr, ecrpublic and s3 AWS SDK modules were only used by this package and drop out of go.mod; gopkg.in/yaml.v3 becomes indirect.

Orphan-status verification

  • Repo-wide grep for the import path internal/deploy across ALL file types (Go, workflows, scripts, docs, Makefiles, JSON), excluding only node_modules, .git and graphify-out: zero hits outside the package itself.
  • Repo-wide grep for distinctive exported identifiers (NewDockerService, NewECRService, NewFrontendService, DeploymentConfig, NewDefaultCommandRunner, LoginToPublicECR, PushToECR, InvalidateCloudFrontCache, FindFrontendDir, BuildAndUpload, SetActiveProfile, GetActiveProfile, MockECRPublicClient): zero hits outside the package itself.
  • Grep for Go files importing "github.com/LeanerCloud/CUDly/internal/deploy": none.

Test evidence

  • go build ./...: success
  • go vet ./...: no issues
  • go test ./internal/...: 4610 tests passed in 23 packages

No regression test applies: this is a pure deletion of unreferenced code, verified by the grep sweep above and a clean full build.

Closes #1202

Summary by CodeRabbit

  • Chores

    • Simplified the application by removing several deployment-related capabilities, including profile management and built-in Docker/ECR/CloudFront/S3 deployment workflows.
    • Reduced bundled dependency requirements.
  • Tests

    • Removed a large set of automated tests tied to the retired deployment features.

@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/s Hours type/chore Maintenance / non-user-visible labels Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6b2ca7b2-3938-4086-9270-22631b3dd782

📥 Commits

Reviewing files that changed from the base of the PR and between ec49d1b and aeb1b45.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod
  • internal/deploy/coverage_extra_test.go
  • internal/deploy/docker.go
📝 Walkthrough

Walkthrough

Updated go.mod dependency metadata by marking gopkg.in/yaml.v3 indirect and removing several AWS SDK v2 service and internal requirements.

Changes

go.mod dependency cleanup

Layer / File(s) Summary
Indirect and removed requirements
go.mod
gopkg.in/yaml.v3 is marked indirect, the AWS SDK v2 service/* block retains kms, lambda, and organizations while dropping other entries, and two internal AWS SDK indirect requirements are removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested labels

severity/low, impact/internal

Poem

A bunny nudged the module tree,
With twitchy nose and careful glee.
One indirect, a few freed lines—
The carrots now match tidy signs.
🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely states the main change: removing the orphaned internal/deploy package.
Linked Issues check ✅ Passed The PR deletes the orphaned internal/deploy package and its dead code, matching the linked issue's recommendation.
Out of Scope Changes check ✅ Passed The changes stay focused on removing internal/deploy and its now-unused dependencies and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/arch-13-fix

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

@cristim

cristim commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim force-pushed the chore/arch-13-fix branch from 5cd3490 to ec49d1b Compare June 19, 2026 21:58
@cristim

cristim commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@cristim have exceeded the limit for the number of chat messages per hour. Please wait 5 minutes and 29 seconds before sending another message.

@cristim

cristim commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@go.mod`:
- Line 82: The `yaml.v3` dependency is incorrectly marked as indirect even
though `pkg/config/load.go` imports and uses `gopkg.in/yaml.v3` directly. Update
`go.mod` so `yaml.v3` remains a direct requirement, and verify the dependency
entry reflects that it is used by the config loading code rather than being
treated as transitive.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5de8e690-adde-4dc7-be66-f23f0c0f8d6f

📥 Commits

Reviewing files that changed from the base of the PR and between 451a70f and ec49d1b.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (12)
  • go.mod
  • internal/deploy/coverage_extra_test.go
  • internal/deploy/docker.go
  • internal/deploy/docker_test.go
  • internal/deploy/ecr.go
  • internal/deploy/ecr_test.go
  • internal/deploy/frontend.go
  • internal/deploy/frontend_test.go
  • internal/deploy/mocks.go
  • internal/deploy/profiles.go
  • internal/deploy/profiles_test.go
  • internal/deploy/types.go
💤 Files with no reviewable changes (11)
  • internal/deploy/types.go
  • internal/deploy/profiles_test.go
  • internal/deploy/docker.go
  • internal/deploy/ecr_test.go
  • internal/deploy/frontend.go
  • internal/deploy/frontend_test.go
  • internal/deploy/mocks.go
  • internal/deploy/ecr.go
  • internal/deploy/coverage_extra_test.go
  • internal/deploy/docker_test.go
  • internal/deploy/profiles.go

Comment thread go.mod
cristim added a commit that referenced this pull request Jul 3, 2026
Fix the ~45 golangci-lint v2 violations that #1276 deliberately skips
because these files are also touched by other open PRs (#1265, #1299).
internal/deploy/* is excluded here as #1246 deletes that package.

Files fixed and linters addressed:
- cmd/helpers_test.go: fieldalignment (govet), unparam
- cmd/main_test.go: fieldalignment (govet), also fix positional struct
  literals broken by field reordering
- cmd/multi_service_filters.go: hugeParam + rangeValCopy (gocritic),
  equalFold (gocritic), godot; all filter functions updated to *Config /
  *Recommendation params with callers updated across the cmd package
- cmd/multi_service_engine_versions_test.go: fieldalignment (govet), godot
- internal/auth/service_password_test.go: fieldalignment (govet), godot
- internal/auth/store_postgres_test.go: fieldalignment (govet), godot
- internal/purchase/approvals.go: err-shadow (govet), misspell
  (analogue->analog, cancelled->canceled, cancelling->canceling)
- internal/purchase/messages.go: hugeParam + rangeValCopy (gocritic),
  godot, misspell (authorised->authorized)

Incidental changes: caller sites in cmd/multi_service{,_helpers,_test,
_filters_test}.go; handle*Message signature callers in
internal/purchase/{coverage_extra,money_path_regression}_test.go;
test assertions updated to match renamed error strings.
@cristim

cristim commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim force-pushed the chore/arch-13-fix branch from ec49d1b to 171b973 Compare July 10, 2026 22:06
@cristim

cristim commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim force-pushed the chore/arch-13-fix branch from 171b973 to bbae0e9 Compare July 17, 2026 07:56
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Rebased onto origin/main (27fdb06). Modify/delete conflicts resolved by confirming the deletions: internal/deploy/ is not imported by anything in main, so removing it remains valid. Gates: go build/vet exit 0; golangci-lint v2.10.1 exit 0.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@cristim Thanks for the update on the rebase and validation. Triggering a fresh review now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

The internal/deploy package (Docker build/push, ECR login/repo
management, frontend S3+CloudFront upload, deployment profiles) has
zero importers outside its own test files. Actual deployment is
handled by the GitHub workflows and terraform/. The dead code was
still compiled, tested in CI, and re-assessed in every security scan
for no benefit (ARCH-13, P3).

Verification that the package is orphaned:
- repo-wide grep for the import path "internal/deploy" across all
  file types (Go, workflows, scripts, docs, Makefiles): zero hits
  outside the package itself
- repo-wide grep for distinctive exported identifiers
  (NewDockerService, NewECRService, NewFrontendService,
  DeploymentConfig, LoginToPublicECR, BuildAndUpload, ...): zero hits
  outside the package itself

Also runs go mod tidy: the cloudfront, ecr, ecrpublic and s3 AWS SDK
modules were only used by this package and drop out of go.mod.

go build ./..., go vet ./... and go test ./internal/... all pass
after removal.

Closes #1202
@cristim
cristim force-pushed the chore/arch-13-fix branch from bbae0e9 to aeb1b45 Compare July 17, 2026 11:07
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Rebased onto origin/main (89658a3 -> a945344) which includes #1437 (tflint plugin cache + retry) and #1438 (trivy \*\*/.terraform skip). Workflow files confirmed to match main. Gates: go build/vet exit 0, go mod verify ok (all modules verified), internal/deploy directory confirmed removed, golangci-lint ./cmd/... exit 0 (0 issues). Pre-commit should be fully green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARCH-13: internal/deploy package is orphaned dead code

1 participant