Skip to content

fix(plugin-mongodb): export ObjectId and dates as mongosh constructors, and compile every plugin in CI - #2091

Merged
datlechin merged 2 commits into
mainfrom
fix/mql-bson-roundtrip
Aug 11, 2026
Merged

fix(plugin-mongodb): export ObjectId and dates as mongosh constructors, and compile every plugin in CI#2091
datlechin merged 2 commits into
mainfrom
fix/mql-bson-roundtrip

Conversation

@datlechin

Copy link
Copy Markdown
Member

Two commits. Follows #2090.

1. CI never compiled the registry plugins

macos-tests.yml builds -scheme TablePro, whose dependencies are the 14 bundled plugins. The 16 registry-only plugins (MongoDB, Oracle, DuckDB, MSSQL and the rest) are compiled only by the AllPlugins aggregate, and nothing in PR CI ran it. build-plugin.yml does not fire until a release tag.

I hit this while writing #2090: a hard compile error in the MongoDB plugin still produced ** BUILD SUCCEEDED **. It surfaced only because that one file happens to be in the test target's source list. The rest of the plugin was never compiled by CI at all, so a plugin-only change could go green and be broken.

Adds an AllPlugins build step before the test step.

2. ObjectId and dates did not survive MQL export

The dump is a mongosh script, so a bare string in it inserts a string. _id was written as "507f1f77bcf86cd799439011" and a date as "2026-01-01T00:00:00Z", so re-running the script replaced every ObjectId and every date with a string. Same defect class as the binary subtype in #2090, and the same root cause: the type was gone before the exporter saw the value.

unwrapExtendedJson mapped {"$oid": ...} straight to String, so nothing downstream could tell an ObjectId from an ordinary string. It now returns a MongoDBObjectId box, which is CustomStringConvertible over the hex so the one site that interpolates bsonToDict(doc)["_id"] keeps working. BsonValueKind gains .objectId, and typeName reports ObjectId, the spelling fetchColumns already used for an empty collection.

MQL export then writes ObjectId("...") for an ObjectId column and ISODate("...") for a TIMESTAMP column, validating the value first and falling back to a quoted string if it does not parse. Cell display is unchanged: the grid still shows the bare hex, and the column still classifies as text, so no edit guard or formatter moves.

Deliberately not fixed: values nested in a subdocument

A typed value inside a subdocument or array still exports as a string, and the docs now say so.

I stopped short of fixing it because the only contained fix is a bad one. The export data source is format-agnostic: the same PluginCellValue stream feeds MQL, CSV, JSON and XLSX, and a nested document has already been serialized to a JSON string by the time any exporter sees it. MQL export could re-parse that JSON and rewrite any string matching BinData(...) or ObjectId(...) back into a constructor, but that is reconstructing a type by pattern-matching a display string, and it would silently convert a genuine user string that happens to look like one.

The clean fix is a driver-owned export hook, so MongoDB serializes its own literals per format rather than the exporter guessing from text. That is an additive PluginKit protocol change affecting every driver and every format, and it deserves its own design rather than being tacked on here.

Verification

  • 8628 tests in 1052 suites pass, full TableProTests with CI's own quarantine skip list.
  • AllPlugins builds.
  • PluginKit ABI diff additive, zero removed symbols.

https://claude.ai/code/session_01628orR3jwc3ATfcFCLVUMB

@mintlify

mintlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Aug 11, 2026, 2:57 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin added the abi-additive PluginKit ABI diff reviewed as additive; no version bump needed label Aug 11, 2026
@datlechin
datlechin merged commit c849d75 into main Aug 11, 2026
4 checks passed
@datlechin
datlechin deleted the fix/mql-bson-roundtrip branch August 11, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

abi-additive PluginKit ABI diff reviewed as additive; no version bump needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant