Skip to content

refactor: move pkg/units from orchestrator to shared#3230

Merged
dobrac merged 1 commit into
mainfrom
dobrac/refactor-units-to-shared
Jul 8, 2026
Merged

refactor: move pkg/units from orchestrator to shared#3230
dobrac merged 1 commit into
mainfrom
dobrac/refactor-units-to-shared

Conversation

@dobrac

@dobrac dobrac commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Split out from #3113.

pkg/units holds generic byte-size helpers with no orchestrator-specific dependencies. Moving it to shared lets shared packages (notably pkg/storage) reuse them without importing orchestrator. Pure move + import-path updates; no behavior change.

pkg/units holds byte-size helpers with no orchestrator-specific
dependencies. Moving it to shared lets shared packages (e.g. storage)
reuse them without importing orchestrator.
@cla-bot cla-bot Bot added the cla-signed label Jul 8, 2026
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Mechanical package move and import updates with no logic changes.

Overview
Relocates the generic megabyte/byte conversion helpers into shared so other shared packages can use them without depending on orchestrator. Call sites keep the same MBToBytes / BytesToMB API; this is an import-path change only with no intended behavior change.

Reviewed by Cursor Bugbot for commit 4a1ed90. Bugbot is set up for automated code reviews on this repo. Configure here.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request moves the units package from the orchestrator package (packages/orchestrator/pkg/units) to the shared package (packages/shared/pkg/units) and updates all corresponding import paths across multiple files in the orchestrator service. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

❌ 6 Tests Failed:

Tests completed Failed Passed Skipped
3208 6 3202 6
View the top 3 failed test(s) by shortest run time
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN
Stack Traces | 0s run time
=== RUN   TestTemplateBuildRUN
=== PAUSE TestTemplateBuildRUN
=== CONT  TestTemplateBuildRUN
--- FAIL: TestTemplateBuildRUN (0.00s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestUpdateTemplateVisibilityToPrivateWithAPIKey
Stack Traces | 158s run time
=== RUN   TestUpdateTemplateVisibilityToPrivateWithAPIKey
=== PAUSE TestUpdateTemplateVisibilityToPrivateWithAPIKey
=== CONT  TestUpdateTemplateVisibilityToPrivateWithAPIKey
    template_update_test.go:57: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestUpdateTemplateVisibilityToPrivateWithAPIKey (158.04s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestUpdateTemplateWithInvalidAPIKey
Stack Traces | 158s run time
=== RUN   TestUpdateTemplateWithInvalidAPIKey
=== PAUSE TestUpdateTemplateWithInvalidAPIKey
=== CONT  TestUpdateTemplateWithInvalidAPIKey
    template_update_test.go:107: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestUpdateTemplateWithInvalidAPIKey (158.04s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN/Single_RUN_command
Stack Traces | 167s run time
=== RUN   TestTemplateBuildRUN/Single_RUN_command
=== PAUSE TestTemplateBuildRUN/Single_RUN_command
=== CONT  TestTemplateBuildRUN/Single_RUN_command
    build_template_test.go:133: test-ubuntu-run: [info] Building template uq940psp7tvonncdwvsj/a00e4fca-6179-4bbd-939d-e2150998515e
    build_template_test.go:133: test-ubuntu-run: [info] [base] FROM ubuntu:22.04 [f9f564014e009a9561a82bf8c84f9314242971e833fb019936654ecba452f184]
    build_template_test.go:133: test-ubuntu-run: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:d6834b4a794c03efa2c998853e64969fa8851b11b2ade63292268872a37759d0 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:ee303252be2539575823e20ea3e0716260d1697248a414f986137fbdaca223fa 13 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-ubuntu-run: [info] Layers extracted
    build_template_test.go:133: test-ubuntu-run: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning sandbox template
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-ubuntu-run: [info] Sandbox template provisioned
    build_template_test.go:133: test-ubuntu-run: [info] [base] DEFAULT USER user [49e586c2171254c6bc4a09e84eedac32dbcf113a158c24248129af2f49cbed74]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] RUN echo 'Hello, World!' [c72b4f813c2a16b0fc1a1c5da7b1365a304cbac516b22dc304a71f70aae48ac0]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] [stdout]: Hello, World!
    build_template_test.go:133: test-ubuntu-run: [info] [finalize] Finalizing template build [92c524e30533398ebb41ce04c2596130f0cdecc9aa328e28fdb16a1b11f61d62]
    build_template_test.go:133: test-ubuntu-run: [error] Build failed: An internal error occurred. Please try again or contact support with the build ID.
    build_template_test.go:166: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestTemplateBuildRUN/Single_RUN_command (167.01s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestAssignmentOrderingLatestWins
Stack Traces | 168s run time
=== RUN   TestAssignmentOrderingLatestWins
=== PAUSE TestAssignmentOrderingLatestWins
=== CONT  TestAssignmentOrderingLatestWins
    template_tags_test.go:522: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestAssignmentOrderingLatestWins (168.09s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestCommandKillNextApp
Stack Traces | 262s run time
=== RUN   TestCommandKillNextApp
=== PAUSE TestCommandKillNextApp
=== CONT  TestCommandKillNextApp
    process_test.go:30: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestCommandKillNextApp (262.05s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@claude claude Bot 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.

LGTM — pure move of pkg/units to shared with import path updates only.

Extended reasoning...

Overview

This PR moves packages/orchestrator/pkg/units to packages/shared/pkg/units and updates import paths in 9 orchestrator files. The units.go file itself is renamed with 100% similarity (2 trivial helpers: MBToBytes and BytesToMB, both bit-shifts by 20). Split out from #3113 to enable shared packages (e.g. pkg/storage) to consume the helpers without importing orchestrator.

Security risks

None. The moved code is a pure utility with no I/O, no external inputs, and no security surface.

Level of scrutiny

Minimal. This is a mechanical file relocation with no behavior change — the only diffs beyond the rename are import statement swaps. I verified no stale references to the old path (orchestrator/pkg/units) remain anywhere in the tree, and the destination directory contains the expected file.

Other factors

No bugs were found by the bug hunting system. The bug hunter had no findings, and the PR description accurately describes the change. Compilation correctness is guaranteed by the Go toolchain — if any import were missed, the build would fail.

@dobrac dobrac enabled auto-merge (squash) July 8, 2026 21:51
@dobrac dobrac merged commit b90a5dc into main Jul 8, 2026
43 checks passed
@dobrac dobrac deleted the dobrac/refactor-units-to-shared branch July 8, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants