Skip to content

Authenticate the stats database before migration #973

Description

@bcdonadio

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.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

High

Effort

None yet

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions