Skip to content

Fix audit task DB connection leaks in E2E runs#7827

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-e2e-tests-private-cloud
Closed

Fix audit task DB connection leaks in E2E runs#7827
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-e2e-tests-private-cloud

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to https://github.com/Flagsmith/flagsmith/actions/runs/27771948370/job/82174969654

Investigated the failing private-cloud E2E run and traced it to create_audit_log_from_historical_record tasks opening database connections in separate threads without releasing them. During the project permissions test this exhausted Postgres connections and caused the UI assertions to fail.

This PR closes Django database connections in that audit task when it runs via SEPARATE_THREAD, and adds unit coverage for both the success path and exception path.

How did you test this code?

  • cd /home/runner/work/flagsmith/flagsmith/api && make test opts='tests/unit/audit/test_unit_audit_tasks.py -n0'
  • cd /home/runner/work/flagsmith/flagsmith/api && uv run pre-commit run --files audit/tasks.py tests/unit/audit/test_unit_audit_tasks.py
  • codeql_checker (0 alerts)
  • Attempted to run the failing Playwright test locally, but the sandbox could not resolve cgr.dev while building the API image for frontend/docker-compose-e2e-tests.yml.

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 18, 2026 4:41pm
flagsmith-frontend-preview Ignored Ignored Preview Jun 18, 2026 4:41pm
flagsmith-frontend-staging Ignored Ignored Preview Jun 18, 2026 4:41pm

Request Review

@github-actions github-actions Bot added the api Issue related to the REST API label Jun 18, 2026
@khvn26

khvn26 commented Jun 18, 2026

Copy link
Copy Markdown
Member

I'm fascinated by how copilot sees red CI and just... stops.

Like, Github, it's your own freaking product goddammit. Other harnesses suffer from lack of feedback, but you provide tons of your own via CI...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants