Summary
Define a complete event taxonomy and publication contract for gitstore-git-service to emit so that the API control plane (admission controller, policy engine, and controller manager) can reconcile catalog state and enforce policies consistently.
This initiative clarifies which Git operations trigger which control-plane workflows and how draft vs. published state transitions are governed.
Scope
In Scope
- Define canonical Git event types across standard operations (push, branch lifecycle, tag lifecycle, rejection).
- Define catalog-specific events: resource parsed, validation failed, namespace target detected, admission policy evaluation.
- Define event payload contract (ref details, commit SHA, actor identity, policy metadata).
- Define which events are fire-and-forget vs. require acknowledgement/blocking.
- Define how
pre-receive events feed into admission validation vs. post-receive events trigger reconciliation.
- Define the draft-vs-published lifecycle: when tags or special branches gate state transitions.
- Document when admission checks run for Git-originated mutations vs. API-originated mutations (should be identical paths).
- Add integration tests covering event emission, event ordering, and duplicate suppression.
Out of Scope
- Webhook delivery to external systems (that's event subscription).
- Real-time metrics/dashboards on event rate.
- Event retention/archival beyond what Git history provides.
- Mutating webhook controllers (that's admission controller scope).
Acceptance Criteria
Implementation Notes
Event Classification
Standard Git Ref Events (always fire post-receive):
branch-created: ref moved from 0000000 to commit_sha, refs/heads/*
branch-updated: ref moved commit_a → commit_b (fast-forward)
branch-force-pushed: ref moved commit_a → commit_b (non-fast-forward, history rewrite)
branch-deleted: ref moved commit_sha → 0000000, refs/heads/*
tag-created: ref moved 0000000 to object_sha, refs/tags/*
tag-updated: ref moved old_object → new_object, refs/tags/*
tag-deleted: ref moved object_sha → 0000000, refs/tags/*
push-rejected: push failed pre-receive hook (includes failure reason)
Catalog-Specific Events (post-receive, async):
catalog-resource-parsed: A .md file was parsed into a resource object (Product/Category/Collection/etc).
catalog-resource-validation-failed: A parsed resource failed schema or admission policy validation.
catalog-namespace-target: Detected which namespace owns the repository or affected resource.
State Transition Events:
release-created: A tag matching the release pattern (e.g., release/* or v*) was created AND admission checks passed.
draft-published: A release tag or special marker moved a draft resource into published state (visibility to storefront).
Draft vs. Published Lifecycle
Draft state:
- Commits on
main or draft branch create/update resources that are draft (.status.phase == draft).
- Draft resources are visible to admins but not storefront.
- Draft resources reconcile independently (e.g., inventory controller tracks draft inventory separately).
Publishing:
- Admins (or CI/CD policy) create a release tag (
release/v1.0.0) pointing to a commit.
- Tag creation triggers post-receive hook, which:
- Emits
tag-created event.
- Runs the target commit's resources through admission (same validation as Git push).
- If admission passes, emits
release-created event.
- Controller manager observes
release-created → transitions .status.phase to published.
- KV layer updates so storefront sees published state.
Admission Control Integration
Git-originated mutations (push) and API-originated mutations (GraphQL) must follow the same admission path:
- Pre-receive hook: syntax/auth checks only (fast-fail rejections).
- Post-receive hook (async): parse resources → run admission policies → write
.status via API.
- Admission response: structured errors, policy metadata, resource version for optimistic concurrency.
If admission rejects on post-receive, the commit is persisted but marked in .status.admissionFailure. The operator sees the commit in Git history (audit) but the resource is not visible to controllers/storefront.
Dependencies
Tracking
- Area:
infra
- Priority:
p2 - high
- Target Milestone / Release: TBD
Summary
Define a complete event taxonomy and publication contract for
gitstore-git-serviceto emit so that the API control plane (admission controller, policy engine, and controller manager) can reconcile catalog state and enforce policies consistently.This initiative clarifies which Git operations trigger which control-plane workflows and how draft vs. published state transitions are governed.
Scope
In Scope
pre-receiveevents feed into admission validation vs.post-receiveevents trigger reconciliation.Out of Scope
Acceptance Criteria
Implementation Notes
Event Classification
Standard Git Ref Events (always fire post-receive):
branch-created: ref moved from 0000000 to commit_sha, refs/heads/*branch-updated: ref moved commit_a → commit_b (fast-forward)branch-force-pushed: ref moved commit_a → commit_b (non-fast-forward, history rewrite)branch-deleted: ref moved commit_sha → 0000000, refs/heads/*tag-created: ref moved 0000000 to object_sha, refs/tags/*tag-updated: ref moved old_object → new_object, refs/tags/*tag-deleted: ref moved object_sha → 0000000, refs/tags/*push-rejected: push failed pre-receive hook (includes failure reason)Catalog-Specific Events (post-receive, async):
catalog-resource-parsed: A.mdfile was parsed into a resource object (Product/Category/Collection/etc).catalog-resource-validation-failed: A parsed resource failed schema or admission policy validation.catalog-namespace-target: Detected which namespace owns the repository or affected resource.State Transition Events:
release-created: A tag matching the release pattern (e.g.,release/*orv*) was created AND admission checks passed.draft-published: A release tag or special marker moved a draft resource into published state (visibility to storefront).Draft vs. Published Lifecycle
Draft state:
mainordraftbranch create/update resources that are draft (.status.phase == draft).Publishing:
release/v1.0.0) pointing to a commit.tag-createdevent.release-createdevent.release-created→ transitions.status.phasetopublished.Admission Control Integration
Git-originated mutations (push) and API-originated mutations (GraphQL) must follow the same admission path:
.statusvia API.If admission rejects on post-receive, the commit is persisted but marked in
.status.admissionFailure. The operator sees the commit in Git history (audit) but the resource is not visible to controllers/storefront.Dependencies
Tracking
infrap2 - high