Skip to content

Commit a60b942

Browse files
fix(mongodb-mcp): add BsonFieldType enum to Zig FFI (standards#155) (#119)
## Summary Class C ABI gap from the Phase 2 full-tree survey (standards#92): `MongodbMcp.SafeDatabase.BsonFieldType` (11 BSON wire-protocol field types) was declared in the Idris2 ABI but absent from `mongodb_mcp_ffi.zig`. Adds the matching `pub const BsonFieldType = enum(c_int)` with the canonical encoding (1–18 with BSON-spec gaps). ABI parity only — the wire-protocol encoder/decoder that *uses* these tags is a separate piece of work; declaring the enum here lets `iseriser abi-verify` structurally check the encoding. ## Verified - `iseriser abi-verify` → exit 0 (3 enums clean) - `zig build test` → 17/17 green ## Next After merge, mongodb-mcp can join the abi-drift allowlist (boj-server#115's 56 → 57). Closes hyperpolymath/standards#155 Refs hyperpolymath/standards#92 Refs hyperpolymath/standards#89 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4d5d565 commit a60b942

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

cartridges/mongodb-mcp/ffi/mongodb_mcp_ffi.zig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,27 @@ pub const MongodbAction = enum(c_int) {
4343
list_databases = 15,
4444
};
4545

46+
/// BSON wire-protocol field type tags. Matches Idris2
47+
/// `MongodbMcp.SafeDatabase.BsonFieldType` + `bsonFieldTypeToInt`.
48+
/// Integer codes follow the BSON spec — gaps (6, 11–15, 17) are by
49+
/// design (reserved / deprecated BSON codes Idris2 does not expose).
50+
/// Declared here so `iseriser abi-verify` can structurally check the
51+
/// encoding against the Idris2 source; the wire-protocol encoder will
52+
/// use these values when introduced.
53+
pub const BsonFieldType = enum(c_int) {
54+
bson_double = 1,
55+
bson_string = 2,
56+
bson_document = 3,
57+
bson_array = 4,
58+
bson_binary = 5,
59+
bson_object_id = 7,
60+
bson_bool = 8,
61+
bson_date_time = 9,
62+
bson_null = 10,
63+
bson_int32 = 16,
64+
bson_int64 = 18,
65+
};
66+
4667
/// Validate a state transition against the proven Idris2 transition graph.
4768
fn isValidTransition(from: ConnState, to: ConnState) bool {
4869
return switch (from) {

0 commit comments

Comments
 (0)