test(http): cover the /v1/turn rejection contract #240
No reviewers
Labels
No labels
move-to-repo
coilyco-bridge-deploy
move-to-repo
coilyco-flight-deck-agent-compose
move-to-repo
coilyco-gaming-eco-app
move-to-repo
coilysiren-inbox
move-to-repo
unknown
🔒⚠️📦⚠️🔒 SANDBOXED 🔒⚠️📦⚠️🔒
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
c#
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-gaming/sirens-echo!240
Loading…
Reference in a new issue
No description provided.
Delete branch "test/http-turn-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #193
handleHTTPTurnhad no direct coverage. Its rejection contract was established only by probing the deployed pod, so every guarantee cost a tailnet round trip against production and none of them were protected against regression.What this adds
internal/community/http_test.go— 12 tests over the turn surface, allhttptest, no model, no Agent Proxy, no MCP. Full package suite runs in ~1s.Every row of the table in the issue is asserted, plus three properties the issue called out as worth asserting:
historylimit is asserted on both sides — 12 accepted, 13 refusedprompterror is asserted to name the caller's own input and to leak nohttp://,https://,127.0.0.1,localhost, or.svcCharacterization, not endorsement
Four behaviors are pinned as they are today rather than asserted as correct. Each failure message says what a change means, so the issue that fixes it has a test to flip rather than a test to delete:
TestHTTPTurnRejectsABodyOverTheByteCapTestHTTPTurnAcceptsUnknownJSONFieldsTestQueueDenialCarriesNoRetryAfter429carries noRetry-AfterTestCallerHeaderIsolatesTheUserTierOnlyBoth limiter tests are at the limiter level with no HTTP involved, as the issue proposed.
Docs
docs/sirens-echo-http.mdstated that a limited caller "receives429withRetry-After". That is not true of the pending-cap shed, which is the defect behind issue 181 — the doc was asserting a contract the code does not keep. Corrected, and the full rejection contract moved intodocs/sirens-echo-http-contract.mdto stay under the 80-line doc cap.Verification
Tests passing is not evidence that tests work. I mutated
http.gothree ways and confirmed each mutation was caught by its intended assertion, then reverted:>→>=TestHTTPTurnEnforcesTheHistoryLimitOnBothSides—history at 12 status = 400, want 200256→255TestHTTPTurnBoundsAuthorAndContentInRunes—author at the cap status = 400, want 200Allow: POSTheader removedTestHTTPTurnRejectsEveryMethodButPOST—GET Allow = "", want POSTAlso
go vetclean,gofmtclean,pre-commit run --filesclean, and the new tests at-count=5 -race.One correction to the issue
The issue says "
handleHTTPTurnappears in no test file." Not quite —agent_test.goalready hasTestHTTPTurnAppliesTheAdmissionPolicyandTestHTTPTurnReleasesItsQueueSlot, which cover admission and slot release on that path. This PR reuses theirturnAgenthelper rather than duplicating it, and does not re-cover what they already assert. The uncovered surface was validation and routing, which is what this adds.Quail (QA)