8000 feat: prepared-query core for the bindings — API-022/023/024, Entity≡Val(Ref), BrowserDb.prepare (#181) by adityamukho · Pull Request #738 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
1 < 8000 link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fz-4625459279202f71.js" fetchpriority="low" />

feat: prepared-query core for the bindings — API-022/023/024, Entity≡Val(Ref), BrowserDb.prepare (#181) - #738

Merged
adityamukho merged 5 commits into
v3from
feat/181-prepared-core
Oct 24, 2026
Merged

adityamukho merged 5 commits into
v3from
feat/181-prepared-core

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

PR 1 of #181 (spec, merged #737; plan, steps 1–8). The binding PRs follow on each binding's v3 branch.

Changes

  • Bind mistakes are API errors. A missing bind value, an attribute slot and a bind value of the wrong kind are now API-022, API-023 and API-024. They were INT-033/034/035, with the same messages. The INT codes are deprecated: still registered, never reused. Breaking for callers that matched the INT codes (CHANGELOG).
  • Entity and Val(Ref) fit each other's slots. An entity slot takes Val(Value::Ref(u)), and a value, expression or rule-argument slot takes Entity(u). A binding can pass a host UUID without knowing where its slot is (spec decision 6).
  • BrowserDb.prepare returns a BrowserPreparedQuery with execute(bindings) (JSON) and query(bindings) (BrowserCursor). Bindings are a JS object holding plain values (boolean, number (an integer when whole), bigint, string, null) or {type, value} forms, read by src/browser/binds.rs with js_sys. No new dependencies.

Tests. On the bench machine: 1,707 passed / 13 ignored, and 1,723 / 14 with test-hooks (+4 Rust tests). The CI clippy gate is clean. Browser: 40 wasm_bindgen_test (+6), run locally with wasm-pack test --headless --firefox; CI also runs Chrome.

Found in passing, not changed here: an expression can't take a #uuid literal (PRS-070). [(= ?g :bob)] doesn't match a ref to :bob's entity, although a pattern treats the two as equal. Not filed yet.

Codex review: 2 findings, both fixed in 04f0c7e (typed null/anyValidTime with a payload is now API-017; added a browser API-024 test).

Docs site: minigraf-docs PR to follow; it merges after this one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x

adityamukho and others added 5 commits October 24, 2026 09:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
…) interchangeable (#181)

INT-033/034/035 are deprecated (kept registered). An entity slot takes
Val(Ref), and value, expression and rule-argument slots take Entity, so
a binding can pass a host UUID without knowing the slot's position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
Bindings are a JS object of slot name to a plain value (boolean,
number, bigint, string, null) or a typed {type, value} form. A JS value
that is not a bind value is a TypeError; a typed value that does not fit
its type is API-017.

Co-Authored-By: Claude Opus 
8000
5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
@codecov
codecov Bot commented Oct 24, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.19048% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/query/datalog/prepared.rs 72.22% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 5f2ba46 into v3 Oct 24, 2026
18 of 19 checks passed
@adityamukho
adityamukho deleted the feat/181-prepared-core branch October 24, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0