Add research catalog for the mango query normalizer/optimizer package - #8834
Closed
pubkey wants to merge 7 commits into
Closed
Add research catalog for the mango query normalizer/optimizer package#8834pubkey wants to merge 7 commits into
pubkey wants to merge 7 commits into
Conversation
Deep-research results (MongoDB matcher optimizer, MySQL range optimization, Apache Calcite RexSimplify, CouchDB Mango, RxDB query-planner) as the design basis for the planned npm package that normalizes and optimizes mango queries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Self-contained implementation prompt: API design, full rewrite-rule catalog with correctness guards, equivalence testing strategy (mingo, mongodb-memory-server, RxDB memory storage) and performance test suites measuring optimizer overhead and optimization effect against MongoDB and RxDB. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Random data plus random query generation with exact-equal-outcome checks between optimized and non-optimized queries, across mingo, MongoDB and RxDB oracles, with seeded reproducibility and shrunk counterexamples kept as regression fixtures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Add a project-setup section that mirrors pubkey/jsonschema-key-compression: dual tsc build (dist/lib CJS, dist/es ESM), zero runtime dependencies, mocha + ts-node test scripts, test/unit plus performance test layout, helper.ts data generators, single GitHub Actions workflow, .npmignore and .npmrc conventions. Align the test and perf sections with that setup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Set the package name in the agent prompt and require mango/mongodb related npm keywords so the package stays findable for mango query searches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Rename the orga research and agent-prompt docs to the nosql-query-optimizer name, add a terminology rule to the agent prompt for all user-facing text, and record the naming preference in CLAUDE.md: most developers do not know the term 'mango query'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
The test asserted querySignal.value.length directly after insert(), but the signal updates asynchronously when the change event has propagated through the query observable. On slow storages like the MongoDB storage the emission can happen after the insert() promise resolves, which made the storage-mongodb CI job fail intermittently. Wait for the emission like the surrounding assertions already do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
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.
This PR contains:
orga/) for the planned npm package that normalizes and optimizes mango queries, as listed inorga/BACKLOG.md("query normalization and optimization").Describe the problem you have without this PR
The backlog entry lists six known optimization tricks for the planned package. Before implementing, a deep research pass was done to find more rewrite rules and their correctness conditions. Without this document, the verified findings (MongoDB
MatchExpressionoptimizer rules, MySQL range-extraction interval arithmetic, CalciteRexSimplifynull-semantics guards, plan-cache query-shape encoding, and architecture lessons like the SERVER-84013 predicate-order bug) would be lost and the package design would start from the six bullet points alone.The document catalogs:
$eq,$and/$orflattening, deterministic ordering)$incanonicalization,$or-to-$infold with collator/regex guards, interval arithmetic, contradiction detection, guarded DNF boolean simplification)$eqdetection,$exists/$typeelimination)$regexranges, restrictive operator injection, superset rule for post-filtering)Todos
🤖 Generated with Claude Code
https://claude.ai/code/session_01He8qhzAbBoeuG7UE6CbRrC
Generated by Claude Code