Skip to content

feat(sandbox): add scoped resource catalog#26

Merged
miclle merged 9 commits into
qiniu:mainfrom
miclle:feat/admin-sandbox-lists
Jul 13, 2026
Merged

feat(sandbox): add scoped resource catalog#26
miclle merged 9 commits into
qiniu:mainfrom
miclle:feat/admin-sandbox-lists

Conversation

@miclle

@miclle miclle commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add account- and organization-scoped Sandbox Templates and Sandbox Instances pages
  • query Sandbox resources with the selected account or GitHub installation credentials
  • support region and template filtering while limiting instances to runner-created sandboxes
  • keep catalog routes out of the global admin console

Why

Sandbox service credentials belong to users and organizations rather than the global runnerd admin scope. Resource browsing now follows that ownership model and prevents an administrator's personal credentials from being presented as global control-plane data.

Validation

  • task test
  • task ui-lint
  • production UI build
  • browser verification for account and organization routes, responsive filters, and route compatibility

Expose Sandbox templates and runner instances under account and organization settings so provider credentials stay within their owning scope. Add region and template filters with stale-request protection and responsive catalog tables.

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

Code Review

This pull request implements account- and organization-scoped pages for region-filtered sandbox templates and runner instances, adding backend catalog APIs and React frontend sections. The review feedback highlights a potential data race from mutating shared configuration, potential runtime panics due to missing nil checks on SDK-returned slices, and opportunities to improve UI robustness and readability by validating date strings and formatting long single-line components.

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.

Comment thread internal/server/server_sandbox_catalog.go
Comment thread internal/sandboxrunner/runner.go
Comment thread internal/sandboxrunner/runner.go
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated
@miclle miclle marked this pull request as ready for review July 13, 2026 05:20

@fennoai fennoai 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.

No additional high-confidence issues found in this review beyond the unresolved review threads already present on the PR.

Verification performed:

  • git diff --check origin/main...HEAD
  • go test -tags development ./internal/server -count=1
  • go test ./internal/sandboxrunner -count=1

Not run: UI lint/build, because bun is not installed in this environment. A plain go test ./internal/server -count=1 also cannot run without generated production UI assets, so I used the development tag for the server package.

@miclle

This comment has been minimized.

@miclle

This comment has been minimized.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

No issues found in this review. I focused on the new user-scoped sandbox catalog API, account/organization route wiring, credential scope resolution, and the catalog UI data flow.

Verified:

  • go test -tags development ./internal/server -count=1
  • go test -tags development ./internal/sandboxrunner -count=1
  • git diff --check origin/main...HEAD

Not run:

  • UI lint/build and Bun component test, because bun is not installed in this environment.
  • go test ./internal/server -count=1 without tags, because production embedded UI assets are not present in internal/server/ui/; the development-tag run avoids that generated-asset requirement.

Submitted a non-blocking PR review: #26 (review)

View job run

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

Code Review

This pull request introduces account- and organization-scoped Sandbox catalogs, allowing ordinary users to view region-filtered templates and region/template-filtered runner instances. It adds new backend endpoints (/user/sandbox/templates and /user/sandbox/instances), integrates with the Qiniu Go SDK, and updates the React frontend with new tabs under account settings. The review feedback suggests three key improvements: optimizing the React component state to prevent duplicate parallel API requests and unnecessary re-fetching, defensively copying the configuration snapshot in the backend to avoid potential race conditions from shared state mutation, and refactoring in-place slice filtering for better readability.

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.

Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated
Comment thread internal/server/server_sandbox_catalog.go
Comment thread internal/server/server_sandbox_catalog.go Outdated

@fennoai fennoai 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.

No issues found in this review.

Split template and instance loading so template filters only refresh instance data, and reset scoped state by installation.
@miclle

This comment has been minimized.

@miclle

This comment has been minimized.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

No issues found in this review.

Verification run:

  • go test -tags development ./internal/server ./internal/sandboxrunner -count=1
  • git diff --check origin/main...HEAD

