Repository navigation
fix(selection): accept a getAll key proxy of any SelectionKey type - #80
Merged
Merged
Conversation
Upd4ting
added a commit
that referenced
this pull request
Nov 10, 2026
## Why Put interface-database on `@antelopejs/tooling-configs` 0.5.1 and make it pass cleanly, not just carry the new version. 0.5.1 adds `antelopejs/no-read-then-insert`, relaxes `no-inherited-key-lookup`, and fixes the declared-surface walk that overflowed the stack on this package (tooling-configs#290). Task ANT-1857, parent ANT-1840. ## What changed - `@antelopejs/tooling-configs` is declared `^0.5.1`, and the lockfile resolves 0.5.1. - `pnpm run sync` rewrote `AGENTS.md` (new rule row, three sync notes now enforced by `--check`) and `.agents/skills/verify-interface/SKILL.md` (`verdict --judgement`). - `features/smoke.md` no longer blames the stack overflow. `every-function` and `minor-bump` now run here but cannot pass, so the gotcha states the two tool-side reasons and `through-core` stays the smoke journey. No lint finding came up. `no-read-then-insert` and `no-unknown-parameters` report nothing here. The repo has no `no-inherited-key-lookup` suppression for #291 to retire. `guardrails.suppressions.json` is unchanged. No published surface changes. ## Proof Before. Main with `^0.5.1` installed, before `pnpm run sync`: ``` $ pnpm run sync:check Drift: AGENTS.md; run antelopejs-sync Drift: .agents/skills/verify-interface/SKILL.md; run antelopejs-sync ELIFECYCLE Command failed with exit code 1. exit 1 $ pnpm run checks [sync:check] Drift: AGENTS.md; run antelopejs-sync Drift: .agents/skills/verify-interface/SKILL.md; run antelopejs-sync ELIFECYCLE Command failed with exit code 1. Checks: 10 passed, 1 failed. ELIFECYCLE Command failed with exit code 1. exit 1 ``` After, at this head: ``` $ pnpm run sync:check Guardrails are in sync. exit 0 $ pnpm run checks Checks: 11 passed, 0 failed. exit 0 ``` Verify layer. `antelopejs-verify journey <run> --plan` ran all 20 features (the diff touches `package.json`) and passed 31 of 31 journeys. ## Attention Run by hand at this head with `smoke` naming them, `every-function` and `minor-bump` both fail: - `every-function` fails 635 checks. 577 are class prototype methods (`.:ValueProxy.prototype.gt`, and so on). The `.d.ts` walk lists them and the consumer's runtime walk does not (it returns 65 top-level members), so each reads as "declared but not exported". The other 58 are plain classes and functions that would need `interface.calls` hooks. - `minor-bump` reports 21 added and 21 removed `__@asyncIterator@<n>` members, whose ids differ between the published 0.3.1 build and head (1858 against 3457). Each signature also embeds its referenced type closure, so #80's real `getAll<K extends SelectionKey>` overload marks 630 functions as changed. With symbol ids normalised, 42 still differ, all through that overload. That part is genuine: under the rule, the next release of this package needs at least 0.4.0.
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.
Why
A module author keys a computed subquery on a row field, for example
table.getAll(doc.key("name"), "name").count(). Once that proxy is bound to a variable, or typed explicitly as inrow.key<{ _id: string }, "_id">("_id"), it is aValueProxy<string>.getAllrejected it (TS2345), so the author had to restate the key type with.cast<string | number | boolean>().ValueProxyis invariant in its value type, soValueProxy<string>is not assignable toValueProxy<SelectionKey>, the only proxyIndexKeysaccepted.Fixes #68
What changes
IndexKeystakes a type parameter,IndexKeys<K extends SelectionKey = SelectionKey>. The default keeps the old type, so adapters that typestage.args[0]asIndexKeys(@antelopejs/mongodb,@antelopejs/postgres) see no change, andQueryStageMap["getAll"]stays the same.Selection.getAllgains a second overload,getAll<K extends SelectionKey>(keys: IndexKeys<K>, index?). The original signature stays first, so every call that compiled before resolves exactly as it did, including a list ofdoc.key(...)calls whose type comes from the expected argument. The implementation and the recorded stage are unchanged, and no type assertion is added.src/tests/do_operations.test.ts. It bindsdoc.key("name")to aconstand countsgetAll(name, "name"). It needs nothing new from adapters:@antelopejs/mongodb1.6.0 passes it.SelectionKeyis still exported from the/commonsubpath only, not the root. A caller no longer needs to name it.flowchart LR P["ValueProxy<string><br/>(row field)"] --> O1{"getAll(keys: IndexKeys)"} O1 -- "invariant: not ValueProxy<SelectionKey>" --> O2{"getAll<K extends SelectionKey>(keys: IndexKeys<K>)"} O2 -- "K = string" --> I["implementation<br/>QueryStage('getAll', { index }, keys)"] O1 -- "literals, SelectionKey proxies,<br/>contextually typed doc.key()" --> I I --> S["recorded stage args: [keys: IndexKeys]<br/>(unchanged for adapters)"]Proof
The test commit
6f69421lands before the fix. Its build on top of main's code:With the fix (
pnpm exec ajs module test . -f dist/tests/do_operations.test.js):pnpm run checkspasses all 8 checks.pnpm test:staged-querypasses, andtsc -p docs/tsconfig.jsonis clean.antelopejs-verifypasses all 29 journeys over the 18 features its plan maps, and no formal check covers the diff.Date,null,undefinedorunknownare still rejected.Attention
antelopejs-verify doorsflags theformatandcontractdoors onsrc/staged-query/selection.tsandsrc/staged-query/stages.ts. Thecontractdoor also coverssrc/tests/do_operations.test.ts. The contract change is additive: one overload, and a type parameter whose default is the old type.[ValueProxy<string>, ValueProxy<number>], still fails, because TypeScript picks oneKfor the list. One index holds one key type, and a field typedstring | numbergives a singleValueProxy<string | number>, which this accepts.