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 |
5 tasks
`@stackencrypt.model("users")` reads a class's fields when the class is
defined. A field without exactly one stash marker raises
`DeclarationError` at the class statement. It works with dataclasses,
attrs, Pydantic, `NamedTuple`, and SQLAlchemy classes.
`DECLARATION_MARKER_NOT_OUTERMOST` is a new error code, for a marker in
the wrong place. The spec's `DECLARATION_NOT_OUTERMOST` moves to #1387.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codes such as `declaration_no_marker` and the reason `rule_a` follow the amendment on #1341. 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
yujiyokoo
force-pushed
the
feat/python-sdk-declaration-reader
branch
from
October 29, 2026 07:06
905205f to
2d76b18
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 marks a class as a model with
@stackencrypt.model("users"). The decorator now reads the class's fields when the class is defined. A field without exactly one stash marker raisesDeclarationErrorat the class statement, so the developer sees the mistake where they wrote it.A stash marker says how a field is stored.
TextEqencrypts it,Passthroughstores it as it is, andIgnoreleaves it out.Changes
_declaration.py: themodeldecorator and the field reader._errors.py:StashErrorandDeclarationError.NamedTuple, and SQLAlchemy classes. Each test runs twice, with and withoutfrom __future__ import annotations.pyproject.toml: attrs, Pydantic, and SQLAlchemy join thetestextra only. The package itself imports none of them.Verification
mise run test: 113 passed and 2 skipped, on Python 3.14.mypy --strictpasses. pyright reports 0 errors.pnpm run test:scripts: 83 test files pass.Related
Closes #1386. Part of #1341.
Review notes
DECLARATION_MARKER_NOT_OUTERMOSTis a new error code, for a marker in the wrong place, such asAnnotated[Mapped[str], TextEq]. The spec'sDECLARATION_NOT_OUTERMOSTstays for the decorator order. The constructor check in python: declaration meaning — type table, hints, engine check, constructor #1387 finds that.🤖 Generated with Claude Code