internal/datadir/lock.go creates the data directory at 0750 via its own dirPerm constant, and internal/database/database.go has a separate dataDirPerm = 0750. Two constants, one policy, in two packages that both create the same directory.
They agree today. The hazard is that nothing makes them agree tomorrow — a change to one is invisible from the other, and the resulting mismatch would be a permissions bug that only appears depending on which package happened to create the directory first.
Surfaced during #255, which tightened the database FILE modes and deliberately left the directory alone. Kept out of that PR to avoid widening it.
Definition of done:
One exported constant, one owner for the directory mode; the other package consumes it.
Decide which package legitimately owns "how the data directory is created" and say why. internal/datadir is the obvious candidate given its name, but check whether the dependency direction allows it before committing to that.
A test that would fail if a second definition reappeared, or a comment at the constant naming it as the single source — whichever is more likely to survive.
Not milestoned: no behaviour is wrong today, and the fix is a consolidation rather than a repair.
`internal/datadir/lock.go` creates the data directory at `0750` via its own `dirPerm` constant, and `internal/database/database.go` has a separate `dataDirPerm = 0750`. Two constants, one policy, in two packages that both create the same directory.
They agree today. The hazard is that nothing makes them agree tomorrow — a change to one is invisible from the other, and the resulting mismatch would be a permissions bug that only appears depending on which package happened to create the directory first.
Surfaced during https://git.eeqj.de/sneak/webhooker/issues/255, which tightened the database FILE modes and deliberately left the directory alone. Kept out of that PR to avoid widening it.
Definition of done:
- One exported constant, one owner for the directory mode; the other package consumes it.
- Decide which package legitimately owns "how the data directory is created" and say why. `internal/datadir` is the obvious candidate given its name, but check whether the dependency direction allows it before committing to that.
- A test that would fail if a second definition reappeared, or a comment at the constant naming it as the single source — whichever is more likely to survive.
Not milestoned: no behaviour is wrong today, and the fix is a consolidation rather than a repair.
Consolidated the data directory mode into a single owner. internal/datadir now exports DirPerm (formerly its unexported dirPerm), and internal/database consumes it in both places it creates the directory, dropping its own dataDirPerm. datadir owns it because creating and guarding DATA_DIR is its purpose, and it imports only the standard library and the flock package, so database depending on it adds no cycle. A comment on DirPerm marks it the single source rather than a source-scanning test. The mode value is unchanged.
Consolidated the data directory mode into a single owner. `internal/datadir` now exports `DirPerm` (formerly its unexported `dirPerm`), and `internal/database` consumes it in both places it creates the directory, dropping its own `dataDirPerm`. `datadir` owns it because creating and guarding `DATA_DIR` is its purpose, and it imports only the standard library and the flock package, so `database` depending on it adds no cycle. A comment on `DirPerm` marks it the single source rather than a source-scanning test. The mode value is unchanged.
PR: https://git.eeqj.de/sneak/webhooker/pulls/318
Model: opus-4-8
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
internal/datadir/lock.gocreates the data directory at0750via its owndirPermconstant, andinternal/database/database.gohas a separatedataDirPerm = 0750. Two constants, one policy, in two packages that both create the same directory.They agree today. The hazard is that nothing makes them agree tomorrow — a change to one is invisible from the other, and the resulting mismatch would be a permissions bug that only appears depending on which package happened to create the directory first.
Surfaced during #255, which tightened the database FILE modes and deliberately left the directory alone. Kept out of that PR to avoid widening it.
Definition of done:
internal/datadiris the obvious candidate given its name, but check whether the dependency direction allows it before committing to that.Not milestoned: no behaviour is wrong today, and the fix is a consolidation rather than a repair.
Consolidated the data directory mode into a single owner.
internal/datadirnow exportsDirPerm(formerly its unexporteddirPerm), andinternal/databaseconsumes it in both places it creates the directory, dropping its owndataDirPerm.datadirowns it because creating and guardingDATA_DIRis its purpose, and it imports only the standard library and the flock package, sodatabasedepending on it adds no cycle. A comment onDirPermmarks it the single source rather than a source-scanning test. The mode value is unchanged.PR: #318
Model: opus-4-8