Skip to content

Speed up cached devcontainer responses#2

Open
thecooltimv-bit wants to merge 1 commit into
nibzard:mainfrom
thecooltimv-bit:speed-up-cached-devcontainer-responses
Open

Speed up cached devcontainer responses#2
thecooltimv-bit wants to merge 1 commit into
nibzard:mainfrom
thecooltimv-bit:speed-up-cached-devcontainer-responses

Conversation

@thecooltimv-bit

Copy link
Copy Markdown

/claim #24

Summary

This PR speeds up repeated /generate requests for repositories that already have a stored devcontainer result in the database.

Previously, the route checked whether the URL existed in the database, but still fetched repository context before returning the cached result. That meant cached database hits still paid the cost of unnecessary repository-context work.

This change adds an early cached-response fast path before fetching repo context when:

  • the URL already exists in the database
  • an existing record is available
  • regenerate is not requested

It also narrows the Supabase select in check_url_exists() to only the fields needed for the cached response.

Changes

  • Return cached database records before calling fetch_repo_context()
  • Avoid selecting unnecessary fields from Supabase for the cache check
  • Add regression coverage proving repo context is not fetched on cached hits
  • Add coverage for the narrowed Supabase select query

Tests

Ran:

py -m pytest tests/test_cached_database_short_circuit.py tests/test_check_url_exists_query.py -q

Result:

2 passed, 1 warning

@thecooltimv-bit

Copy link
Copy Markdown
Author

The targeted regression tests pass locally:

py -m pytest tests/test_cached_database_short_circuit.py tests/test_check_url_exists_query.py -q

Result: 2 passed, 1 warning.

The failing checks appear to be Continuous AI agent errors rather than test failures from this patch. Happy to adjust if there is a specific maintainer-requested change.

1 similar comment
@thecooltimv-bit

Copy link
Copy Markdown
Author

The targeted regression tests pass locally:

py -m pytest tests/test_cached_database_short_circuit.py tests/test_check_url_exists_query.py -q

Result: 2 passed, 1 warning.

The failing checks appear to be Continuous AI agent errors rather than test failures from this patch. Happy to adjust if there is a specific maintainer-requested change.

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.

1 participant