Repository navigation
Conversation
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
A model declares each field with a marker named after its EQL type, such as TextEq. The spec (#1341) wants the markers generated from the EQL catalog, beside the Go package, so Python and Go cannot disagree about a type. eql-codegen gains a py-eql emitter over the same rows as go-eql. It writes stackencrypt/_eql.py: one Marker subclass per row with the ten catalog attributes, a TYPES tuple, and an __all__ of the producible markers that the package re-exports. types:generate runs it and types:check diffs it. Two parity tests hold it: the committed file must match the render, and every marker must match its Go Types row. The file is not added to the EQL workflow path filters, the same as eql_gen.go. A path outside packages/eql/ would need a new exception in the filter guard, and the catalog changes that matter already start the EQL workflow. Refs #1385 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`go-eql` and `py-eql` write outside the EQL subtree, so an `EQL_CODEGEN_OUT_ROOT` override sent them outside the throwaway tree. Both now refuse the override with exit 2, and a CLI test covers it. `types:generate` now also snapshots `eql_gen.go` and `_eql.py`. A failed run restores them with the bindings, so the tree is never left mixed. `Marker` declares the ten attributes with types, so mypy and pyright accept them on a `type[Marker]`. The Go and Python emitters now take their shared wording from two methods on `Row` in `targets.rs`: `summary` and `status`. Both generated files are unchanged. The parity test skips each docstring before it reads attributes, so a catalog reason containing ` = ` cannot be read as one. The eql-bindings README and AGENTS.md now say that `_eql.py` is generated. Refs #1385 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yujiyokoo
force-pushed
the
feat/python-sdk-eql-markers
branch
from
October 29, 2026 07:06
0ebe128 to
d777757
Compare
This branch has not been deployed
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.
Summary
A Python developer will declare each encrypted field with a marker named after its EQL type, for example
Annotated[str, TextEq]. EQL (Encrypt Query Language) is the set of PostgreSQL types that store and query encrypted values. This PR adds those markers, generated from the EQL catalog by the same generator that writes the Go package. So Python and Go cannot disagree about a type.Nothing reads the markers yet. The
modeldecorator that reads them comes next, in #1386.Changes
eql-codegenhas a newpy-eqlcommand. It writeslanguages/python/python/stackencrypt/_eql.pyfrom the same catalog rows as the Goencrypt/eqlpackage.sql_domain(public.eql_v4_text_eq) andquery_sql_domain. ATYPEStuple lists them all._markers.pyhas theMarkerbase class,Passthrough(stored unencrypted), andIgnore(not a column).Markerdeclares the ten attributes with types, for mypy and pyright.from stackencrypt import TextEqworks for the 50 types the engine produces today. The one it cannot produce,Json, givesImportError.mise run types:generaterunspy-eql, andtypes:checkdiffs_eql.py. A failedtypes:generaterun restores_eql.pyand the Go file, as it already did for the bindings.Row::summaryandRow::statusintargets.rs. The Go output is unchanged.go-eqlandpy-eqlwrite outsidepackages/eql/, so they now refuseEQL_CODEGEN_OUT_ROOTinstead of writing outside the throwaway tree.AGENTS.mdsay that_eql.pyis generated.Verification
cargo test -p eql-codegen: all pass. The newpy_eql_parity.rschecks the committed file against the catalog and every marker against its GoTypesrow. I planted an error for each check, and each one failed with a clear message.cargo fmt --checkandcargo clippy -D warningsforeql-codegen: both pass.mise run testinlanguages/python: 61 passed and 2 skipped. The skipped tests are the probe tests from test(python): verify the two engine facts the spec depends on (#1384) #1414. They run only in a special build.--strictand pyright: both acceptm.query_sql_domainon atype[Marker]. Both rejectfrom stackencrypt import Json.mise run types:generate: exits 0 and changes no other generated file. With its last step forced to fail, it restored both cross-tree files.pnpm run test:scriptson Node 22: 83 of 83 test files pass.Not tested:
Related
Closes #1385. Refs #1341 (the spec). Stacked on #1414.
Review notes
Start with
packages/eql/crates/eql-codegen/src/py_eql.rs, then the generated_eql.py.The EQL workflow path filters do not list
_eql.py, the same as the Go fileeql_gen.go. A path outsidepackages/eql/would need a new exception in the guardeql-suite-ci.test.mjs. Instead,tests-python.ymlruns the parity tests, so a hand edit to_eql.pyfails the Python workflow.PassthroughandIgnoreinherit the attribute declarations fromMarker, but set no values. A type checker acceptsPassthrough.sql_domain, but it raisesAttributeErrorat run time.#1385 says 11 catalog types are unproducible. On the current base, only
Jsonis. The tests compare the Python and Go lists and assume no count.🤖 Generated with Claude Code