Fix DataLayer injection in initialize_examples and fix encryption.md headings#314
Fix DataLayer injection in initialize_examples and fix encryption.md headings#314ahouseholder merged 2 commits intoplanning-nextfrom
Conversation
…n.md headings Co-authored-by: ahouseholder <2594236+ahouseholder@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Fixes a dependency-injection mismatch where reset_datalayer(init=True) could repopulate example data into the global TinyDB singleton instead of the injected DataLayer, and cleans up notes/encryption.md to satisfy markdownlint heading/list rules.
Changes:
- Update
initialize_examples()to accept an optional injectedDataLayerand only fall back toget_datalayer()when none is provided. - Pass the injected
datalayerthrough from thereset_datalayerrouter wheninit=True. - Convert plaintext section labels in
notes/encryption.mdinto proper Markdown headings and adjust spacing to address markdownlint failures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| vultron/as_vocab/examples/_base.py | Adds optional DataLayer parameter to initialize_examples() for DI-friendly example initialization. |
| vultron/api/v2/routers/datalayer.py | Ensures reset endpoint initializes examples into the injected datalayer instance. |
| notes/encryption.md | Replaces section labels with Markdown headings and fixes list spacing for markdownlint compliance. |
| from vultron.as_vocab.examples._base import initialize_examples | ||
|
|
||
| initialize_examples() | ||
| initialize_examples(datalayer=datalayer) |
There was a problem hiding this comment.
The init=True branch behavior was changed here (examples now initialized into the injected datalayer). There doesn't appear to be coverage for DELETE /datalayer/reset/?init=true, and this bug would only show up when the dependency injects a non-singleton DataLayer instance. Please add a regression test that overrides the FastAPI dependency to return a separate DataLayer instance (not created via get_datalayer()), calls the reset endpoint with init=true, and asserts the example objects were created in that injected instance (and not in the global singleton).
reset_datalayer(init=True)was reinitializing examples against a potentially different backend than the one it just cleared —initialize_examples()fetched its ownget_datalayer()singleton internally, bypassing any injected/overriddenDataLayer.notes/encryption.mdalso used plain-text section labels instead of Markdown headings, causing markdownlint MD022/MD032 failures.Changes
vultron/as_vocab/examples/_base.py:initialize_examples()now acceptsdatalayer: DataLayer | None = None; falls back toget_datalayer()only when no instance is provided.vultron/api/v2/routers/datalayer.py:reset_datalayerpasses its injecteddatalayerthrough toinitialize_examples(datalayer=datalayer).notes/encryption.md: Converted plain-text section labels to##headings; added required blank lines before lists.Please note: Pull request submissions are subject to our
Contribution Instructions
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.