Repository navigation
docs: describe recompute-on-read for persistent rules and re-evaluate-and-diff subscriptions - #372
Merged
Merged
Conversation
…-and-diff subscriptions (#306) Persistent rules are stored definitions re-derived from the base facts on every read; subscriptions re-run their query after each relevant commit and diff. Remove every claim of materialization, caching or incremental maintenance across docs, the legacy docs tree, README, BENCHMARKS, SDK docs, marketing content, examples, the landing page and Rust doc comments; rewrite the stale materialization parts of the architecture doc; retire the legacy architecture.md copy in favour of the .mdx source; describe the 1,652x figure as a bound Magic Sets query against a full closure; note what milestone 9 (#305, live views) will change. Regenerate gui/lib/docs-bundle.ts and front/lib/content-bundle.ts.
…ine, and stale doc references
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.
Intent
please leave this query batching functionliaty just refactor things so its clear and optimized for this ... auto materialize needs to be default mode of operation where rules get deployed as views and everything else is a query .. make the docs true with the correct systems design ... this is not accceptable state for production readiness (Context: implement #306 exactly as written.)
What Changed
front/guicontent) so they no longer say persistent rules are incrementally maintained or materialized. They now say that persistent rules are stored definitions, evaluated from the current base facts on every query that reads them; that subscriptions re-evaluate after each relevant commit and push the diff; and that the Magic Sets figures inBENCHMARKS.mdand the benchmark blog compare a bound query against a full-closure recomputation, not an incremental update against a full refresh.docs/content/docs/internals/architecture.mdxto match the current server path.docs/internals/architecture.mdis now a short pointer to it, since its old content described a rule-materialization subsystem that doesn't run on the server. The OpenAPIviewsstat and the AsyncAPIsubscribedescription now spell out the evaluate-on-query and re-evaluate-and-diff behaviour, and the docs point to milestone 9 (Epic: persistent rules are incrementally maintained views; everything else is a query (E0) #305) for maintained views.src/incremental.rs,src/derived_relations.rs,src/storage_engine/mod.rs,src/statement/mod.rs,src/lib.rsand the JS SDK'sclearRule:IncrementalEngineandauto_materializeare test-only base-relation mirrors and nothing derived is stored. Also fixed a broken intra-doc link toparams::bind_statementinsrc/ast/mod.rs. No code behaviour changes.Risk Assessment
✅ Low: The change touches only documentation, marketing copy and doc comments, with no executable code changes; regenerating both bundles reproduced them byte-for-byte, and the remaining issues are a few small factual inaccuracies in the docs.
Testing
This is a docs and comments change (plus regenerated bundles). Validation had two parts. First, both generated doc bundles regenerate byte-identical from source. Second, I built and ran a disposable local server and drove the behaviours the rewritten docs now describe. A recursive persistent rule is recomputed on read, so deleting an edge correctly removes downstream reachability. Persistent rules and base facts survive a restart; facts are stored as WAL plus Parquet batches. Type declarations and derived rows are not stored. Standing queries emit a snapshot followed by exact insert and retract deltas after each commit. All the changed example scripts still run, and those with snapshot files produce output identical to their base-commit versions. Everything matched the docs. The only note is an informational one about leftover wording in the crate description. All temporary builds, servers and data were removed and the worktree is clean.
node gui/scripts/bundle-docs.mjsleaves no diff.rellists only edge, no type storeEvidence: Recursive retraction recomputed on read (live CLI transcript)
Evidence: After restart: rules and facts persisted, no stored derived relation
Evidence: Subscription snapshot and deltas (Python SDK, live)
Evidence: GUI docs bundle sync check
Evidence: Front content bundle sync check
Evidence: Changed landing-page example 02_incremental run
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
docs/content/docs/internals/type-system.mdx:228- The new 'Persisted' column saystypedeclarations are persisted ('Yes'). That is false. The server's handler forStatement::TypeDecl(src/protocol/handler.rs:2750) only pushes the message "Type 'X' declared." and does not register or store anything, so the type is gone after the request. The same table also says base facts are persisted in 'WAL + relation store' (line 232). The relation store is in memory; facts are persisted through the WAL and Parquet batch files, which is what the architecture doc Section 8 says. This adds a new false statement in a PR whose goal is making the docs true. Fix: marktypeas 'No' (or 'N/A, not stored'), change the facts cell to 'Yes (WAL + Parquet)', and regenerate gui/lib/docs-bundle.ts. The legacy docs/internals/type-system.md table has no Persisted column and needs no change.BENCHMARKS.md:77- Issue Docs truth: every statement that claims materialization or incremental maintenance (D1) #306 marks BENCHMARKS.md:77 as misleading ('correctness comes from recomputation'), but the edit keeps the bold headline 'No other IQL engine handles retraction through recursive fixpoints.' The rewritten sentence after it now says InputLayer is correct because every query recomputes from the remaining facts, which is also how a Souffle re-run or PostgreSQL REFRESH reaches correct results. The headline still implies a unique retraction mechanism, contradicting both the new text and line 65 ('Nothing is retracted from maintained state; there is none'). Fix: reword the headline to the real difference, for example that a bound recursive re-query after a delete stays correct without a full-closure refresh, instead of claiming unique retraction handling.docs/content/docs/internals/coding-standards.mdx:684- This PR retires docs/internals/architecture.md and replaces it with a stub that points to the .mdx. It updated the legacy docs/internals/coding-standards.md:683 to point to architecture.mdx, but the canonical, bundled coding-standards.mdx:684 still tells readers to 'Readdocs/internals/architecture.md', which is now the stub. The two edits are the wrong way round: point the canonical .mdx at docs/content/docs/internals/architecture.mdx (and regenerate the gui docs bundle).src/incremental.rs:6- The rewritten module doc says the engine is enabled only by tests throughStorageEngine::enable_incremental. No such method exists. The method isKnowledgeGraph::enable_incremental(src/storage_engine/mod.rs:2319), which tests reach throughwith_kg_mut/kg.write(). Fix the path in the doc comment.docs/content/docs/internals/architecture.mdx:645- Scope note, no action needed. The free-text intent says 'auto materialize needs to be default mode... rules get deployed as views', but the authoritative context is to implement Docs truth: every statement that claims materialization or incremental maintenance (D1) #306 (D1) exactly. Docs truth: every statement that claims materialization or incremental maintenance (D1) #306 requires the docs to describe recompute-on-read until V20 ships, and this change does that. The target design (deployed rules as maintained views, everything else a query, query batching kept and simplified, the cost probe removed) is recorded as planned in architecture.mdx Section 16 and is not claimed as shipped. Making views the engine default belongs to the Epic: persistent rules are incrementally maintained views; everything else is a query (E0) #305 V-children, not to this docs PR.🔧 Fix applied.
1 info still open:
docs/content/docs/internals/architecture.mdx:645- Scope note, no action needed. The free-text intent says 'auto materialize needs to be default mode... rules get deployed as views', but the authoritative context is to implement Docs truth: every statement that claims materialization or incremental maintenance (D1) #306 (D1) exactly. Docs truth: every statement that claims materialization or incremental maintenance (D1) #306 requires the docs to describe recompute-on-read until V20 ships, and this change does that. The target design (deployed rules as maintained views, everything else a query, query batching kept and simplified, the cost probe removed) is recorded as planned in architecture.mdx Section 16 and is not claimed as shipped. Making views the engine default belongs to the Epic: persistent rules are incrementally maintained views; everything else is a query (E0) #305 V-children, not to this docs PR.Cargo.toml:16- The crate description in Cargo.toml:16, which is also whatinputlayer-server --helpprints, still says "conclusions stay current as facts change". This PR reworded the same phrase in front/app/layout.tsx to "derives every conclusion from the current facts when it is read". It is arguably still true from a user's point of view because reads recompute, but it is not consistent with the rewording. Leaving it to the author.node gui/scripts/bundle-docs.mjsleaves no diff.rellists only edge, no type storenode gui/scripts/bundle-docs.mjsthengit diff --quiet gui/lib/docs-bundle.ts: in syncnode front/scripts/bundle-content.mjsthengit diff --quiet: in synccargo build --bin inputlayer-server --bin inputlayer-client(isolated CARGO_TARGET_DIR in /tmp)Startedinputlayer-server --port 18491 --data-dir /tmp/...with a throwaway admin password and API key; viainputlayer-client: inserted edge facts, declared recursive persistent rule reach, ran?reach(1,Y), deleted-edge(2,3), re-queried, added a new path, re-queriedRestarted the server on the same data dir and ran.rel,.rule list,?edge,?reach; inspected data dir layout (persist/wal, persist/batches/*.parquet, rules/catalog.json, no stored type or derived relation)Python SDKkg.subscribe(iql='?reach(1, Y)')against the live server, committing +edge(3,4) then -edge(2,3)Ran the changed example scripts (121_materialized_view, 03_schema_with_views, 02_incremental, 05_manufacturing, hello-consistency.iql, ingest/rules.iql) through inputlayer-client; for those with .out files, compared output to the base-commit version of the same script✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.