feat(parity): BodyVerify Layer 1.5 — universal VerifyEchoMiddleware#87
Merged
Conversation
Parity port of cueapi/cueapi#797. Adds the universal middleware counterpart to Phase 1's per-handler echo-back. All POST/PATCH/PUT JSON endpoints (and all future endpoints) now carry the BodyVerify echo-back primitive automatically; Phase 1 idempotency preserved. Design doc: https://trydock.ai/workspaces/cue-message-silent-corruption-substrate-design-2026-05-11 Direction of parity: private-leads, OSS-lags. Private PR #797 merging first; this port follows within ~30min. Files added: - app/middleware/verify_echo.py (verbatim port from private) - tests/test_verify_echo_middleware.py (verbatim port; all 24 tests pass identically — OSS has the same agents+cues+messages+fire endpoint shapes used by the integration tests) Files modified: - app/main.py — VerifyEchoMiddleware registered between RequestId/ BodySizeLimit and RateLimit (preserves shared-middleware ordering; hosted's SecurityHeaders + AccessAudit are hosted-only) Parity-manifest updates: - New entry: app/middleware/verify_echo.py - Updated app/main.py with BodyVerify deviation note (middleware ordering identical to private modulo hosted-only middlewares) 24/24 OSS tests pass locally; middleware coverage 95% on private. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Parity checkThis PR modifies files tracked in
Please confirm one of the following in a reply or PR description update:
This is a soft check — it does not block merge. The goal is visibility, not friction. See HOSTED_ONLY.md for the open-core policy. |
mikemolinet
added a commit
that referenced
this pull request
May 12, 2026
Private cueapi #801 added docs/guides/body-verify.mdx (Mintlify, 247 lines) documenting the X-CueAPI-Verify-Echo primitive for hosted users. cueapi-core ships the SAME substrate (Layer 1 from #86 + Layer 1.5 universal middleware from #87 + STRING-shape spec-lock from #88) but had no user-facing guide. Self-hosters running cueapi-core need this. ## Scope cueapi-core-flavored adaptation — plain MD (not MDX), substrate-focused (narrower than the hosted MDX guide which covers SDK install + hosted- specific patterns). Sections: 1. The bug class — caller-side shell expansion ($(...), `...`, ${VAR}) 2. How it works — X-CueAPI-Verify-Echo header + response shape 3. Substrate architecture — Layer 1 (endpoint-specific STRING shape on /v1/messages + /v1/cues/{id}/fire) vs Layer 1.5 (universal middleware on all other POST/PATCH/PUT endpoints, OBJECT shape) 4. SDK auto-verify summary table (python / cli / mcp / action), with the messages-default-on vs fire-opt-in distinction explicit 5. Defense-in-depth layers — substrate + SDK + force-file + docs 6. When to disable + opt-out semantics 7. Implementation file references (app/utils/verify_echo.py, app/middleware/verify_echo.py, app/routers/{messages,cues}.py) 8. Background — Mike directive 2026-05-11; cross-stack ship history ## Out of scope - Per-language SDK install / API-key bootstrap content — already in each SDK's own README. This guide links rather than duplicates. - The hosted-specific Mintlify mint.json registration — cueapi-core uses plain MD; doc discovery via the docs/ dir, not Mintlify. ## Build / lint - Plain Markdown; no build step required. (Other docs in this dir follow the same convention — see quickstart.md, configuration.md.)
mikemolinet
added a commit
that referenced
this pull request
May 12, 2026
…90) Private cueapi #801 added docs/guides/body-verify.mdx (Mintlify, 247 lines) documenting the X-CueAPI-Verify-Echo primitive for hosted users. cueapi-core ships the SAME substrate (Layer 1 from #86 + Layer 1.5 universal middleware from #87 + STRING-shape spec-lock from #88) but had no user-facing guide. Self-hosters running cueapi-core need this. ## Scope cueapi-core-flavored adaptation — plain MD (not MDX), substrate-focused (narrower than the hosted MDX guide which covers SDK install + hosted- specific patterns). Sections: 1. The bug class — caller-side shell expansion ($(...), `...`, ${VAR}) 2. How it works — X-CueAPI-Verify-Echo header + response shape 3. Substrate architecture — Layer 1 (endpoint-specific STRING shape on /v1/messages + /v1/cues/{id}/fire) vs Layer 1.5 (universal middleware on all other POST/PATCH/PUT endpoints, OBJECT shape) 4. SDK auto-verify summary table (python / cli / mcp / action), with the messages-default-on vs fire-opt-in distinction explicit 5. Defense-in-depth layers — substrate + SDK + force-file + docs 6. When to disable + opt-out semantics 7. Implementation file references (app/utils/verify_echo.py, app/middleware/verify_echo.py, app/routers/{messages,cues}.py) 8. Background — Mike directive 2026-05-11; cross-stack ship history ## Out of scope - Per-language SDK install / API-key bootstrap content — already in each SDK's own README. This guide links rather than duplicates. - The hosted-specific Mintlify mint.json registration — cueapi-core uses plain MD; doc discovery via the docs/ dir, not Mintlify. ## Build / lint - Plain Markdown; no build step required. (Other docs in this dir follow the same convention — see quickstart.md, configuration.md.)
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.
Summary
Parity port of cueapi/cueapi#797. Adds the universal middleware counterpart to Phase 1's per-handler echo-back (cueapi/cueapi#795 / cueapi-core#86). All POST/PATCH/PUT JSON endpoints (and all future endpoints) now carry the BodyVerify echo-back primitive automatically.
Design doc: https://trydock.ai/workspaces/cue-message-silent-corruption-substrate-design-2026-05-11
Direction of parity
Private-leads, OSS-lags. Private PR cueapi/cueapi#797 merges first; this port follows.
Implementation
Behavior
Identical to private:
Parity-manifest updates
Test plan
🤖 Generated with Claude Code