Repository navigation
feat(audit): register the six reserved types the document module emits - #1100
Merged
Merged
Conversation
A document module reports six audit types in the host's reserved `saas` namespace, which a module cannot declare through DeclareAuditEventTypes. The host refused them, so they stayed undelivered in the module's outbox: saas.datasource.protection_changed, saas.document.source_verified, saas.document.read_unscoped, saas.document.search_unscoped, saas.document.confirmed and saas.document.extractor_revised. Registered in the canonical registry with the payload the module sends; the events contribution, event catalog, asyncapi and communication docs are regenerated by the declared composition generator. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
saas.datasource.protection_changed and saas.document.source_verified have no emitter on the document module's main (their last one was removed with the unpublished source-provenance work). Declared types only grow, so they are registered with the PR that brings their emitter back, aligned with the other saas.document.* types. The proposal_source PII comment now states the real reason: an unvalidated 512-byte string, though it names a run, receipt or derivation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
A document module emits six audit types in the host's reserved
saasnamespace. The SDK'sDeclareAuditEventTypesrefuses that namespace, and the host registry did not carry them, so the host refused every emission and the rows stayed undelivered in the module's outbox. Registering them in the canonical registry is the route the owner chose over renaming into a module namespace (a rename would change the emission identity the retry deduplication relies on).Classification: fix, at the place that owns the behaviour (the host's audit registry). Nothing is worked around.
The six types (payloads copied from the emitting module's vendored registry and its emitters)
saas.datasource.protection_changedsaas.document.source_verifiedsaas.document.read_unscopedsaas.document.search_unscopedsaas.document.confirmedsaas.document.extractor_revisedproposal_source(free text a person or tool supplies)The other fields are identifiers, digests, enums, counts or a reference position in a format's own notation (
address), not free text. Visibility and retention follow the existingsaas.document.*entries (external, 30d).source_verifiedandprotection_changedhave no emitter in the module yet; they are registered as the module's vendored registry already defines them.What changed
audit_registry.go: six constants, six definitions, and the shareddocumentUnscopedReadFields.audit_parity_test.go: the six are classified as emitted outside RPC (throughEmitAuditEvent).audit_registry_test.go:TestValidatePayload_DocumentModuleReservedTypescovers required fields, bounds, enums, undeclared fields (novalue, noboundaryon the unscoped types), entry and idempotency requirements, and the PII mark.saas.events.codefly.yaml(go test ./pkg/business -run AuditEventsContribution -update), thenevent-catalog.json,asyncapi.json,communication.mdandeventcatalog/catalog_gen.govia thecompositiongenerator declared inmodule.package.codefly.yaml.What I reused
The existing
mutation/observation/required/requiresEntry/requiresIdempotencyKey/piiconstructors,documentFields, and thesaas.document.dead_letter_redrivenprecedent (same walk: registry, contribution, parity list, composition). No new mechanism. Not reused on purpose: the module's pending copy and its datasource folder-write types, which are not part of this ask.Verification run
go build ./...,go vet(business, eventcatalog),go test -race ./pkg/business ./pkg/eventcatalog ./pkg/cataloggen ./pkg/adaptersin the accounts service: pass.go test ./...for the whole accounts module: pass.go test ./composition(tools): pass.scripts/check-boundaries.shandnode module/tools/naming-gate.mjs check: clean.Not verified:
golangci-lint run ./pkg/business/...reports 7 findings, all in files this PR does not touch (pre-existing); the fullcodefly ci run, the frontend and SDK suites, and a live delivery from a deployed module against this host.🤖 Generated with Claude Code
Revision after review (08e6d87). This PR now registers four types, not six:
saas.document.confirmed,saas.document.extractor_revised,saas.document.read_unscopedandsaas.document.search_unscoped, the four the document module emits today, each checked against its emitter's payload.saas.datasource.protection_changedandsaas.document.source_verifiedhave no emitter on the module's main. Declared types only grow, so they wait for the PR that brings their emitter back. Theproposal_sourcePII comment now gives the real reason: it is an unvalidated 512-byte string, though it names a run, receipt or derivation. The test fixtures useproposal_kind: person, a value the module actually sends. Generated outputs were rerun through the composition generator andAuditEventsContribution -update. Local runs:go test -raceon business, eventcatalog and cataloggen, the tools./compositiontests andcheck-boundaries.shall pass.