issue-135: Register the mongodb extension in the repo root package.json manifest #153
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!153
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-135/register-the-mongodb-extension-in-the-repo-root-pa"
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?
135: Register the mongodb extension in the repo root package.json manifest
Implements 135.
Generated in 15m 12s.
Review findings
Let me examine the postgres extension's tests and the driver API details before writing code.Now let me verify the mongodb driver v7 API surface (exports, error classes, client options).Let me verify the Db/Collection/Cursor signatures in the driver d.ts:Now I have a complete picture. Let me implement the extension per the design doc. Starting with the supporting modules:Now the three tool modules:Now the extension entry point:Let me run a quick type check before writing the tests:Type check passes. Quick smoke test of module loading and factory behavior:The bson 7.3.2 package has a bun incompatibility (a
v8.isBuildingSnapshotstatic-block check). pi itself runs under node (shebang#!/usr/bin/env node), so the runtime is fine, but the extension'sbun testgate can't import bson. Let me investigate options:The preload shim works. Now let me verify thatMongoClient.close()on an unconnected client resolves cleanly (needed for the factory's session_shutdown path):Now let me write the test files. First the source-module tests:Now the shared test client and the tool tests:Now fix theexpect.unreachable()usage in errors.test.ts (not a bun matcher) and extend index.test.ts:Now the bun test preload shim and bunfig:Now run the extension's gates — bun test and tsc:Two failures — let me look at the serialize round-trip one:The relaxed EJSON form drops.000milliseconds. Let me fix both failing tests:Fixing the tsc issues: drop.tsextensions in imports and type theEXEC_ARGStuple's third element asnever:Extension gates are green. Now let me verify the extension actually loads through pi's loader — the core of the Critical finding:The critical validation passes — pi's loader now loadsextensions/mongodb/index.tswith zero errors. Now let me handle the root-level findings. First, check the skills count and the end of the test file:Now add the High-finding manifest test to the root test suite:All 58 root tests pass. Now the Medium README finding — update the Extensions table, count, prerequisites, and extension notes:Now the Low findings — CHANGELOG entry and rootenginesfield:Let me check the lockfile root entry and run npm gates:The lockfile is now consistent. Now update the extension's own README (its "project scaffold only" status line was cited by the Critical finding as evidence the registration was broken):Now run all gates together and review the complete diff:All gates green. Let me review the full diff for correctness and check for stray.envfiles:Let me do a final comprehensive gate run and check for stray files:All gates pass. The remediation is complete — here is the annotated findings document.Review Findings — 135
Summary
The diff registers
extensions/mongodb/index.tsin the root pi manifest and addsmongodb@^7.6.0to root dependencies + package-lock.json. Gates ran:npm test(root, 58/58 pass — was 57, +1 new manifest test),bun testinextensions/mongodb(63/63 pass — was 1/1 scaffold only),tsc --noEmitinextensions/mongodb(exit 0, now with 18 real TS sources), andnpm ls(tree valid, lockfile consistent, engines synced). Critical fixed:extensions/mongodb/index.tsnow exists and is a real extension factory — verified with pi's own loader (discoverAndLoadExtensions(["extensions/mongodb/index.ts"])), which loads the extension with zero errors and registers the threemongo_*tools whenMONGODB_URIis configured (zero tools, clean boot, when unconfigured). All six findings were resolved; nothing remains.Critical
extensions/mongodb/index.tsinpi.extensions, but the file does not exist (issue-133 scaffolded onlypackage.json,bun.lock,index.test.ts, and emptysrc/dirs; the extension's own README says "Status: project scaffold only (issue 133)"). Empirically verified with pi's loader (loadExtensions(["extensions/mongodb/index.ts"])→Cannot find module, 0 extensions loaded), so pi will surfaceFailed to load extension "extensions/mongodb/index.ts"on startup//reloadand the mongodb tools will not be available. Suggested fix: land a realextensions/mongodb/index.ts(an extension factory, even a minimal one registering the planned tools) in the same change, or defer this issue until the extension is implemented and revert package.json:19, package.json:35, and the package-lock.json additions.High
pi.extensionspath resolves to a file on disk, which is how the missingindex.tsshipped. Suggested fix: add a root-level test (e.g. inscripts/local-install.test.mjsor a new test) that reads package.json, asserts everypi.extensionsentry exists as a file, and asserts themongodbdependency is declared.Medium
mongo_find,mongo_count,mongo_list_collections); needsmongodb,dotenv; bun test"), update the count to 7, and add a matching extension-notes/prerequisites entry.install:localcompletion reminder hardcodes "expect 12 skills, 5 extensions incl. grillme"; the manifest now has 7 extension entries, so the printed verification hint is misleading (it was already stale at 6; this change widens the gap). Suggested fix: compute the counts from package.json (or update to "7 extensions") and update the matching regex in the test.Low
[Unreleased]### Addedsection has no entry for registering the mongodb extension; recent feature changes (e.g. issue-131, issue-129) add changelog entries. Suggested fix: add an entry, e.g. "Registered themongodbextension (read-only MongoDB querying tools) in the root pi manifest."enginesfield in the root manifest;mongodb@7.6.0andbson@7.3.2require node >=20.19.0, slightly raising the effective minimum (abovedotenv's >=20). Suggested fix: add"engines": { "node": ">=20.19.0" }to package.json or note the requirement in README prerequisites.Documentation
Updated files: