Repository navigation
fix(ingest): stop pydantic dropping the 0.6.0 MCP fields - #124
Merged
Merged
Conversation
`ExternalIngestBody` declared `schema_fingerprint` and `schema_tool_count` and nothing else from 0.6.0. Pydantic ignores unknown keys silently, so `schema_tool_digests`, `server_version`, `list_changed` and `initiator` were POSTed by the proxy and discarded at the HTTP boundary. The whole 0.6.0 headline was false on the live path. A schema move could only name the server, never the tool, and the initialize handshake that separates a shipped release from a rug pull never reached the trail. `external.py` has read `payload["initiator"]` the whole time; the model hid it before that code ran. The unit tests passed because they call the ingest functions with a dict and never cross the model. That is the same shape as the trait bug: green tests over a field production does not have. This is the second occurrence in this file. `tool.traits` and `tool.mitre` were dropped the same way, which made hashed-only events invisible to every command rule, and the comment explaining it is four lines above the fields I just added. So the fix is not four more fields, it is a structural guard: `test_ingest_roundtrip.py` builds payloads with the real proxy builders and fails if any key does not survive the model. `initiator` is opened with `actor_type` constrained to a known set, coerced down to `agent` rather than up. `human` resets approval gates and `autonomous` is what `autonomous-unapproved-write` keys on, so an unrecognised string must not land on either. Identity is untouched: `host_id` and `fleet_id` are still stamped by the receiving orchestrator, with a test pinning that a client cannot assert them. Ruleset fingerprint unchanged at 56ad3de1ad8533cf. Co-Authored-By: Claude Opus 5 <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The 0.6.0 headline does not survive HTTP.
ExternalIngestBodydeclaresschema_fingerprintandschema_tool_count. Pydantic ignores unknown keys silently, so everything else 0.6.0 added was POSTed by the proxy and thrown away at the ingest boundary:So a schema move could only ever name the server, never the tool. The initialize handshake that separates a shipped release from a rug pull never reached the trail. And
external.py:66has readpayload["initiator"]the whole time, so the consuming code was already there; the model hid the field before it ran.Why the tests passed
They call
_ingest_observed_schema(payload)with a dict and never cross the model. Unit tests of the function, not the transport.Which is the same shape as the trait bug this repo already documents: tests that pass because they inject a field production events do not have.
This is the second time in this file
tool.traitsandtool.mitrewere dropped exactly this way, and it made hashed-only events invisible to every command-based sequence rule. The comment explaining that sits four lines above the fields this PR adds.So the fix is not four more fields.
tests/test_ingest_roundtrip.pybuilds payloads with the real proxy builders and fails if any key does not survive the model. A field added to a builder without being added to the model now fails in CI rather than shipping.Opening
initiatorwithout reopening spoofingactor_typeis constrained to{human, agent, autonomous, system}and coerced down toagent, never up.humanresets approval gates, andautonomousis whatautonomous-unapproved-writekeys on, so an unrecognised string must not land on either. A new surface adds its kind deliberately.Identity is unchanged.
host_idandfleet_idare still stamped by the receiving orchestrator, with a test pinning that a client cannot assert them.Not in scope
autonomous-unapproved-writestill cannot fire on IDE capture, because the hook path emitshuman,agentandsystemand neverautonomous(zero occurrences in ~32k trail events). That rule lives in frozen files and needs its own decision.1146 tests pass, ruff clean, ruleset fingerprint unchanged at
56ad3de1ad8533cf.🤖 Generated with Claude Code