Skip to content

Fix DataLayer injection in initialize_examples and fix encryption.md headings#314

Merged
ahouseholder merged 2 commits intoplanning-nextfrom
copilot/sub-pr-313
Mar 6, 2026
Merged

Fix DataLayer injection in initialize_examples and fix encryption.md headings#314
ahouseholder merged 2 commits intoplanning-nextfrom
copilot/sub-pr-313

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

reset_datalayer(init=True) was reinitializing examples against a potentially different backend than the one it just cleared — initialize_examples() fetched its own get_datalayer() singleton internally, bypassing any injected/overridden DataLayer. notes/encryption.md also used plain-text section labels instead of Markdown headings, causing markdownlint MD022/MD032 failures.

Changes

  • vultron/as_vocab/examples/_base.py: initialize_examples() now accepts datalayer: DataLayer | None = None; falls back to get_datalayer() only when no instance is provided.
  • vultron/api/v2/routers/datalayer.py: reset_datalayer passes its injected datalayer through to initialize_examples(datalayer=datalayer).
  • notes/encryption.md: Converted plain-text section labels to ## headings; added required blank lines before lists.
# Before: always used the singleton, ignoring injected datalayer
def initialize_examples() -> None:
    dl = get_datalayer()
    ...

# After: uses the provided instance when available
def initialize_examples(datalayer: DataLayer | None = None) -> None:
    dl = datalayer if datalayer is not None else get_datalayer()
    ...

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.

…n.md headings

Co-authored-by: ahouseholder <2594236+ahouseholder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 6, 2026

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:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update documentation and refactor implementation guidance Fix DataLayer injection in initialize_examples and fix encryption.md headings Mar 6, 2026
@ahouseholder ahouseholder marked this pull request as ready for review March 6, 2026 18:19
@ahouseholder ahouseholder self-requested a review as a code owner March 6, 2026 18:19
Copilot AI review requested due to automatic review settings March 6, 2026 18:19
@ahouseholder ahouseholder merged commit 8d18b1b into planning-next Mar 6, 2026
3 checks passed
@ahouseholder ahouseholder deleted the copilot/sub-pr-313 branch March 6, 2026 18:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 injected DataLayer and only fall back to get_datalayer() when none is provided.
  • Pass the injected datalayer through from the reset_datalayer router when init=True.
  • Convert plaintext section labels in notes/encryption.md into 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.

Comment on lines 203 to +205
from vultron.as_vocab.examples._base import initialize_examples

initialize_examples()
initialize_examples(datalayer=datalayer)
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants