Observed behavior: queryProjectStats opens the project database directly with new DatabaseSync(dbPath) and then runs LCM migrations without authenticating the database parent directory through the existing private-directory boundary.
Expected behavior: Stats should authenticate the project database directory and its relevant parent identity before opening or migrating SQLite, consistent with the repository's other project-storage entry points.
Root cause: The stats path has an independent raw DatabaseSync entry point that bypasses centralized connection and directory-authentication helpers.
How to reproduce: Inspect src/stats.ts near queryProjectStats, or invoke it against a private synthetic project whose database parent is replaced by a symlink before the open. The current path opens the pathname directly and runs migrations without a retained directory witness.
Environment:
- Agent: Codex campaign planning review
- Connector: repository static analysis
- OS: Fedora Linux
Discovered during Epic #968 Bug #935 plan review. This stats-specific entry point is distinct from #935's pooled and event database consumers and is outside frozen S0.
Observed behavior:
queryProjectStatsopens the project database directly withnew DatabaseSync(dbPath)and then runs LCM migrations without authenticating the database parent directory through the existing private-directory boundary.Expected behavior: Stats should authenticate the project database directory and its relevant parent identity before opening or migrating SQLite, consistent with the repository's other project-storage entry points.
Root cause: The stats path has an independent raw
DatabaseSyncentry point that bypasses centralized connection and directory-authentication helpers.How to reproduce: Inspect
src/stats.tsnearqueryProjectStats, or invoke it against a private synthetic project whose database parent is replaced by a symlink before the open. The current path opens the pathname directly and runs migrations without a retained directory witness.Environment:
Discovered during Epic #968 Bug #935 plan review. This stats-specific entry point is distinct from #935's pooled and event database consumers and is outside frozen S0.