Not run: task ui-lint because task and bun are not installed in this sandbox.

View job run

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

Code Review

This pull request introduces ordinary-user Sandbox resource catalogs, allowing authenticated users to inspect Sandbox templates and runner-created instances scoped to their account or organization. It adds backend endpoints (/user/sandbox/templates and /user/sandbox/instances) with region validation, updates documentation, and implements corresponding React components (SandboxTemplatesSection and SandboxesSection) in the user dashboard. The review feedback highlights two key improvement opportunities: first, avoiding in-place slice mutation (items[:0]) when filtering sandbox instances to prevent potential cache corruption or concurrency issues; second, decoupling template loading errors from the sandbox instances table so that a failure in loading the template filter dropdown does not completely block the display of active instances.

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.

Comment thread internal/server/server_sandbox_catalog.go Outdated
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated

@fennoai fennoai 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.

No issues found in this review.

Verification run:

  • go test -tags development ./internal/server ./internal/sandboxrunner -count=1
  • git diff --check origin/main...HEAD

I could not run task ui-lint in this sandbox because task and bun are not installed here.

Keep sandbox instances visible when the template filter fails, and avoid mutating catalog slices while applying template filters.
@miclle

This comment has been minimized.

@miclle

This comment has been minimized.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

Submitted a non-blocking PR review: no issues found.

Verified locally:

  • go test -tags development ./internal/server ./internal/sandboxrunner
  • git diff --check origin/main...HEAD

Not run locally:

  • cd ui && bun test src/components/sandbox-catalog-sections.test.js because bun is not installed in this environment.
  • npm --prefix ui run lint because the local eslint executable returned Permission denied.

View job run

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

Code Review

This pull request introduces ordinary-user Sandbox catalogs to inspect scoped resources, allowing authenticated users to view region-filtered Sandbox templates and runner-created instances at /account/sandbox-templates and /account/sandbox-instances (and their organization equivalents). The backend implements endpoints /user/sandbox/templates and /user/sandbox/instances to fetch this data securely using server-side credentials, while the frontend is updated with React components to display and filter these resources. The review feedback highlights opportunities to improve backend error reporting when initializing the sandbox service, and suggests clearing stale templates and instances in the UI when the region or template filters change to prevent displaying outdated information during loading.

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.

Comment thread internal/server/server_sandbox_catalog.go
Comment thread ui/src/components/sandbox-catalog-sections.tsx
Comment thread ui/src/components/sandbox-catalog-sections.tsx
Comment thread ui/src/components/sandbox-catalog-sections.tsx

@fennoai fennoai 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.

No issues found in this review.

Verified locally:

  • go test -tags development ./internal/server ./internal/sandboxrunner
  • git diff --check origin/main...HEAD

Not run locally:

  • cd ui && bun test src/components/sandbox-catalog-sections.test.js because bun is not installed in this environment.
  • npm --prefix ui run lint because the local eslint executable returned Permission denied.

Clear region- and template-scoped results before reloading, and log catalog initialization failures without exposing configuration details.
@miclle

This comment has been minimized.

@miclle

This comment has been minimized.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

Posted a non-blocking PR review with 1 finding.

Finding: ui/src/components/sandbox-catalog-sections.tsx introduces React Hooks lint failures in the new catalog loader effects. The first occurrence is inline-commented at line 102; the same pattern appears at lines 224 and 231.

Verification run:

  • go test -tags development ./internal/server passed
  • go test ./internal/server ./internal/sandboxrunner passed after production UI assets were generated
  • npm run build passed
  • npm run lint failed with react-hooks/set-state-in-effect errors, including the new catalog component

Notes: task and bun are not installed in this environment, so I used direct Go/npm equivalents where possible.

View job run

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

Code Review

