Skip to content

Rename snapshot templates to images and artifacts#663

Open
law-chain-hot wants to merge 1 commit into
boxlite-ai:mainfrom
law-chain-hot:codex/snapshot-image-naming
Open

Rename snapshot templates to images and artifacts#663
law-chain-hot wants to merge 1 commit into
boxlite-ai:mainfrom
law-chain-hot:codex/snapshot-image-naming

Conversation

@law-chain-hot
Copy link
Copy Markdown

Summary

  • Rename the reusable sandbox base surface away from Snapshot so it no longer conflicts with backup/runtime snapshots.
  • Use Image for user-facing dashboard copy, BoxTemplate for control-plane metadata, and artifact/artifactRef/cache for runtime and runner ownership.
  • Split the old SnapshotManager responsibilities across BoxTemplate metadata, RuntimeArtifact orchestration, RunnerArtifactCache state, and the ArtifactRegistry service/config.
  • Update API, dashboard routes/copy, runner endpoints, SDK/generated TypeScript clients, proxy support, infra config, and the database migration.

Why three layers

The old Snapshot name was doing three jobs at once: the user-selected base, the runtime artifact, and the per-runner cached copy. Splitting those responsibilities makes ownership explicit: the control plane owns metadata and defaults, artifact logic owns build/pull/remove work, and each runner owns local cache state. Backup snapshots remain a separate concept.

User-facing
  Image
    |
    v
Control plane
  BoxTemplate
    - metadata, defaults, visibility, lifecycle
    - stores artifactRef
    |
    v
Runtime
  RuntimeArtifact / artifactRef
    - build, pull, remove orchestration
    |
    v
Runner
  RunnerArtifactCache
    - per-runner pull/build state

Migration notes

  • Adds post-deploy migration 1780200000000 to rename snapshot tables, columns, indexes, enums, and permissions to box_template, runner_artifact_cache, artifactRef, template, and template permissions.
  • The migration uses existence checks for rename paths, but it expects the current main snapshot schema to exist for post-rename defaults and index recreation.
  • Backup snapshot DTOs/fields are intentionally not renamed.

Test plan

  • NX_DAEMON=false yarn nx run dashboard:build
  • NX_DAEMON=false yarn nx run api:test --runInBand box-template.service system-templates artifact-ref sandbox-to-box.mapper
  • NX_DAEMON=false yarn nx run api-client:build
  • NX_DAEMON=false yarn nx run runner-api-client:build
  • NX_DAEMON=false yarn nx run sdk-typescript:build
  • go test ./... in apps/api-client-go
  • go build ./... in apps/proxy
  • go test ./... and go build ./... in apps/artifact-registry

Known verification blockers

  • make build:apps is blocked by current repo/env issues unrelated to this diff: missing VERSION, missing apps/hack/computer-use/build-computer-use-amd64.sh, and Nx resolving apps/apps/... paths for API/otel builds.
  • Runner full build/test is blocked in this worktree by missing sdks/go/libboxlite.a; make dev:go and the pre-push changed-test hook are blocked by uninitialized vendored submodules for libkrun/e2fsprogs.
  • box-template.controller.spec imports modules that hit existing node-forge and Request.user typing issues; the focused service/utils/system-template/mapping tests pass.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Important

Review skipped

Too many files!

This PR contains 298 files, which is 148 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f113a0be-394c-40fc-a623-698b094cad58

📥 Commits

Reviewing files that changed from the base of the PR and between 71e1754 and dd12512.

⛔ Files ignored due to path filters (2)
  • apps/artifact-registry/go.sum is excluded by !**/*.sum
  • apps/go.work is excluded by !**/*.work
