feat: add the encryption attribute to the CoreArtifact protocols
The generated CoreArtifact protocols lack the encryption attribute that Infrahub PR #11561 adds.
Adds it to the sync and async classes, as the Infrahub generator renders it.
Review: the base branch, and that the Infrahub PR needs this merged before its pointer bump.
Why
opsmill/infrahub#11561 adds a read-only encryption attribute to CoreArtifact: plaintext, encrypted or unreadable. The Infrahub job backend-validate-generated fails while protocols.py differs from the generated output, and typed code cannot read the attribute.
Base branch: infrahub-develop, the branch for changes that need the next Infrahub version. The Infrahub PR can bump its python_sdk pointer only after this is merged.
What changed
infrahub_sdk/protocols.py:encryption: StringinCoreArtifactandCoreArtifactSync. The kind isString, not optional, because the attribute has a default.changelog/+core-artifact-encryption-protocol.added.md: changelog entry.- The file header says not to edit it by hand. The two lines are the output of
uv run invoke backend.generatein the Infrahub repository. A regeneration changes nothing.
How to test
# In opsmill/infrahub on the branch of PR #11561:
uv run invoke backend.generate
git -C python_sdk diff infrahub_sdk/protocols.py # shows the 2 lines of this PR
- The reviewer rendered the file again with the Infrahub generator and compared it with this file: identical.
ruff checkandruff format --checkpass on the file.
Impact & rollout
- Backward compatibility: none broken. Code that reads
artifact.encryptionraisesAttributeErroragainst a server without the attribute, so this belongs oninfrahub-developonly.
Not done or not verified
- Not run: the SDK test suite,
towncrier build --draftand the SDK CI. - Not known: the Infrahub version that ships the attribute. The changelog entry does not name one.
Code review
The code-review skill ran at level high on the uncommitted change, by an agent other than the author. The agent also compared the file with the generator output.
| Critical | Important | Minor |
|---|---|---|
| 0 | 1 | 3 |
- Important:
encryptionexists only on an Infrahub branch that is not merged, so released SDK code could meet a server without it. Kept: the base isinfrahub-develop, which holds changes that need the next Infrahub version. - Minor, left as they are: the changelog entry names no Infrahub version; the protocol type does not mark the attribute as read-only, as for the other read-only attributes; the manual edit versus the header, explained above.
Security review
The security-review skill reads only commits, so the agent reviewed the change by hand with the skill's method. Agent other than the author. High 0, Medium 0, Low 0.
Dropped after checks: runtime use of the annotations (none found), the meaning of the value for callers, and the wording "read-only".
Checklist
- Tests added/updated
- Changelog entry added (
uv run towncrier create ...) - External docs updated (if user-facing or ops-facing change)
- Internal .md docs updated (internal knowledge and AI code tools knowledge)