Repository navigation
test(agents): pin the delivery.details pass-through nothing was testing - #988
Merged
Merged
Conversation
`normalizeDeliveryMeta` whitelists outcome/reason/messageId and passes `details` through as an opaque object into a Schema.Types.Mixed field. That pass-through is the only way a wrapper attaches structured context to an ack without a schema migration — #981 uses it to record which cascade settings produced a refusal, so "which cap did this seat run" becomes a query instead of a boot log nobody keeps. Nothing exercised it. There was no test for this function at all. The regression it guards is quiet by construction: tightening the whitelist to rebuild the object key by key drops `details`, the ack still succeeds, the row still persists, every suite stays green, and the instrument goes dark. Verified by simulating exactly that edit — two of these four go red against it. Includes the identity assertion, not just equality: a whitelist that rebuilds `details` field by field passes toEqual today and drops whatever a caller adds tomorrow. The non-object case carries its own positive control. An assertion that something is dropped is satisfied by a version that drops everything — which is the regression itself — so it also asserts a valid object survives the same call shape. The outcome-fallback test is a control of the other kind: this function does normalise, so the pass-through is a deliberate exception rather than an absence of validation, and a version that validated nothing would satisfy the details tests and fail that one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Follow-up I owed the pod after #981, kept separate because it is backend and #981 is CLI-only.
What is unguarded
normalizeDeliveryMeta(agentEventService.ts:576) whitelistsoutcome,reasonandmessageId, and passesdetailsthrough as an opaque object into aSchema.Types.Mixedfield.That pass-through is the only way a wrapper attaches structured context to an ack without a schema migration. #981 uses it to record which cascade settings produced a refusal, so "which cap was this seat running" becomes a group-by on rows that already persist, rather than a boot log nobody keeps and nothing joins to the events it caused.
There was no test for this function at all.
Why the regression is quiet
Tightening the whitelist to rebuild the object key by key — the natural cleanup for someone reading this function cold — drops
details. The ack still returns 200. The row still persists. Every suite stays green. The instrument just goes dark, and the next person to query it concludes the wrappers never sent anything.Verified by making exactly that edit locally: two of these four tests go red against it.
Test design notes
expect(meta.details).toBe(details)— a whitelist that rebuildsdetailsfield by field satisfiestoEqualtoday and drops whatever a caller adds tomorrow.reasonis asserted verbatim because the wrapper's stand-down gate matches it with===(cli/src/commands/agent.js:1111); unlikeoutcome, it must not be normalised.No production code changes.
🤖 Generated with Claude Code