Skip to content

Implement ActorTemplate CRUD in the control API - #895

Open
Zoe Zhao (zoez7) wants to merge 8 commits into
agent-substrate:mainfrom
zoez7:atv-br-1.8
Open

Implement ActorTemplate CRUD in the control API#895
Zoe Zhao (zoez7) wants to merge 8 commits into
agent-substrate:mainfrom
zoez7:atv-br-1.8

Conversation

@zoez7

@zoez7 Zoe Zhao (zoez7) commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Part of #477.

Changes

  • Implement ActorTemplate CRUD in the control API
  • Added a shared generic ResourceRef behind the template and actor ref types

Relevant:

ActorRef was the original of the struct the template refs copied. Alias
it to ResourceRef[actorKind] like the others; the actor-specific
DNSName method becomes the ActorDNSName function since methods cannot
be declared on an alias of a generic instantiation.
Return the status errors from validateDefaultActorTemplateVersion
unwrapped so clients see the original Aborted/FailedPrecondition
messages, drop the unreachable nameless-version check (request
validation already rejects a default_version_on_create without a
name), and refresh the actorTemplateLockKey comment now that the
per-version lock fences DeleteActorTemplateVersion.
Pure code motion following the actor_snapshot.go convention (agent-substrate#891):
the five per-RPC handler files become actor_template.go, their
validation tests become actor_template_test.go, and the functional
tests (TestActorTemplateCRUD out of functional_test.go, plus
TestUpdateActorTemplate) become actor_template_functional_test.go.

Part of agent-substrate#891; the remaining resources are follow-ups.
Comment thread internal/resources/resourceref.go
Comment on lines +49 to +51
return slog.GroupValue(
slog.String("atespace", r.Atespace),
slog.String("name", r.Name),

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.

Should we include the type?

Comment thread internal/resources/resourceref.go
return stored, nil
}

func validateCreateActorTemplateRequest(req *ateapipb.CreateActorTemplateRequest) field.ErrorList {

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.

We have some pretty sprawling validation functions at this point, have we thought about using protoc-gen-validate or something similar for uniformity?

@zoez7

Copy link
Copy Markdown
Collaborator Author

Update: we are rethinking the ActorTemplate and ActorTemplateVersion relationship in #905

in := req.GetActorTemplate()
templateRef := resources.ActorTemplateRefFromActorTemplate(in)

// Lock the ActorTemplate.

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.

do we still need this lock, given that UpdateActorTemplate in the storage layer has a watch now:

err := s.rdb.Watch(ctx, func(tx *redis.Tx) error {

(I haven't checked atepg.go yet, though)

cc Julian Gutierrez Oschmann (@juli4n)

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.

3 participants