Commit Graph

36 Commits

Author SHA1 Message Date
61861ff170 fix: linux-devshell from root 2026-05-01 22:56:03 +00:00
35e35980b4 test: fix: . 2026-05-01 22:19:43 +00:00
d5d4d5a5c3 test: arch 2026-05-01 21:40:54 +00:00
ff0766519c test: linux-devshell 2026-05-01 21:13:15 +00:00
1a209f6960 test(postgres-hooks): retarget hectic bundle tests to migrator init + db-tool hydrate
Move postgres-init-hectic-inheritance test (13 cases) to
migrator/init-hectic-bundle since the bundle is now applied by `migrator init`
instead of `postgres-init`. Drop init-migrator-with-inherits since
`--inherits` is now a deprecation warning, not an error. Add db-tool
hydrate-hook test (5 cases) covering --no-hook skip, default apply,
idempotency, and HECTIC_DOTENV_FILE. Augment init-migrator with
hectic.version and hectic.secret table assertions.
2026-04-30 22:12:09 +00:00
2eaa568f5b feat(db-tool): hectic-inheritance: add hectic.immutable + diff coverage
Add a hectic.immutable parent table. Tables inheriting it get auto-attached
BEFORE INSERT/UPDATE/DELETE/TRUNCATE row+statement triggers that block DML
unless the session sets hectic.migration_mode='on' (intended use: SET LOCAL
inside a migration transaction). Same exemptions as the rest of the bundle
apply (hectic schema, partitions, temp tables, GUC-excluded schemas).

database diff now appends an --- IMMUTABLE TABLE DATA --- section to its
output, with per-table unified row diffs of every table inheriting
hectic.immutable, surfacing drift in 'frozen' reference data alongside schema
drift. Subcommand exits non-zero when either schema or data differs.

Test postgres-init-hectic-inheritance extended to 10 cases covering
immutable triggers, DML blocked outside migration_mode, SET LOCAL allowing
DML inside a transaction, GUC not leaking past COMMIT, and TRUNCATE under
migration_mode.
2026-04-30 16:10:38 +00:00
58e9aa8fad feat(db-tool): hectic-inheritance: bootstrap hectic.created_at / hectic.updated_at inheritance hook
Adds a SQL bundle plus event triggers that enforce `INHERITS (hectic.created_at)`
on every user CREATE TABLE and auto-attach a BEFORE UPDATE row trigger when a
table inherits `hectic.updated_at`. Always-exempt: `hectic`, `information_schema`,
`pg_*`, declarative partitions, temp tables. Per-DB opt-out via the GUC
`hectic.inheritance_extra_excluded_schemas`.

Exposed three ways:
  * `pkgs.hectic.hectic-inheritance` — derivation with the SQL at
    $out/share/hectic/hectic-inheritance.sql
  * `self.lib.hecticInheritance.{sql,path}` — pkgs-free Nix surface
  * `postgres-init` opt-in via `PG_HECTIC_INHERITANCE=1` (HECTIC_INHERITANCE_SQL
    overrides the default)

Test postgres-init-hectic-inheritance covers all six branches: bootstrap,
non-inheriting reject, accepting inheritance, auto updated_at trigger fires,
GUC exclusion, declarative partition exemption.
2026-04-30 15:16:57 +00:00
7d5300853b fix(db-tool): postgres-init: createdb on reuse when target DB missing
Previously when PG_REUSE=1 and PG_VERSION existed but the target database had
never been successfully created (e.g. devshell exited mid-init in a prior run),
postgres-init skipped createdb and the subsequent psql connection failed with
'database "<db>" does not exist'.

Now on reuse path we probe pg_database and create the target DB if missing,
making postgres-init fully idempotent across stale-state recovery.

Adds postgres-init-reuse-missing-db test.
2026-04-30 12:16:09 +00:00
06a5d16ee3 fix(package): db-tool: call postgres-init/cleanup binaries instead of local devshell scripts
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-30 10:10:11 +00:00
b5dcbf08a1 feat(\db-tool\): introduce unified db-tool package with postgres harness and tests (T0-T8) 2026-04-30 09:06:44 +00:00
6035397e9b feat(sentinèlla): p2p topology with DNS peer discovery
- Replace central sentinel with watcher: each node polls peers discovered
  via a single DNS name with multiple A records (e.g. peers.sentinella.com)
- Auto-detect own IPs via hostname -I; SELF env var available as optional
  override for NAT/floating-IP setups
- Fix Basic Auth bug in router.sh: compare tok against AUTH_TOKENS instead
  of unset $USER/$PASS
- Rename sentinel binary to watcher; drop unused shellplot dep
- Add inetutils to watcher runtime deps for hostname -I
- Update NixOS module: replace sentinel options with watcher p2p options
  (peersDns, self, peersPort, peersScheme, pollingIntervalSec)
- Add sentinèlla test suite: probe-status-empty, probe-disk, watcher-state-file
2026-04-26 21:54:07 +00:00
577c167d5a feat: migrator: +multifiles migrations 2026-02-28 21:19:29 +00:00
d8a51cd389 refactor: update to 25.11 2026-02-20 17:18:38 +00:00
3d84864382 fix(package): migrator: sqlite transactions 2025-12-23 19:31:44 +00:00
686a794a69 fix(pakcage): migrator: -z -> +x 2025-12-23 18:18:51 +00:00
01f13723a8 feat(package): migrator: up to latest 2025-12-18 00:45:09 +00:00
956239ab79 feat(package): migrator: ! sqlite support 2025-12-17 03:24:59 +00:00
bb2ae34758 feat(package): migrator: mvp 2025-12-16 17:28:36 +00:00
13fdfac2ef test(hemar): update parser test to match better paths 2025-12-09 14:21:03 +00:00
6fb3ee1af8 test(hemar): many tests but not pass 2025-12-09 13:49:43 +00:00
73dc9aee9e feat(package): hemar: json_escape() 2025-12-09 03:47:27 +00:00
373a3fe3f0 fix(package): migrator: index_of subshell issue 2025-12-06 04:47:31 +00:00
b786098867 feat(package): migrator: something 2025-12-04 21:02:38 +00:00
8a08272f68 feat(package): hemar: I think I was wrong 2025-11-25 15:45:02 +00:00
4729770b59 feat(package): hemar: some stages of parsing 2025-11-25 13:19:45 +00:00
f5d412997e feat(package): hemar: conected to nix config 2025-11-24 14:33:45 +00:00
783cbe20e8 fix(package): migrator: init migration 2025-11-22 11:50:42 +00:00
9a7e7d677a feat(package): migrator: some migrate up works and init 2025-11-17 16:26:25 +00:00
5b1f05589d test: fix: migrator: multifile test 2025-11-17 01:57:32 +00:00
00f05cc3db feat(legacy): helpers: allow HECTIC_NAMESPACE be empty 2025-11-16 16:56:26 +00:00
bb99ef9a8a feat(legacy): helpers: update log, unefficient but works 2025-11-16 16:38:38 +00:00
6204ba5abb feat(package): migrator: ! migration up 2025-11-14 15:50:55 +00:00
00bbd42cab feat(package): migrator: init migration table 2025-11-04 13:21:15 +00:00
111db5a1ca feat(package): migrator: create new migration 2025-11-04 12:15:29 +00:00
9d97fd8d87 refactor(package): pull out all realization from default.nix 2025-11-03 20:08:20 +00:00
43dc59a04f feat: +checks flake output 2025-11-03 19:02:50 +00:00