Skip to content

feat(quota): grant per-user quota for notes on platform-scoped subjects - #291

Merged
kevwilliams merged 1 commit into
mainfrom
feat/notes-user-quota
Sep 17, 2026
Merged

kevwilliams merged 1 commit into
mainfrom
feat/notes-user-quota

Conversation

@kevwilliams

Copy link
Copy Markdown
Contributor

Summary

Grants each user an allowance for notes on platform-scoped subjects — contacts, users and organizations. Those notes belong to no project, so milo meters them against the note's author instead of a project.

Pairs with milo-os/milo#793, and this one has to land first: bucket limits come only from active grants and start at 0, so shipping the milo side without this grant would deny contact notes outright.

Why no parentContext

The existing project policy sets parentContext because a note on a project-scoped subject is created in that project's control plane, so its claim lands there and the grant has to follow.

These notes are different — they're created in the core control plane, where Users also live, so the grant belongs there and the policy writes locally. That's also the branch that sets an owner reference on the trigger, so a user's grant is garbage-collected with the user. The project-scoped policies don't get that.

The one thing needing a decision

The 1000 default is a starting point, not a researched number. It's meant to be generous enough not to bite real usage while making the notes countable — the point of this work is that they stop being invisible, not that the limit binds. Project notes are 100, but that's per project; this is per person across every contact they touch, so the same number would be much tighter in practice.

Happy to change it to whatever product thinks is right.

Test plan

  • kustomize build config/services/notes.miloapis.com renders both grant policies
  • All top-level kustomizations still build
  • Not exercised against a cluster. The milo-side chainsaw tests supply an equivalent grant directly, so the mechanism is covered there; this PR is the production wiring of it.

Notes on contacts, users and organizations belong to no project, so milo
meters them against the note's author instead. Without a grant the bucket
limit is 0 and those notes are denied, so this must land before the milo
side ships.

No parentContext: these notes are created in the core control plane, where
Users live, so the grant belongs there too. Creating locally also sets an
owner reference on the User, so the grant is cleaned up with the user.

The 1000 default is a starting point, not a researched number — it is meant
to be generous enough not to bite real usage while making the notes
countable.
@kevwilliams
kevwilliams requested a review from a team as a code owner September 16, 2026 20:28
@kevwilliams
kevwilliams merged commit e4bd5df into main Sep 17, 2026
9 checks passed
@kevwilliams
kevwilliams deleted the feat/notes-user-quota branch September 17, 2026 16:04
kevwilliams added a commit that referenced this pull request Sep 19, 2026
Reverts #291.

## Why

#291 granted every user an allowance for
`notes.miloapis.com/user-notes`, to meter notes on contacts against
their author. The milo side that defined and claimed that resource type
(milo-os/milo#793) has been closed — notes on contacts are only ever
created by platform users, so there's nothing to meter.

That leaves this policy minting a `ResourceGrant` per user for a
resource type that no longer exists anywhere, growing with every new
user.

## Blast radius

None. Nothing claims `user-notes` now that milo-os/milo#793 is closed,
and a grant for a resource type with no claims is inert. The
project-scoped notes grant (100 per project) is untouched and still
doing real work.

Contact notes keep working — milo-os/milo#792 is what fixed those, and
it does so by not creating a claim at all, so it needs no grant.

## Test plan

- [x] `kustomize build config/services/notes.miloapis.com` renders only
the project grant policy
- [x] All top-level kustomizations still build
- [x] No remaining references to `user-notes` in config
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