Skip to content

refactor: extract apivalidation, resources, and server workspace handlers - #566

Merged
YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:refactor/apivalidation
Nov 11, 2026
Merged

YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:refactor/apivalidation

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Pure mechanical refactor with no wire, schema, or behavior changes:

  • pkg/apis/v1alpha1: Keep strictly focused on generated protobuf types, constants, and YAML serialization (matching Agent Substrate's api/ateapi/v1 layout).
  • internal/apivalidation: Extract server-side manifest admission validation (common.go, task.go, workspace.go, model.go).
  • internal/resources: Extract Kubernetes CPU/memory quantity parsing (quantity.go).
  • internal/server/workspace.go: Split Workspace gRPC handlers out of internal/server/server.go for readability ahead of WS5 changes.

@yongruilin yongruilin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with only 2 nits.
And in task.proto it still documents the config check as "within MaxTaskConfigSize", which is no longer in that package. Maybe state the 16 KiB limit there?

Comment thread internal/resources/quantity.go Resolved
Comment thread internal/apivalidation/task.go Outdated
Comment on lines +40 to +43
// MaxTaskConfigSize is the largest spec.config a task may have, measured as
// its JSON encoding. The config travels inside AX_TASK_YAML, so it must fit
// within MaxTaskYAMLSize together with the rest of the spec; this limit leaves
// room for that and gives a more specific error than ValidateTaskSize.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The doc comments were reworded during the move and lost some context, e.g. this one no longer says a config near the limit can still be rejected by ValidateTaskSize. Could you carry them over verbatim?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, keep the comments unchanged across other files as well

…lers

Keep pkg/apis/v1alpha1 focused strictly on generated protobuf types, constants, and YAML serialization (matching Agent Substrate's api/ateapi/v1 layout), and isolate Workspace RPC handlers for readability:

- Extract server-side manifest admission validation into internal/apivalidation (common, task, workspace, model).
- Extract Kubernetes CPU/memory quantity parsing into internal/resources.
- Split Workspace RPC handlers out of internal/server/server.go into internal/server/workspace.go.
- Update ax-server, TaskReconciler, and substrate.Client callers and sync AGENTS.md.
@YoyinZyc
YoyinZyc force-pushed the refactor/apivalidation branch from 4504e48 to d129c9b Compare November 11, 2026 04:28
@YoyinZyc
YoyinZyc merged commit 56bd0fc into google:main Nov 11, 2026
10 of 11 checks passed
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.

2 participants