Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: single entrypoint for backend via dependency injection #1537

Open
wants to merge 269 commits into
base: 1.0.0-pre
Choose a base branch
from

Conversation

norton120
Copy link
Collaborator

It is very hard to test app code without having good hooks for the state (ie database). The goal is to add top-down hooks for the database connection.

Def of Done:

  • All server entrypoints support dependency injected db_sessions and avoid creating their own sessions internally

How to test
The test suite should now be able to pass db_session and use atomic databases/schemas for every test function!

Have you tested this PR?
Part of the V1 will be slowly moving to tests we strongly believe in.

Related issues or PRs
#1533

Is your PR over 500 lines of code?
yep these are big refactors

Additional context
I'll add looms to expand on this pattern as we go.

@norton120 norton120 mentioned this pull request Jul 19, 2024

# Parse request
# TODO: don't just use JSON in the future
human_name = request.config["human_name"] if "human_name" in request.config else None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sarahwooders I'm bringing this over but all of this should be part of the schema - I can merge your branch into this one and use AgentCreate (I think that's what you said it'll be called) instead of this, or we can just reconcile during the merge into v1

norton120 and others added 26 commits July 22, 2024 15:23
…ly fine, fastapi response types need them actually loaded before runtime :(
now on to the fun part, swapping in that scoped server
via conftest. This is where all the deep bugs will
come out.

Here. We. Go.
https://c.tenor.com/x-FL-l7ERS4AAAAC/tenor.gif
@sarahwooders sarahwooders marked this pull request as ready for review August 17, 2024 03:06
@sarahwooders sarahwooders self-requested a review August 17, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

Successfully merging this pull request may close these issues.

9 participants