TEST-INFRA: [ci-execution-time] Cache the pre-migrated template database #4422

Open
opened 2026-04-08 12:29:59 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Branch: task/ci-execution-time-cache-template-db
  • Commit Message: perf(ci): cache pre-migrated template database to avoid redundant rebuilds across CI runs
  • Milestone: N/A — backlog (see note below)
  • Parent Epic: #1678

Backlog note: This issue was discovered during autonomous operation
on milestone v3.8.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Overview

The _create_template_db function in noxfile.py is a clever optimization that creates a pre-migrated SQLite database to be used by the tests. This avoids running all the database migrations for each test run.

However, this function is called in multiple nox sessions (unit_tests, integration_tests, slow_integration_tests, e2e_tests), and the resulting database file is not cached between CI runs. This means that the template database is rebuilt from scratch in every CI run.

This proposal suggests caching the output of the _create_template_db function and reusing it across different nox sessions and CI runs. This would save a small amount of time in each CI run.

Subtasks

  • Investigate how to cache the build/.template-migrated.db file in the CI pipeline.
  • Update the noxfile.py to check for the existence of the cached file before running _create_template_db.
  • Ensure that the cache is properly invalidated when the database schema changes (e.g., keyed on a hash of migration files).
  • Update features/ci_workflow_validation.feature to assert the cache step is present (if applicable).
  • Verify all nox stages pass after changes.

Definition of Done

  • The build/.template-migrated.db file is cached and reused across CI runs.
  • The _create_template_db function is only called when the cached file is not available or is outdated.
  • Cache invalidation is triggered by changes to the database schema/migrations.
  • The CI pipeline continues to work correctly.
  • All nox stages pass.
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: new-issue-creator

## Metadata - **Branch**: `task/ci-execution-time-cache-template-db` - **Commit Message**: `perf(ci): cache pre-migrated template database to avoid redundant rebuilds across CI runs` - **Milestone**: N/A — backlog (see note below) - **Parent Epic**: #1678 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.8.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Overview The `_create_template_db` function in `noxfile.py` is a clever optimization that creates a pre-migrated SQLite database to be used by the tests. This avoids running all the database migrations for each test run. However, this function is called in multiple nox sessions (`unit_tests`, `integration_tests`, `slow_integration_tests`, `e2e_tests`), and the resulting database file is not cached between CI runs. This means that the template database is rebuilt from scratch in every CI run. This proposal suggests caching the output of the `_create_template_db` function and reusing it across different nox sessions and CI runs. This would save a small amount of time in each CI run. ## Subtasks - [ ] Investigate how to cache the `build/.template-migrated.db` file in the CI pipeline. - [ ] Update the `noxfile.py` to check for the existence of the cached file before running `_create_template_db`. - [ ] Ensure that the cache is properly invalidated when the database schema changes (e.g., keyed on a hash of migration files). - [ ] Update `features/ci_workflow_validation.feature` to assert the cache step is present (if applicable). - [ ] Verify all nox stages pass after changes. ## Definition of Done - [ ] The `build/.template-migrated.db` file is cached and reused across CI runs. - [ ] The `_create_template_db` function is only called when the cached file is not available or is outdated. - [ ] Cache invalidation is triggered by changes to the database schema/migrations. - [ ] The CI pipeline continues to work correctly. - [ ] All nox stages pass. - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: new-issue-creator
HAL9000 self-assigned this 2026-04-08 12:32:25 +00:00
HAL9000 added this to the v3.5.0 milestone 2026-04-08 17:42:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#4422
No description provided.