[AUTO-INF-1] Fix: Integration tests fail due to read-only SQLite template DB #8034

Closed
opened 2026-04-13 00:57:50 +00:00 by HAL9000 · 2 comments
Owner

Metadata

  • Commit Message: fix(nox): set template DB permissions to 0o644 after creation
  • Branch: fix/auto-inf-1-template-db-permissions

Background and Context

Integration tests and coverage reporting are failing due to a read-only SQLite template database issue. The nox sessions for unit_tests, integration_tests, and coverage_report call _create_template_db() in noxfile.py, which runs scripts/create_template_db.py to produce a pre-migrated SQLite file at build/.template-migrated.db. Each test scenario then copies this template instead of running all Alembic migrations from scratch.

However, the template database is being created with read-only permissions in certain CI environments. The scripts/create_template_db.py script does not explicitly set file permissions on the created database, so the file inherits the umask of the process. In restrictive CI environments (e.g., umask 0o222 or 0o177), the resulting file is read-only, causing all test sessions that attempt to copy and write to it to fail.

The affected sessions are:

  • unit_tests
  • integration_tests
  • coverage_report
  • Any other session that calls _create_template_db() (currently 5 call sites in noxfile.py)

Expected Behavior

The template database at build/.template-migrated.db is always created with at least user-write permissions (0o644) regardless of the CI environment's umask. All nox sessions that depend on the template DB succeed without read-only filesystem errors.

Acceptance Criteria

  • _create_template_db() in noxfile.py explicitly sets the template DB file permissions to 0o644 immediately after creation via Path(template_path).chmod(0o644).
  • Running nox -s integration_tests in a CI environment with a restrictive umask (e.g., umask 0o222) no longer fails with a read-only database error.
  • Running nox -s coverage_report completes successfully end-to-end.
  • No existing tests are broken by this change.

Subtasks

  • Read and understand the current _create_template_db() function in noxfile.py (lines 69–84).
  • Add Path(template_path).chmod(0o644) after the session.run(...) call in _create_template_db().
  • Verify the Path import is already present at the top of noxfile.py (it is — used on line 77).
  • Run nox -s unit_tests locally to confirm no regressions.
  • Run nox -s integration_tests locally to confirm the template DB is writable.
  • Verify coverage ≥ 97% via nox -s coverage_report.
  • Run full nox (all default sessions) and fix any errors.

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches fix(nox): set template DB permissions to 0o644 after creation exactly, followed by a blank line, then additional lines providing relevant implementation details.
  • The commit is pushed to the remote on the branch fix/auto-inf-1-template-db-permissions.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit Message**: `fix(nox): set template DB permissions to 0o644 after creation` - **Branch**: `fix/auto-inf-1-template-db-permissions` ## Background and Context Integration tests and coverage reporting are failing due to a read-only SQLite template database issue. The `nox` sessions for `unit_tests`, `integration_tests`, and `coverage_report` call `_create_template_db()` in `noxfile.py`, which runs `scripts/create_template_db.py` to produce a pre-migrated SQLite file at `build/.template-migrated.db`. Each test scenario then copies this template instead of running all Alembic migrations from scratch. However, the template database is being created with read-only permissions in certain CI environments. The `scripts/create_template_db.py` script does not explicitly set file permissions on the created database, so the file inherits the `umask` of the process. In restrictive CI environments (e.g., `umask 0o222` or `0o177`), the resulting file is read-only, causing all test sessions that attempt to copy and write to it to fail. The affected sessions are: - `unit_tests` - `integration_tests` - `coverage_report` - Any other session that calls `_create_template_db()` (currently 5 call sites in `noxfile.py`) ## Expected Behavior The template database at `build/.template-migrated.db` is always created with at least user-write permissions (`0o644`) regardless of the CI environment's `umask`. All `nox` sessions that depend on the template DB succeed without read-only filesystem errors. ## Acceptance Criteria - [ ] `_create_template_db()` in `noxfile.py` explicitly sets the template DB file permissions to `0o644` immediately after creation via `Path(template_path).chmod(0o644)`. - [ ] Running `nox -s integration_tests` in a CI environment with a restrictive `umask` (e.g., `umask 0o222`) no longer fails with a read-only database error. - [ ] Running `nox -s coverage_report` completes successfully end-to-end. - [ ] No existing tests are broken by this change. ## Subtasks - [ ] Read and understand the current `_create_template_db()` function in `noxfile.py` (lines 69–84). - [ ] Add `Path(template_path).chmod(0o644)` after the `session.run(...)` call in `_create_template_db()`. - [ ] Verify the `Path` import is already present at the top of `noxfile.py` (it is — used on line 77). - [ ] Run `nox -s unit_tests` locally to confirm no regressions. - [ ] Run `nox -s integration_tests` locally to confirm the template DB is writable. - [ ] Verify coverage ≥ 97% via `nox -s coverage_report`. - [ ] Run full `nox` (all default sessions) and fix any errors. ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches `fix(nox): set template DB permissions to 0o644 after creation` exactly, followed by a blank line, then additional lines providing relevant implementation details. - The commit is pushed to the remote on the branch `fix/auto-inf-1-template-db-permissions`. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.2.0 milestone 2026-04-13 01:27:49 +00:00
Author
Owner

Verified — This is a critical infrastructure bug. Integration tests failing due to read-only SQLite template DB blocks all development and CI. Classified as MoSCoW/Must Have with Priority/Critical for v3.2.0. The fix is straightforward (chmod 0o644 after creation) and must be implemented immediately.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-1]

✅ **Verified** — This is a critical infrastructure bug. Integration tests failing due to read-only SQLite template DB blocks all development and CI. Classified as **MoSCoW/Must Have** with **Priority/Critical** for v3.2.0. The fix is straightforward (chmod 0o644 after creation) and must be implemented immediately. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-1]
Owner

superseded by next cycle

superseded by next cycle
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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