Core is small infrastructure with a wide blast radius. Keep changes narrow, forward-compatible, and easy to audit.
- Branch from
dev. - Add a new ordered migration instead of rewriting an applied one.
- Update SQL contract tests and documentation when behavior or grants change.
- Run
./bin/test.shand validate both Compose manifests. - Open a pull request back to
devwith migration, compatibility, and rollback notes.
Releases are merged from dev to main and tagged on main. See
Versioning and Release process.
- Never renumber, delete, or edit a migration that may have reached a shared environment. Add the next sequential file.
- Keep DDL bounded with
lock_timeoutandstatement_timeoutwhere it may wait on production objects. - Make a migration safe to apply exactly once through the ledger. Use idempotent DDL where it also improves recovery and review.
- Keep every
SECURITY DEFINERfunction on a fixed safesearch_path, revoke execution fromPUBLIC, and grant only the required roles. - Do not add secrets, raw tokens, query text, private URLs, Telegram user data, or production samples to migrations, fixtures, tests, logs, or documentation.
- Describe the compatible application versions and operational rollback. Schema rollback is not assumed.
- Clean install succeeds.
- Re-running the migrator skips applied versions safely.
- Upgrade from the previous release succeeds.
- Least-privilege roles cannot bypass their function API.
- New indexes support queue, expiry, and lease access paths.
- Changelog and release notes call out contract or deployment changes.