Commit Graph
12 Commits
Author SHA1 Message Date
UKMesh Readiness f28570202c Provision the standard split-role database privileges on fresh installs 2026-12-02 11:42:59 +00:00
Codex 0975d07d0a docs: reconcile 2.0 runbooks, privacy notice and performance evidence 2026-11-12 12:42:09 +00:00
Codex f70dc183ed Record actual public SQL plans and lifecycle policy state for qualification 2026-11-12 07:37:31 +00:00
hermes-gadget f40b0d0930 fix(db): supersede 074 on post-move databases so 134 can run (#203)
* fix(db): re-assert the prefix visibility fence after the schema moves

074 installed the row-aware prefix fence while both relations still lived in
public. 087 then replaced bump_visibility_for_changed_prefixes() with the
statement body from 066, which reads new_prefix_rows/old_prefix_rows, while
113 moved the prefix registry to core and 108/128 left read-only compatibility
views at the old public names. The ROW trigger moved with the table but still
executes the statement body, so every write to core.private_node_prefixes
fails with relation "new_prefix_rows" does not exist.

134 restores 074's semantics against the post-move relations only:
core.private_node_prefixes triggers, ops.public_visibility_state target, a
guarded one-shot backfill that invalidates a materialization certified during
the broken window, and no reference to the public compatibility views.

The sql guard now recognises trigger grammar keywords (ON/OF) that sit where a
DML target would otherwise be parsed.

* fix(db): supersede 074 on post-move databases so 134 can run

074_prefix_visibility_row_fence.sql ships on main and is merged into this
branch, where 087 moved public_visibility_state to ops, 113 moved
private_node_prefixes to core, and 108/128 left read-only compatibility views
at the old public names. On a database that already ran 087-132 the file is
still pending, so the runner reaches it first and aborts:

  ALTER action ADD COLUMN cannot be performed on relation
  "public_visibility_state"

134_reassert_prefix_visibility_fence.sql re-asserts the same fence on the
post-move relations, but no later migration can run after that abort.

Record 074 as superseded only when the catalog proves the move happened:
ops.public_visibility_state and core.private_node_prefixes are tables, and
public.public_visibility_state / public.private_node_prefixes exist as
read-only projections. A pre-move database (the public names are the real
tables) still executes 074, and a half-moved database executes it rather than
assuming the fence is in place. If the post-move shape is present and 134 is
missing from the tree, the run fails closed instead of skipping the fence.

The decision is a pure function over observed relkinds so every branch is
unit-tested; the runner writes the ledger row (superseded-post-move) and a
schema_migration_compatibility audit row carrying the reason and observed
shapes in one transaction.

Tests: pre-move database -> 074 applies and its row trigger fences writes;
post-move database -> 074 recorded superseded with evidence and the same pass
continues to 134, which installs four row/statement triggers on
core.private_node_prefixes; missing replacement -> refusal with no ledger row.
2026-11-05 17:02:58 +00:00
hermes-gadget 619c1f5108 ci: seed the migration ledger when bootstrapping a fresh volume (#202)
A fresh volume is seeded from `backend/src/db/schema/base.sql` by the
TimescaleDB init hook, so the first `db-migrate` pass legitimately sees a
non-empty database with no ledger:

  [db-migrate] failed: public.schema_migrations is missing on a non-empty
  database; refusing to create a new ledger or replay historical migrations

Replaying history cannot produce that schema on its own: none of the 129
migrations create `nodes` or `packets`, and a genuinely empty database fails
at `relation "packets" does not exist`. The base schema is the ledger origin,
so the runner now recognises a deliberate, documented bootstrap:

* `MIGRATION_BASE_SCHEMA_BOOTSTRAP_APPROVAL` must carry the exact approval
  string; `true`, casing variants and an absent value are all refused.
* Even then the database must match the shipped `base.sql` exactly — same
  relations, same schemas, no extras. Any drift (an extra table from a
  production-like database, a missing baseline table, an extra schema) is
  refused with the differences named.
* An accepted bootstrap is recorded in `schema_migration_compatibility` as
  `schema/base.sql` / `bootstrap-base-schema` with the file's SHA-256.
* A database without the approval still throws the original assertion error.

`docker-compose.ci.yml` sets the approval for the empty-volume smoke only and
mounts the shipped operator role-bootstrap scripts into the same init hook, so
`072_backend_grants.sql` runs its real grant path instead of being skipped.

The runner's 011/015/016 supersession probe no longer assumes `core.nodes` and
`mesh.packets` exist: it probes whichever of the pre-move `public` relations and
the current `core`/`mesh` relations are present, so a fresh base schema is
correctly treated as empty instead of erroring out.

Tests: unit coverage for the decision table (refusal, wrong token, drift in
either direction, extra schema, missing baseline) plus a PostgreSQL integration
test that seeds `base.sql` and proves all three outcomes: refused without the
approval and no ledger created, bootstrapped with it (ledger rows carry the
real file checksums, the audit row is written, a second pass is a no-op), and
refused again once one extra relation appears. It also covers the 011 probe.
2026-11-05 16:56:20 +00:00
Hermes Agent 9fb5acc06e merge: reconcile deployed 2026-10-20 tree with origin/main
- Keeps every production behaviour from the deployed tree: public feed,
  owner packet sharing (including the Oct-12 publish/claim timeout fix),
  regions, privacy rematerialisation, RAM/durable ingest, owner last-hop
  prewarm.
- Takes main's additive work since the fork: ingest repair series, 1-byte
  path evidence, gitleaks ignore, dependabot pins, publicStatus,
  workloadPolicy and health diagnostics.
- Resolves 26 conflicts; per-file decisions recorded in the campaign
  DECISIONS.md and merge-proposal notes.
- Restores the two migrations missing from the deployed tree byte-exact
  (052_node_identity_packets_raw_columns, 055_message_tags) and defers
  main's unapplied 057 status-column migration to docs/deferred-migrations.
- Fresh-database bootstrap verified: base schema plus 60 migrations apply
  in order; a second run reports no pending migrations.
2026-10-20 11:59:02 +01:00
Hermes Agent 48fb91acda chore(recovery): capture deployed 2026-10-20 working tree
Exact snapshot of the tree that produced the running images (HEAD 1f94bd8)
including the 199 uncommitted/untracked production changes: regions, owner
packet sharing, public feed, RAM ingest, privacy rematerialisation, path-beta
updates, migrations 052-060, tests and deploy scripts.

Excluded: .env*/knowledge.md/.private-config (gitignored secrets); runtime
backup receipts restored to HEAD; mosquitto ACL/passwd are gitignored (kept
in the private pre-change snapshot). No functional changes.
2026-10-20 11:37:34 +01:00
hermes-gadgetandgadgethd 5574d70139 fix: close High findings #43 + #45 — durable MQTT ingestion, bounded telemetry lifecycle (#100)
* fix(mqtt): ack QoS1 after durable persistence

* fix(retention): bound core telemetry lifecycle

* docs: add C5b durability handoff

* test(rules): 1m cadence for telemetry lifecycle alert windows so for: timers accumulate

---------

Co-authored-by: gadgethd <111318106+gadgethd@users.noreply.github.com>
2026-09-30 23:35:04 +01:00
gadgethd 26781dc7d9 fix(db): make reset schema and lifecycle reproducible 2026-08-27 23:48:01 +00:00
gadgethd 5db382e181 feat: complete codebase reliability upgrade 2026-08-02 03:40:11 +01:00
gadgethd 93cc3e1b38 Expand network intelligence and harden operations (#9)
Consolidates the stacked backend, privacy, network-intelligence, frontend, operations, mobile, and owner-cache changes after resolving main conflicts and passing the full CI suite.
2026-07-23 20:50:47 +01:00
Ben 21224a0525 Refactor backend, map, and worker boundaries
- split backend API into route/service/repository boundaries across stats, owner, and pathing\n- extract shared API bootstrap and helper modules\n- reduce MapLibreMap into smaller frontend map modules with extracted builders, config, popup UI, and types\n- continue worker modularization by extracting RF terrain/tile helpers alongside RF config and loss helpers\n- add repo-local architecture, DB lifecycle, link model, pathing, frontend map, and contributing docs\n\nThis is the verified refactor checkpoint: backend and frontend builds passed, worker syntax checks passed, affected containers were rebuilt, and /healthz is OK.
2026-03-20 17:45:47 +00:00