8000 feat: :query-memory-limit, limit bind slots and PreparedQuery limit setters (#870) by adityamukho · Pull Request #874 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

feat: :query-memory-limit, limit bind slots and PreparedQuery limit setters (#870) - #874

Merged
adityamukho merged 3 commits into
v3from
feat/870-memory-limit
Nov 6, 2026
Merged

adityamukho merged 3 commits into
v3from
feat/870-memory-limit

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Refs #870, #862 (PR 2 of the #862 spec, §3–§5). Closing keywords don't fire on v3; #870 will be closed by hand after merge.

What

  • :query-memory-limit N|$slot replaces OpenOptions::query_memory_limit for one query, up or down. 0 is allowed. It is gated by the new Overridable::QueryMemoryLimit, which is not in DEFAULTS, so it is refused with API-025 unless listed. BrowserDb always refuses it.
  • Bind slots on :max-derived-facts, :max-results and :query-memory-limit, filled with Val(Integer(n)):
    • Out of range gives the literal form's code: INT-014 (< 1) for the first two, INT-015 (< 0) for the memory limit.
    • Another value type is API-024, a missing value API-022, and an unbound slot on execute/query API-010.
  • PreparedQuery::with_max_derived_facts / with_query_memory_limit replace the database values for one statement. They are not gated, and an allowed keyword in the text overrides them.
  • Grammar: grammar.pest updated and GRAMMAR.md regenerated. Corpus: 3 valid, 2 syntax and 2 semantic fixtures, plus a fuzz seed. The verifier has 41 tokens and a new INT-015 witness.
  • Docs: CONFIGURATION.md, ERROR_REFERENCE.md, CHANGELOG, TEST_COVERAGE and CLAUDE.md. The docs-site PR follows this one.

Plan: docs/superpowers/plans/2026-11-06-870-query-memory-limit.md.

Deviations from the spec (also in the plan)

  1. INT-015 text changes from "must be a positive integer" to "must be a non-negative integer", because :query-memory-limit accepts 0. The code is unchanged.
  2. Zero is narrower than spec §3 says. The meter counts entity ids as held state, and uncheckpointed facts and returned entities need ids. So under :query-memory-limit 0, only a value-only query over checkpointed facts runs; everything else fails with QRY-012.
  3. clippy::large_enum_variant on DatalogCommand is allowed with a reason, rather than boxing the query.
  4. Grammar conformance opens its handle with every Overridable listed, so an API-025 refusal isn't reported as a parse error.

Size

The dist binary is 1,263,928 B, +672 B over b79ff1d6 and 312 B over the old 1,234 KiB gate. The maintainer approved raising the gate to 1,240 KiB ( 8000 1,269,760 B) to cover #870 and #861. The reason is recorded in binary-size.yml and PHILOSOPHY §4.

Verification

  • Full suite: plain 2,073 passed / 21 ignored; --features test-hooks 2,108 / 24.
  • Grammar verifier at bound 4: clean (832 s, 1,567,147 fillers).
  • cargo clippy --all-features -- -D warnings clean.
  • The wasm32 browser build compiles.
  • Codex review skipped (quota out until 2026-11-11).

🤖 Generated with Claude Code

https://claude.ai/code/session_01H2a7QoYX6tc5G3sKVzvLjD

adityamukho and others added 3 commits November 6, 2026 14:28
Refs #870, #862

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QoYX6tc5G3sKVzvLjD
…etters (#870)

:query-memory-limit N|$slot replaces query_memory_limit for one query
(0 allowed), gated by Overridable::QueryMemoryLimit (not in DEFAULTS).
:max-derived-facts and :max-results take $slot. PreparedQuery gains
with_max_derived_facts / with_query_memory_limit (ungated). INT-015
text now says non-negative. Grammar, GRAMMAR.md, corpus, verifier
(41 tokens), docs and counts updated.

Refs #870, #862

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QoYX6tc5G3sKVzvLjD
Refs #870

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

Codecov Report

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

Files with missing lines Patch % Lines
src/query/datalog/parser.rs 96.55% 2 Missing ⚠️
src/query/datalog/executor.rs 95.45% 1 Missing ⚠️
src/query/datalog/prepared.rs 97.67% 1 Missing ⚠️
src/query/datalog/types.rs 90.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 83fbaa8 into v3 Nov 6, 2026
23 checks passed
@adityamukho
adityamukho deleted the feat/870-memory-limit branch November 6, 2026 10:02
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