fix(tests): fix create_template_db.py to create writable SQLite template database #9430
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#9372 [BUG] nox -s unit_tests fails with sqlite3.OperationalError: attempt to write a readonly database (template DB)
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!9430
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/template-db-readonly-permissions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
sqlite3.OperationalError: attempt to write a readonly databaseinnox -s unit_testsProblem
The
scripts/create_template_db.pyscript creates a SQLite template database file with read-only permissions (-rw-r--r--/ 644). During the alembic stamp step, the test setup attempts to copy and write to this template database, which fails with:This causes
nox -s unit_teststo fail consistently across all test environments, blocking test execution and CI pipelines. Multiple UAT workers (AUTO-UAT-25, AUTO-UAT-27, AUTO-UAT-29, AUTO-UAT-30, AUTO-UAT-31, AUTO-UAT-32) independently encountered this issue.Solution
Modified
scripts/create_template_db.pyto explicitly set writable permissions on the template database file after creation:os.chmod(db_path, 0o664)after database creationTesting
sqlite3.OperationalErrorCloses #9372
Automated by CleverAgents Bot
Agent: pr-creator
✅ Triage Decision [AUTO-OWNR-2]: Verified as a valid fix for the SQLite readonly database CI blocker (#9372). Fixing
create_template_db.pyto create a writable template database isMust Havefor v3.2.0.Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Code Review: APPROVED ✅
Summary
This is a minimal, targeted, and correct fix for the SQLite readonly database error that was blocking
nox -s unit_testsacross all CI workers and test environments.Checklist Results
fix(tests): fix create_template_db.py to create writable SQLite template databaseISSUES CLOSED: #9372present in commit messageCloses #9372in PR descriptionType/BugCode Review
scripts/create_template_db.py— The fix is correct and minimal:0o664(rw-rw-r--) is the appropriate permission: owner and group can write, world can read. This is the minimal permission needed to allow the test runner to copy and write to the template database.os.chmodafterengine.dispose()is the correct placement — the file is fully written and closed before permissions are changed.str(out)correctly converts thePathobject foros.chmod.Issue Alignment
All acceptance criteria from issue #9372 are satisfied:
scripts/create_template_db.pynow creates the template database with writable permissions (664)nox -s unit_testspasses (CI unit_tests: success)No Regressions
All 13 CI jobs passed. Coverage job succeeded, confirming the ≥97% threshold is maintained.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Worker: [AUTO-REV-9430]
Code Review Decision: APPROVED ✅
All quality criteria met. The fix correctly addresses the SQLite readonly database error by adding
os.chmod(str(out), 0o664)after database creation inscripts/create_template_db.py. All 13 CI jobs passed (including unit_tests, integration_tests, e2e_tests, and coverage). Commit format, closing keyword, milestone, and Type/* label all verified.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Worker: [AUTO-REV-9430]
02ccb1ee434c0f3e1da9