📒 Files selected for processing (298)
  • apps/api-client-go/api_templates.go
  • apps/api-client-go/client.go
  • apps/api-client-go/model_box_template_dto.go
  • apps/api-client-go/model_build_info.go
  • apps/api/src/app.service.ts
  • apps/api/src/audit/decorators/audit.decorator.ts
  • apps/api/src/audit/enums/audit-action.enum.ts
  • apps/api/src/audit/enums/audit-target.enum.ts
  • apps/api/src/audit/interceptors/audit.interceptor.ts
  • apps/api/src/boxlite-rest/boxlite-box.controller.ts
  • apps/api/src/boxlite-rest/boxlite-me.controller.ts
  • apps/api/src/boxlite-rest/mappers/sandbox-to-box.mapper.spec.ts
  • apps/api/src/boxlite-rest/mappers/sandbox-to-box.mapper.ts
  • apps/api/src/config/configuration.ts
  • apps/api/src/config/dto/configuration.dto.ts
  • apps/api/src/docker-registry/controllers/docker-registry.controller.ts
  • apps/api/src/docker-registry/services/docker-registry.service.ts
  • apps/api/src/generate-openapi.ts
  • apps/api/src/interceptors/metrics.interceptor.ts
  • apps/api/src/main.ts
  • apps/api/src/migrations/1741088883002-migration.ts
  • apps/api/src/migrations/1753100751731-migration.ts
  • apps/api/src/migrations/post-deploy/1780200000000-migration.ts
  • apps/api/src/notification/emitters/notification-redis.emitter.ts
  • apps/api/src/notification/gateways/notification-emitter.abstract.ts
  • apps/api/src/notification/gateways/notification.gateway.ts
  • apps/api/src/notification/services/notification.service.ts
  • apps/api/src/openapi-webhooks.ts
  • apps/api/src/organization/constants/global-organization-roles.constant.ts
  • apps/api/src/organization/constants/organization-events.constant.ts
  • apps/api/src/organization/constants/sandbox-states-consuming-compute.constant.ts
  • apps/api/src/organization/constants/snapshot-states-consuming-resources.constant.ts
  • apps/api/src/organization/constants/template-states-consuming-resources.constant.ts
  • apps/api/src/organization/controllers/organization-region.controller.ts
  • apps/api/src/organization/controllers/organization.controller.ts
  • apps/api/src/organization/dto/create-organization-quota.dto.ts
  • apps/api/src/organization/dto/organization-usage-overview.dto.ts
  • apps/api/src/organization/dto/organization.dto.ts
  • apps/api/src/organization/dto/snapshot-usage-overview-internal.dto.ts
  • apps/api/src/organization/dto/template-usage-overview-internal.dto.ts
  • apps/api/src/organization/dto/update-organization-quota.dto.ts
  • apps/api/src/organization/entities/organization.entity.ts
  • apps/api/src/organization/enums/organization-resource-permission.enum.ts
  • apps/api/src/organization/events/organization-suspended-template-deactivated.event.ts
  • apps/api/src/organization/helpers/organization-usage.helper.ts
  • apps/api/src/organization/organization.module.ts
  • apps/api/src/organization/services/organization-usage.service.ts
  • apps/api/src/organization/services/organization.service.ts
  • apps/api/src/region/constants/region-events.constant.ts
  • apps/api/src/region/dto/artifact-registry-credentials.dto.ts
  • apps/api/src/region/dto/create-region-internal.dto.ts
  • apps/api/src/region/dto/create-region.dto.ts
  • apps/api/src/region/dto/region.dto.ts
  • apps/api/src/region/dto/update-region.dto.ts
  • apps/api/src/region/entities/region.entity.ts
  • apps/api/src/region/events/region-artifact-registry-creds.event.ts
  • apps/api/src/region/events/region-created.event.ts
  • apps/api/src/region/region.module.ts
  • apps/api/src/region/services/region.service.ts
  • apps/api/src/sandbox/constants/box-template-events.ts
  • apps/api/src/sandbox/constants/snapshot-events.ts
  • apps/api/src/sandbox/constants/system-templates.spec.ts
  • apps/api/src/sandbox/constants/system-templates.ts
  • apps/api/src/sandbox/controllers/box-template.controller.spec.ts
  • apps/api/src/sandbox/controllers/box-template.controller.ts
  • apps/api/src/sandbox/controllers/runner.controller.ts
  • apps/api/src/sandbox/controllers/sandbox.controller.ts
  • apps/api/src/sandbox/controllers/snapshot.controller.ts
  • apps/api/src/sandbox/controllers/workspace.deprecated.controller.ts
  • apps/api/src/sandbox/dto/box-template.dto.spec.ts
  • apps/api/src/sandbox/dto/box-template.dto.ts
  • apps/api/src/sandbox/dto/build-info.dto.ts
  • apps/api/src/sandbox/dto/create-box-template.dto.ts
  • apps/api/src/sandbox/dto/create-sandbox.dto.ts
  • apps/api/src/sandbox/dto/job-type-map.dto.ts
  • apps/api/src/sandbox/dto/job.dto.ts
  • apps/api/src/sandbox/dto/list-box-templates-query.dto.ts
  • apps/api/src/sandbox/dto/list-sandboxes-query.dto.ts
  • apps/api/src/sandbox/dto/paginated-box-templates.dto.ts
  • apps/api/src/sandbox/dto/runner-artifact-cache.dto.ts
  • apps/api/src/sandbox/dto/runner-health.dto.ts
  • apps/api/src/sandbox/dto/runner-status.dto.ts
  • apps/api/src/sandbox/dto/runner.dto.ts
  • apps/api/src/sandbox/dto/sandbox.dto.ts
  • apps/api/src/sandbox/dto/snapshot.dto.ts
  • apps/api/src/sandbox/dto/update-box-template.dto.ts
  • apps/api/src/sandbox/dto/update-sandbox-state.dto.ts
  • apps/api/src/sandbox/dto/workspace.deprecated.dto.ts
  • apps/api/src/sandbox/entities/box-template-region.entity.ts
  • apps/api/src/sandbox/entities/box-template.entity.ts
  • apps/api/src/sandbox/entities/build-info.entity.ts
  • apps/api/src/sandbox/entities/runner-artifact-cache.entity.ts
  • apps/api/src/sandbox/entities/runner.entity.ts
  • apps/api/src/sandbox/entities/sandbox.entity.ts
  • apps/api/src/sandbox/entities/warm-pool.entity.ts
  • apps/api/src/sandbox/enums/box-template-state.enum.ts
  • apps/api/src/sandbox/enums/job-type.enum.ts
  • apps/api/src/sandbox/enums/resource-type.enum.ts
  • apps/api/src/sandbox/enums/runner-artifact-cache-state.enum.ts
  • apps/api/src/sandbox/enums/sandbox-state.enum.ts
  • apps/api/src/sandbox/errors/runtime-artifact-state-error.ts
  • apps/api/src/sandbox/events/box-template-activated.event.ts
  • apps/api/src/sandbox/events/box-template-created.event.ts
  • apps/api/src/sandbox/events/box-template-removed.event.ts
  • apps/api/src/sandbox/events/box-template-state-updated.event.ts
  • apps/api/src/sandbox/events/snapshot-activated.event.ts
  • apps/api/src/sandbox/events/snapshot-created.event.ts
  • apps/api/src/sandbox/events/snapshot-removed.event.ts
  • apps/api/src/sandbox/events/snapshot-state-updated.event.ts
  • apps/api/src/sandbox/guards/box-template-access.guard.ts
  • apps/api/src/sandbox/guards/box-template-read-access.guard.ts
  • apps/api/src/sandbox/managers/runtime-artifact.manager.ts
  • apps/api/src/sandbox/managers/sandbox-actions/sandbox-start.action.ts
  • apps/api/src/sandbox/managers/sandbox.manager.ts
  • apps/api/src/sandbox/managers/snapshot.manager.ts
  • apps/api/src/sandbox/proxy/log-proxy.ts
  • apps/api/src/sandbox/runner-adapter/runnerAdapter.ts
  • apps/api/src/sandbox/runner-adapter/runnerAdapter.v0.ts
  • apps/api/src/sandbox/runner-adapter/runnerAdapter.v2.ts
  • apps/api/src/sandbox/sandbox.module.ts
  • apps/api/src/sandbox/services/box-template.service.spec.ts
  • apps/api/src/sandbox/services/box-template.service.ts
  • apps/api/src/sandbox/services/job-state-handler.service.ts
  • apps/api/src/sandbox/services/job.service.ts
  • apps/api/src/sandbox/services/runner.service.ts
  • apps/api/src/sandbox/services/sandbox-warm-pool.service.ts
  • apps/api/src/sandbox/services/sandbox.service.ts
  • apps/api/src/sandbox/services/snapshot.service.ts
  • apps/api/src/sandbox/subscribers/box-template.subscriber.ts
  • apps/api/src/sandbox/subscribers/snapshot.subscriber.ts
  • apps/api/src/sandbox/utils/artifact-ref.util.spec.ts
  • apps/api/src/sandbox/utils/artifact-ref.util.ts
  • apps/api/src/sandbox/utils/snapshot-ref.util.spec.ts
  • apps/api/src/webhook/README.md
  • apps/api/src/webhook/constants/webhook-events.constants.ts
  • apps/api/src/webhook/dto/webhook-event-payloads.dto.ts
  • apps/api/src/webhook/services/webhook-event-handler.service.ts
  • apps/artifact-registry/.gitignore
  • apps/artifact-registry/Dockerfile
  • apps/artifact-registry/LICENSE
  • apps/artifact-registry/cmd/main.go
  • apps/artifact-registry/go.mod
  • apps/artifact-registry/internal/buildinfo.go
  • apps/artifact-registry/internal/config/config.go
  • apps/artifact-registry/internal/logger/logger.go
  • apps/artifact-registry/internal/server/config.go
  • apps/artifact-registry/internal/server/server.go
  • apps/artifact-registry/project.json
  • apps/dashboard/src/App.tsx
  • apps/dashboard/src/api/apiClient.ts
  • apps/dashboard/src/components/ApiKeyTable.tsx
  • apps/dashboard/src/components/CreateApiKeyDialog.tsx
  • apps/dashboard/src/components/CreateRegionDialog.tsx
  • apps/dashboard/src/components/ErrorBoundaryFallback.tsx
  • apps/dashboard/src/components/OrganizationMembers/ViewerOrganizationRoleCheckbox.tsx
  • apps/dashboard/src/components/Playground/Sandbox/CodeSnippets/python.ts
  • apps/dashboard/src/components/Playground/Sandbox/CodeSnippets/typescript.ts
  • apps/dashboard/src/components/Playground/Sandbox/Parameters/Management.tsx
  • apps/dashboard/src/components/Playground/Sandbox/Parameters/index.tsx
  • apps/dashboard/src/components/RegionDetailsSheet.tsx
  • apps/dashboard/src/components/RunnerDetailsSheet.tsx
  • apps/dashboard/src/components/Sandbox/CreateSandboxSheet.tsx
  • apps/dashboard/src/components/SandboxDetailsSheet.tsx
  • apps/dashboard/src/components/SandboxTable/SandboxTableHeader.tsx
  • apps/dashboard/src/components/SandboxTable/columns.tsx
  • apps/dashboard/src/components/SandboxTable/constants.ts
  • apps/dashboard/src/components/SandboxTable/filters/TemplateFilter.tsx
  • apps/dashboard/src/components/SandboxTable/index.tsx
  • apps/dashboard/src/components/SandboxTable/state-icons.tsx
  • apps/dashboard/src/components/SandboxTable/types.ts
  • apps/dashboard/src/components/Sidebar.tsx
  • apps/dashboard/src/components/UpdateRegionDialog.tsx
  • apps/dashboard/src/components/sandboxes/SandboxInfoPanel.tsx
  • apps/dashboard/src/components/snapshots/SnapshotTable/index.ts
  • apps/dashboard/src/components/snapshots/SnapshotTable/utils.ts
  • apps/dashboard/src/components/templates/CreateTemplateDialog.tsx
  • apps/dashboard/src/components/templates/TemplateTable/BulkActionAlertDialog.tsx
  • apps/dashboard/src/components/templates/TemplateTable/TemplateTable.tsx
  • apps/dashboard/src/components/templates/TemplateTable/columns.tsx
  • apps/dashboard/src/components/templates/TemplateTable/index.ts
  • apps/dashboard/src/components/templates/TemplateTable/useTemplatesCommands.tsx
  • apps/dashboard/src/components/templates/TemplateTable/utils.ts
  • apps/dashboard/src/components/ui/sheet.tsx
  • apps/dashboard/src/constants/CreateApiKeyPermissionsGroups.ts
  • apps/dashboard/src/constants/OrganizationPermissionsGroups.ts
  • apps/dashboard/src/constants/Playground.ts
  • apps/dashboard/src/constants/webhook-events.ts
  • apps/dashboard/src/contexts/PlaygroundContext.tsx
  • apps/dashboard/src/enums/RoutePath.ts
  • apps/dashboard/src/hooks/mutations/useActivateTemplateMutation.ts
  • apps/dashboard/src/hooks/mutations/useCreateSandboxMutation.tsx
  • apps/dashboard/src/hooks/mutations/useCreateTemplateMutation.tsx
  • apps/dashboard/src/hooks/mutations/useDeactivateTemplateMutation.ts
  • apps/dashboard/src/hooks/mutations/useDeleteTemplateMutation.ts
  • apps/dashboard/src/hooks/queries/queryKeys.ts
  • apps/dashboard/src/hooks/queries/useSnapshotsQuery.ts
  • apps/dashboard/src/hooks/queries/useTemplatesPageQuery.ts
  • apps/dashboard/src/hooks/queries/useTemplatesQuery.ts
  • apps/dashboard/src/hooks/useDocsSearchCommands.tsx
  • apps/dashboard/src/hooks/useSandboxSession.ts
  • apps/dashboard/src/hooks/useSandboxes.ts
  • apps/dashboard/src/hooks/useSnapshotWsSync.ts
  • apps/dashboard/src/hooks/useTemplateWsSync.ts
  • apps/dashboard/src/lib/template-display.ts
  • apps/dashboard/src/lib/utils/sandbox.ts
  • apps/dashboard/src/pages/Regions.tsx
  • apps/dashboard/src/pages/Sandboxes.tsx
  • apps/dashboard/src/pages/Snapshots.tsx
  • apps/dashboard/src/pages/Templates.tsx
  • apps/dashboard/src/providers/PlaygroundProvider.tsx
  • apps/dashboard/tsconfig.app.json
  • apps/dashboard/vite.config.mts
  • apps/infra/.env.example
  • apps/infra/README.md
  • apps/infra/sst.config.ts
  • apps/libs/api-client/src/.openapi-generator/FILES
  • apps/libs/api-client/src/api.ts
  • apps/libs/api-client/src/api/docker-registry-api.ts
  • apps/libs/api-client/src/api/organizations-api.ts
  • apps/libs/api-client/src/api/runners-api.ts
  • apps/libs/api-client/src/api/sandbox-api.ts
  • apps/libs/api-client/src/api/templates-api.ts
  • apps/libs/api-client/src/models/api-key-list.ts
  • apps/libs/api-client/src/models/api-key-response.ts
  • apps/libs/api-client/src/models/artifact-registry-credentials.ts
  • apps/libs/api-client/src/models/box-template-default-resources-dto.ts
  • apps/libs/api-client/src/models/box-template-dto.ts
  • apps/libs/api-client/src/models/box-template-state.ts
  • apps/libs/api-client/src/models/boxlite-configuration.ts
  • apps/libs/api-client/src/models/build-info.ts
  • apps/libs/api-client/src/models/create-api-key.ts
  • apps/libs/api-client/src/models/create-box-template.ts
  • apps/libs/api-client/src/models/create-organization-quota.ts
  • apps/libs/api-client/src/models/create-organization-role.ts
  • apps/libs/api-client/src/models/create-region-response.ts
  • apps/libs/api-client/src/models/create-region.ts
  • apps/libs/api-client/src/models/create-sandbox.ts
  • apps/libs/api-client/src/models/index.ts
  • apps/libs/api-client/src/models/job-type.ts
  • apps/libs/api-client/src/models/job.ts
  • apps/libs/api-client/src/models/organization-role.ts
  • apps/libs/api-client/src/models/organization-usage-overview.ts
  • apps/libs/api-client/src/models/organization.ts
  • apps/libs/api-client/src/models/region.ts
  • apps/libs/api-client/src/models/runner-artifact-cache-dto.ts
  • apps/libs/api-client/src/models/runner-full.ts
  • apps/libs/api-client/src/models/runner-health-metrics.ts
  • apps/libs/api-client/src/models/runner.ts
  • apps/libs/api-client/src/models/sandbox-state.ts
  • apps/libs/api-client/src/models/sandbox.ts
  • apps/libs/api-client/src/models/set-box-template-general-status.ts
  • apps/libs/api-client/src/models/snapshot-dto.ts
  • apps/libs/api-client/src/models/update-organization-quota.ts
  • apps/libs/api-client/src/models/update-organization-role.ts
  • apps/libs/api-client/src/models/update-region.ts
  • apps/libs/api-client/src/models/update-sandbox-state-dto.ts
  • apps/libs/api-client/src/models/webhook-event.ts
  • apps/libs/api-client/src/models/workspace.ts
  • apps/libs/runner-api-client/src/.openapi-generator/FILES
  • apps/libs/runner-api-client/src/api.ts
  • apps/libs/runner-api-client/src/api/artifacts-api.ts
  • apps/libs/runner-api-client/src/models/artifact-digest-response.ts
  • apps/libs/runner-api-client/src/models/artifact-exists-response.ts
  • apps/libs/runner-api-client/src/models/artifact-info-response.ts
  • apps/libs/runner-api-client/src/models/build-artifact-request-dto.ts
  • apps/libs/runner-api-client/src/models/create-sandbox-dto.ts
  • apps/libs/runner-api-client/src/models/enums-sandbox-state.ts
  • apps/libs/runner-api-client/src/models/index.ts
  • apps/libs/runner-api-client/src/models/inspect-artifact-in-registry-request.ts
  • apps/libs/runner-api-client/src/models/pull-artifact-request-dto.ts
  • apps/libs/runner-api-client/src/models/runner-metrics.ts
  • apps/libs/sdk-typescript/README.md
  • apps/libs/sdk-typescript/src/BoxLite.ts
  • apps/libs/sdk-typescript/src/Sandbox.ts
  • apps/libs/sdk-typescript/src/Snapshot.ts
  • apps/libs/sdk-typescript/src/Template.ts
  • apps/libs/sdk-typescript/src/index.ts
  • apps/proxy/pkg/proxy/get_sandbox_build_target.go
  • apps/proxy/pkg/proxy/get_template_target.go
  • apps/proxy/pkg/proxy/proxy.go
  • apps/runner/README.md
  • apps/runner/cmd/runner/config/config.go
  • apps/runner/cmd/runner/main.go
  • apps/runner/internal/metrics/collector.go
  • apps/runner/pkg/api/controllers/artifact.go
  • apps/runner/pkg/api/controllers/info.go
  • apps/runner/pkg/api/docs/docs.go
  • apps/runner/pkg/api/docs/swagger.json
  • apps/runner/pkg/api/docs/swagger.yaml
  • apps/runner/pkg/api/dto/image.go
  • apps/runner/pkg/api/dto/info.go
  • apps/runner/pkg/api/dto/sandbox.go
  • apps/runner/pkg/api/dto/snapshot.go
  • apps/runner/pkg/api/server.go
  • apps/runner/pkg/backend/backend.go
  • apps/runner/pkg/backend/boxlite_adapter.go
  • apps/runner/pkg/boxlite/client.go
  • apps/runner/pkg/boxlite/registry.go

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

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

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Jun 5, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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