docs(codecs): thread the connection config in the SchemaCodec example - #1549
Open
MilagrosMarin wants to merge 1 commit into
Open
docs(codecs): thread the connection config in the SchemaCodec example#1549MilagrosMarin wants to merge 1 commit into
MilagrosMarin wants to merge 1 commit into
Conversation
The subclass example omitted config= on both _build_path and _get_backend, so a codec written from it resolves its store against the module-level dj.config instead of the calling connection's. In a process holding connections for several users that config belongs to none of them, and on a pod with no ambient credentials it belongs to nothing at all. The built-in object and npy codecs already read key["_config"] and pass it to both helpers; the example now shows the same, and a note above it says why. The example also omitted store_name on _build_path, which is where partition and prefix settings come from. Docs only: the executable AST is unchanged.
ttngu207
approved these changes
Sep 3, 2026
ttngu207
left a comment
Contributor
There was a problem hiding this comment.
Approve. Docstring change to the SchemaCodec example that also fixes an omission the plugin bugs didn't happen to hit — the example was missing store_name= on _build_path, which is where partition and prefix settings come from.
Your own note nails the follow-up: "having _get_backend accept key= and read _config itself would remove the trap rather than document around it." Documenting around a trap only helps the next codec author who reads the docstring. Worth filing a separate issue against this repo to change the SchemaCodec._get_backend / _build_path signatures to read _config off key= themselves, so a third-party codec can't silently drop it again. Happy to open that follow-up if you'd like.
dimitri-yatsenko
approved these changes
Sep 3, 2026
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.
The
SchemaCodecclass docstring'sExample::block omitsconfig=on both_build_pathand_get_backend, so a codec written from it resolves its store against the module-leveldj.configrather than the calling connection's. Where a caller holds connections with different store configurations, that config belongs to none of them — the codec either reads the wrong store or, if the global spec carries no usable credentials, fails validation.The built-in
objectandnpycodecs already readkey["_config"]and pass it to both helpers. The example now shows the same, with a note above it explaining why. It also omittedstore_nameon_build_path, which is where partition and prefix settings come from.Docs only — the executable AST is unchanged.
Worth considering separately: having
_get_backendacceptkey=and read_configitself would remove the trap rather than document around it. That's an API change, so it isn't here.