This pull request introduces ordinary-user Sandbox resource catalogs, allowing authenticated users to inspect Sandbox templates and runner-created instances scoped by region and account/organization. It adds backend APIs (GET /user/sandbox/templates and GET /user/sandbox/instances), corresponding frontend UI components, and updates the documentation. Two main issues were identified in the review: a potential data race in server_sandbox_catalog.go due to direct mutation of a shared configuration snapshot, and a CSS truncation issue in sandbox-catalog-sections.tsx where truncate is applied directly to a table cell instead of a block element.

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.

Comment thread internal/server/server_sandbox_catalog.go
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated

@fennoai fennoai 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.

Review findings:

  • The new sandbox catalog components currently make the UI lint target fail under the repository's configured React Hooks rules. I left an inline comment on the first occurrence; the same pattern appears in SandboxesSection at lines 224 and 231.

Comment thread ui/src/components/sandbox-catalog-sections.tsx
Wrap template identifiers in a constrained block so table-cell layout consistently applies text truncation.
@miclle

This comment has been minimized.

@miclle

This comment has been minimized.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

No issues found in this review. I submitted a non-blocking PR review: #26 (review)

Verified locally:

  • go test -tags development ./internal/server ./internal/sandboxrunner -count=1
  • git diff --check origin/main...HEAD

Not run locally:

  • task ui-lint / task build, because task, bun, and local ui/node_modules are unavailable in this sandbox; direct npm script attempts also failed on missing/non-executable JS tooling.

View job run

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

Code Review

This pull request introduces ordinary-user Sandbox catalog features, adding endpoints to list Sandbox templates and runner-created instances, along with corresponding UI tabs, region selectors, and filtering. The review feedback highlights a potential data race when modifying a potentially shared configuration struct directly, duplicate region definitions in the frontend that should be consolidated, and readability issues due to excessively long lines in internal/sandboxrunner/runner.go.

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.

Comment thread internal/server/server_sandbox_catalog.go
Comment thread ui/src/components/sandbox-catalog-sections.tsx Outdated
Comment thread internal/sandboxrunner/runner.go Outdated
Comment thread internal/sandboxrunner/runner.go Outdated
Keep sandbox region labels and endpoints in one overseas-first definition, and format catalog mappings for maintainability.
@miclle

miclle commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@miclle

miclle commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

@fennoai review

@fennoai fennoai 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.

No issues found in this review. I focused on the scoped sandbox catalog API, account/organization credential scope resolution, route wiring, and the new catalog UI data flow.

Verification run:

  • go test -tags development ./internal/server ./internal/sandboxrunner -count=1
  • git diff --check origin/main...HEAD

Not run locally:

  • task ui-lint / task build, because task, bun, and local ui/node_modules are unavailable in this sandbox; direct npm script attempts also failed on missing/non-executable JS tooling.

@fennoai

fennoai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Complete

No issues found in this review.

Verified:

  • git diff --check
  • go test -tags development ./... -count=1

Not completed: UI npm scripts did not run in this environment because tsc/eslint were unavailable or not executable before the scripts could start.

Submitted a non-blocking PR review: #26 (review)

View job run

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

Code Review

This pull request introduces ordinary-user Sandbox resource catalogs, allowing authenticated users to inspect Sandbox templates and runner-created instances scoped to their account or organization. On the backend, it adds a Catalog interface to internal/sandboxrunner, implements template and instance listing on E2BService, and registers new endpoints /user/sandbox/templates and /user/sandbox/instances in the server. On the frontend, it updates the React UI with new 'Sandbox Templates' and 'Sandbox Instances' tabs under account settings, including region selectors, filtering, and robust loading states. Extensive documentation, rules, and tests have also been added to support these changes. There are no review comments, so no additional feedback is provided.

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.

@fennoai fennoai 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.

No issues found in this review.

Verified with git diff --check and go test -tags development ./... -count=1. I could not run the UI npm scripts in this environment because the package executables were unavailable/not executable (tsc/eslint failed before running).

@miclle miclle merged commit bdb4bed into qiniu:main Jul 13, 2026
10 checks passed
@miclle miclle deleted the feat/admin-sandbox-lists branch July 13, 2026 07:15
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