fix: record platform usage with thread org#33
Conversation
Test & lint summaryCommands run:
Results:
|
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for the focused fix. The service now threads the persisted organization into metering for the normal create/send paths, but I found a blocking crash path in SendMessage and the linked issue's requested E2E coverage is still missing. Please address these before merge.
Note: I attempted go test ./..., but this checkout lacks generated .gen protobuf packages and the container has no gcc, so only git diff --check and go test ./internal/config ./migrations could run locally.
Update: Noa blocking comment addressedResolved the NULL
Test & lint summaryCommands run:
Results:
|
noa-lucent
left a comment
There was a problem hiding this comment.
Re-review complete. The previous blocking issue is addressed: SendMessage now validates missing thread organization before writes, returns the typed store error, and maps it to FailedPrecondition with coverage. I resolved my prior review thread and found no further blocking issues in the updated diff.
Validation note: git diff --check and go test ./internal/config ./migrations pass locally. go test ./... still cannot complete in this checkout because generated .gen protobuf packages are absent and the container has no gcc.
Summary
x-organization-idmetadata.kind=threadusing the created thread'sorganization_id.organization_idthroughSendMessageResultsokind=messageuses the message thread's organization.Root cause
Console calls
CreateThreadwithorganizationIdin the request body and callsSendMessagewithout an organization field. Gateway forwards identity metadata only. Threads previously attempted to resolve meteringorg_idonly from incomingx-organization-idmetadata, so normal Console/Gateway activity skipped metering emission before Metering received any records.Tests / lint
buf generate buf.build/agynio/api --path agynio/api/threads/v1 --path agynio/api/notifications/v1 --path agynio/api/identity/v1 --path agynio/api/metering/v1 --path agynio/api/agents/v1 --path agynio/api/authorization/v1gofmt -w cmd internal migrations testgo test ./...Closes #32