Skip to content

Interpret shared Kyo relation plans as ZQuery - #411

Open
yoohaemin wants to merge 3 commits into
fix/kyo-composed-batchingfrom
feat/kyo-zquery
Open

yoohaemin wants to merge 3 commits into
fix/kyo-composed-batchingfrom
feat/kyo-zquery

Conversation

@yoohaemin

Copy link
Copy Markdown
Owner

Kyo relation implementations currently need a separate set of ZQuery-backed proofs to participate in ZQuery batching. Add an optional kyoZquery[E] interpreter mixin that reuses the same Kyo proofs, datasource callbacks, and shared source descriptors.

Register each datasource once. startingFrom handles native Kyo Batch, toBatch leaves it to the caller, and the mixin adds toZQuery / toZQueryMany. The adapter translates structured source/key requests before execution, so separately constructed queries can share ZQuery batches. Callbacks run through ZIOs.run, preserving typed Abort[E] failures. Ordinary lifted effects are translated without keyed caching or deduplication.

Supports Async & Abort[E]; handle other Kyo effects inside callbacks. Native-only users retain kyoBatch[Eff] without a ZQuery dependency. The module builds on JVM and Scala.js and documents the shared-registration API.

Stacked on #400, which supplies structured query plans, shared source descriptors, and unhandled Batch execution. Review and merge #400 first.

Validation: all nine adapter regressions pass on JVM and Scala.js, covering equivalent results across all three execution paths, batching across separate queries, datasource identity isolation, dependent stages, optional/many shapes, asynchronous custom callbacks, typed failures, empty inputs, reruns, and ordinary effects. Parent core regressions and workflow checks pass; changed Scala sources are formatted.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the optional Kyo–ZQuery integration.

No open issues 🎉

What changed in this PR

Adds an optional kyoZquery[E] interpreter that builds on #400’s shared Kyo query plans, allowing existing proofs and datasource callbacks to participate in ZQuery batching without duplicate registrations.

Changes:

  • Translates structured source/key requests into ZQuery batches while preserving typed failures and uncached ordinary effects.
  • Adds nine regression tests covering batching, source isolation, execution paths, result shapes, failures, and reruns.
  • Registers the module for JVM and Scala.js and documents the shared-registration API.
File Description
README.md Links to the new Kyo–ZQuery integration documentation.
kyo-zquery/​src/​test/​scala/​decrel/​reify/​KyoZquerySpec.scala Adds adapter regression coverage.
kyo-zquery/​src/​main/​scala/​decrel/​reify/​kyoZquery.scala Implements datasource adapters, plan translation, and ZQuery relation methods.
kyo-zquery/​README.md Documents registration, execution paths, and supported effects.
build.sbt Adds the module, dependencies, and JVM/Scala.js build targets.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants