Skip to content

feat: define feedback.miloapis.com v1alpha1 types - #16

Closed
mattdjenkinson wants to merge 1 commit into
mainfrom
feat/api-types
Closed

mattdjenkinson wants to merge 1 commit into
mainfrom
feat/api-types

Conversation

@mattdjenkinson

Copy link
Copy Markdown
Contributor

Closes #2. Stacked on #15, so merge that first and this PR will retarget to main.

Adds feedback.miloapis.com/v1alpha1 types for every resource in the design. The types are registered with the scheme but nothing serves them yet; storage comes in #3 onwards.

Kind Context Client verbs
Post read: everyone. write: feedback-sync; staff only spec.hidden full, with status
PostQuery everyone create
Vote, Subscription user (own) full
Submission user (own), staff full, plus Review and ToSecurityReport
SubmissionReview, SubmissionToSecurityReport staff request bodies for those subresources
SecurityReport user (own), Security Team full, with status
SecurityAcknowledgement everyone get, list
Release, ChangelogEntry read: everyone. write: feedback-sync full
AttachmentUpload user create

Changes from the design YAML

  • The post status field is state. In the design it was status.status, and the enum type would have collided with the PostStatus struct. PostQuery's filter and facets use state to match.
  • Attachments are a create-only AttachmentUpload resource. The design put them on submissions/attachments and securityreports/attachments, but a subresource needs its parent object to exist first, and clients upload before they create the submission. An upload has a purpose (Submission or SecurityReport), so security report files can go under their own prefix. The file arrives as base64 data, so the apiserver's request size limit applies; Submission #8 sets the actual limits.
  • Vote.status.createdAt is dropped. It duplicated metadata.creationTimestamp.
  • ChangelogEntry.status.issueRefs is new. It lists every issue referenced in the body. Delivery tracking needs it to mark a post part-shipped when a changelog links one of its work items rather than the post.
  • SubmissionTriage.likelySecurityIssue is new. The design says triage flags likely security issues but had no field for it.

Not included: FeedbackProfile for the public-votes opt-in. The design only needs it if Milo's UserPreference can't carry the setting, which is still to check.

Also in this PR

  • Regenerated deepcopy, clientset and OpenAPI. Enum types are marked +enum, so the schema lists their allowed values.
  • FieldSelectors declares the field selectors each kind supports. The registries will expose the same fields.
  • config/samples has an example for every kind.
  • The README status section now says the types exist.

Testing

go test ./... passes. The new tests check:

  • Server-side apply: every kind has an x-kubernetes-group-version-kind extension, and every $ref resolves to a published definition.
  • Enums: they appear in the schema for post state, submission phase and query sort.
  • Samples: every sample decodes in strict mode, and every kind has a sample. I checked that an unknown field fails the test.
  • Field selectors: each kind accepts its declared selectors and rejects unknown ones.

Types for every resource in the design: Post, PostQuery, Vote,
Subscription, Submission (with review and to-security-report
subresources), SecurityReport, SecurityAcknowledgement, Release,
ChangelogEntry and AttachmentUpload.

- Regenerated deepcopy, clientset and OpenAPI. Enums are marked so
  clients get allowed values
- Field selectors declared per kind in FieldSelectors
- A sample for every kind, decoded strictly in tests
- Tests that every kind has a GVK extension and every ref resolves,
  so server-side apply works once storage lands

Departs from the design YAML in two places:
- The post status field is state, not status.status
- Attachments are a create-only AttachmentUpload resource, since a
  subresource needs its parent to exist first

Closes #2.
@mattdjenkinson

Copy link
Copy Markdown
Contributor Author

Closing: the design moved from an aggregated apiserver with Postgres to CRDs in Milo with an operator (datum-cloud/enhancements#925). The CRD version starts in #32.

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.

Define the v1alpha1 API types

1 participant