Skip to content

Create ResourceLabels and use for ManagedResource, NetworkConfiguration.#1360

Merged
jglogan merged 2 commits intoapple:mainfrom
jglogan:label-refactor
Apr 7, 2026
Merged

Create ResourceLabels and use for ManagedResource, NetworkConfiguration.#1360
jglogan merged 2 commits intoapple:mainfrom
jglogan:label-refactor

Conversation

@jglogan
Copy link
Copy Markdown
Contributor

@jglogan jglogan commented Mar 27, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

See related issue.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@github-actions github-actions bot added the cli label Mar 27, 2026

import Collections

public protocol AppError: Error {
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.

Is this going to be the used for the highest level and for generic type of errors (that all resources will follow)? I kind of worked on creating more lower level, managed resource specific handling approach (that each resource will follow but will vary per resource).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know the answer to that for sure yet. I feel like we'll want to try as much as we can in the coming month and evolve to something sensible by the next release.

What I was going for with this error is:

  • Supports a caused-by chain.
  • Supports structured log output
  • Delegates presentation to an error receiver that is responsible for making sense of chained errors, compound errors, and error metadata and mapping it to one or more log messages.
  • For easier compatibility, doesn't rely on enum for error typing.

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.

Sounds good to me. I am going to take a step back for now and let you lead this. Excited to see what it becomes! Happy to jump back in when it’s ready to be used for managed resources.

@katiewasnothere katiewasnothere self-requested a review March 30, 2026 17:08
- Create a ResourceLabels type and extract the label
  validation from NetworkConfiguration into the new
  type.
- Create a base AppError type that is compatible
  with structured logging and delegates message presentation
  to the error receiver.
- Define LabelError over AppError for label validation.
- Slightly reworks NetworkConfiguration entity migration
  code in NetworksService.
Copy link
Copy Markdown
Contributor

@ajemory ajemory left a comment

Choose a reason for hiding this comment

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

Two stray comments, otherwise looks good

@@ -53,6 +53,6 @@ extension ManagedResource {
}

// FIXME: This moves to ManagedResource and/or a ResourceLabels typealias eventually.
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.

Suggested change
// FIXME: This moves to ManagedResource and/or a ResourceLabels typealias eventually.

@@ -33,7 +33,7 @@ public protocol ManagedResource: Identifiable, Sendable, Codable {
/// Key-value properties for the resource. The user and system may both
/// make use of labels to read and write annotations or other metadata.
/// A good practice is to use
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.

Comment cut off?

@jglogan jglogan merged commit e37dcc1 into apple:main Apr 7, 2026
3 checks passed
@jglogan jglogan deleted the label-refactor branch April 7, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: TECH DEBT - Custom type for resource labels.

4 participants