Skip to content

Clean up v1alpha1 field names and drop unused fields - #485

Merged
rakyll merged 1 commit into
mainfrom
spec-proto-cleanup
Oct 16, 2026
Merged

rakyll merged 1 commit into
mainfrom
spec-proto-cleanup

Conversation

@rakyll

@rakyll rakyll commented Oct 15, 2026

Copy link
Copy Markdown
Member
  • ModelSpec: drop the reserved ranges left over from the typed generation settings and renumber secret_key (6 -> 3) and parameters (7 -> 4).
  • TaskStatus: remove pending_approval and usage, along with the PendingApproval and UsageStats messages. Nothing set or read them.
  • Rename ResourceReqs to ResourcesSpec.
  • Rename Condition.last_transition_time to update_time and ObjectMeta.creation_timestamp to create_time, following the AIP timestamp naming. update_time also matches what the controller does: setCondition refreshes it on every update, not only when the status changes.
  • Add a TODO to reconsider WorkspaceRef.goal.

This is a breaking change. The ModelSpec renumbering changes the wire format, so the ax CLI and ax-server must be upgraded together. The JSON/YAML keys lastTransitionTime and creationTimestamp become updateTime and createTime; records already stored in Redis load without those timestamps, and the server re-stamps the creation time on the next update.

- ModelSpec: drop the reserved ranges left over from the typed
  generation settings and renumber secret_key (6 -> 3) and
  parameters (7 -> 4).
- TaskStatus: remove pending_approval and usage, along with the
  PendingApproval and UsageStats messages. Nothing set or read them.
- Rename ResourceReqs to ResourcesSpec.
- Rename Condition.last_transition_time to update_time and
  ObjectMeta.creation_timestamp to create_time, following the AIP
  timestamp naming. update_time also matches what the controller
  does: setCondition refreshes it on every update, not only when
  the status changes.
- Add a TODO to reconsider WorkspaceRef.goal.

This is a breaking change. The ModelSpec renumbering changes the
wire format, so the ax CLI and ax-server must be upgraded together.
The JSON/YAML keys lastTransitionTime and creationTimestamp become
updateTime and createTime; records already stored in Redis load
without those timestamps, and the server re-stamps the creation
time on the next update.
@rakyll
rakyll requested a review from mayawang October 15, 2026 20:23

@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 refactors the API schema by renaming several timestamp fields (such as creation_timestamp to create_time and last_transition_time to update_time), renaming ResourceReqs to ResourcesSpec, and removing unused fields from TaskStatus. A critical feedback points out that renumbering the protobuf tags for secret_key and parameters in ModelSpec breaks binary compatibility with existing serialized data, which could lead to decoding failures and data loss. It is highly recommended to retain the original tags and keep the deleted tags reserved.

Comment thread pkg/apis/v1alpha1/ax.proto Resolved

@mayawang mayawang 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 overall, the AIP naming and dropping the dead fields is a good cleanup. Two things to coordinate: dropping status.usage overlaps with #471 (budgets), which proposes filling it, so worth a note there that usage comes back through that design. And the ResourceReqs rename will need another rebase of #405 from an external contributor; maybe land #405 first, or let them know.

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

Approving. The notes on #471 and #405 are coordination, not blockers.

@rakyll
rakyll merged commit f0f16ff into main Oct 16, 2026
9 checks passed
@rakyll
rakyll deleted the spec-proto-cleanup branch October 16, 2026 17:39
mvanhorn added a commit to mvanhorn/ax that referenced this pull request Oct 17, 2026
google#485 renamed ResourceReqs to ResourcesSpec, so this branch no longer
built against main (pkg/apis/v1alpha1/resources.go:40). Use the new name
in ValidateResources, substrate.ResourceLimits, and their tests.
mayawang pushed a commit that referenced this pull request Oct 19, 2026
* feat(controller): apply Task resource limits to the ActorTemplate

TaskSpec.resources is documented and accepted by ax-server, but the
controller never read it, so spec.resources.limits had no effect on the
sandbox. Translate limits.cpu and limits.memory into the Substrate
ActorTemplate resources block (Substrate's {name, quantity} list) when
provisioning the per-task template.

Substrate sizes sandboxes by limits only, so requests are documented as
not applied. A limits change already yields a new template because the
launch spec is part of the template digest via AX_TASK_YAML; a test now
pins that behaviour.

Fixes #369

Co-authored-by: Matt Van Horn <[email protected]>

* controller: validate resource limits and never fall back without them

Address review on #405:

- Validate spec.resources before provisioning, at apply time via
  ValidateTask and again in the reconciler. Quantities follow the
  Kubernetes quantity grammar, must be greater than zero, and the cpu
  limit must be below 1000 cores, matching what Substrate enforces on the
  ActorTemplate. Invalid values fail the reconcile with Ready=False,
  reason InvalidResources.
- When a task has limits and Substrate rejects the per-task template,
  fail the reconcile (reason TemplateCreationFailed) instead of falling
  back to the default template, which would run the task without the
  limits it asked for. Tasks without limits keep the existing fallback.
- Reject spec.resources.requests with a clear message: Substrate sizes
  sandboxes by limits alone, so accepting and ignoring it was misleading.
  The docs and examples/task.yaml drop the requests block.
- Tests: failure paths for invalid limits and for a rejected template
  with and without limits, plus an explicit assertion that a limits
  change yields a differently named template.

Co-authored-by: Matt Van Horn <[email protected]>

* test: name the ValidateTask fixtures in TestValidateResources

Keeps the test valid alongside metadata.name validation (#406).

Co-authored-by: Matt Van Horn <[email protected]>

* v1alpha1: follow the ResourceReqs to ResourcesSpec rename

#485 renamed ResourceReqs to ResourcesSpec, so this branch no longer
built against main (pkg/apis/v1alpha1/resources.go:40). Use the new name
in ValidateResources, substrate.ResourceLimits, and their tests.

---------

Co-authored-by: Matt Van Horn <[email protected]>
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