Every repin from v0.17.0 to v0.21.0 left SHARED.md's quoted version behind and failed "Deploy pre-flight". The quote existed so the page would not mislead; checking that it matched only moved the failure to CI. requirements.txt is now the one place the version is written. deploy_check.py fails if SHARED.md quotes one again, and if it stops saying where the pin lives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8.5 KiB
Shared with Galena — now a package, not a promise
Sygna and Galena are built on one substrate. Until 2026-09-12 that meant copies kept
byte-identical by a script: the same files existed in both repositories and shared_check.py
failed if they drifted. This document was the list, and the rule was "change both repositories in
the same commit".
That is over. The substrate is dredd-core — a
private package, Apache-2.0, pinned to a git tag in backend/requirements.txt. That line is the
one place the version is written, so this page does not repeat it: a quoted copy fell behind the
real pin on four repins in a row, and deploy_check.py failed CI every time.
Both applications import it. There is nothing left to keep diff-clean, because there is only one
copy, and "which version" is a line in a requirements file rather than a property of two working
trees that a script has to go and measure. PLAN.md §3.6 predicted this ("the SHARED.md
byte-identical contract becomes a package pin"); this is that.
And they share more than the code: they share an identity store. Sygna and Galena are now two
modules of one platform, served at one origin under /sygna and /galena, and app_user +
session move out of each module's schema into a neutral dredd schema owned by Atrium's
migrator — one row per human, not one per module. Nothing else is shared: Sygna's own tables, its
own schema, its own least-privilege roles and its own audit log are exactly as isolated as they
are today. Identity is shared, not duplicated; data is not shared at all.
What core owns
From dredd_core |
What it is |
|---|---|
Base, UUIDPkMixin, TimestampMixin, NAMING_CONVENTION |
the ORM foundation. UUID primary keys are what make ids unique across both databases — the precondition for merging |
AppUser, Session, AppSetting, AuditLog |
identity, sessions, instance settings, the audit log |
Node, PermissionGrant, Favorite |
the org tree and its grants |
SafeInet, pg_enum |
column types |
authz |
the effective-role resolver: grants, ownership, ancestor-or-self — and since v0.6.0 readable_node_ids, the batch filter list screens use instead of a per-row check |
auth.AuthService / AuthPolicy |
password verification and lockout, sessions, app tokens with sliding renewal |
security |
Argon2id parameters, token generation, sha256-at-rest |
db.make_engine / make_session_factory |
the engine shape, including hide_parameters=True |
errors |
RFC 9457 Problem Details, so both applications' clients parse one format |
audit.record |
the append-only writer |
schema.create_enum_types |
enum types derived from the metadata, so labels cannot drift from models |
Those seven tables live alongside Sygna's own, in whatever schema the migrator's search_path names: public on a local stack, sygna in the family's shared managed database (db/managed/README.md), where every application has its own schema and its own roles and none can reach another's. Nothing in the code names the schema. There was briefly a core.* / sygna.* split, built when the plan was one database shared with Galena; separate applications mean there is nothing to tell apart and nothing to merge, so it was removed (PLAN.md §3.6).
What Sygna keeps, and why
Thin modules that re-export core and add what is this application's. Every one exists so that call sites in this codebase did not have to change, and so that the additions are visible in one place rather than scattered.
| File | What it adds |
|---|---|
app/services/authz.py |
Re-exports core's resolver and adds one function: access_state returning walled. Core would say locked, which is true and unhelpful — being barred from a matter on purpose is a different thing to explain than the absence of a grant. A label, not a decision; test_authz.py asserts nothing else is defined there. |
app/services/auth.py |
Binds AuthService to Sygna's AuthPolicy — notably app_token_prefix="sygna_pat_", the only thing in a stored credential that says which application minted it. Adds get_user and set_password. |
app/security.py |
APP_TOKEN_PREFIX, and the two token helpers curried with it. |
app/errors.py |
UpstreamError (502) for the integrations/ boundary. Core makes no outbound calls, so it has no equivalent. |
app/db.py |
Which URL to connect to, the pool size (DB_POOL_SIZE / DB_MAX_OVERFLOW), unpooled sessions for one-shot processes, and the request-scoped session dependency. |
app/enums.py |
Sygna's own enums. Core's are re-exported. |
app/services/audit.py |
A re-export, kept so from ..services import audit still reads the same. |
app/services/nodes.py |
The node-kind registry — core's containers plus matter — and Sygna's leaf rules. |
app/services/walls.py |
The ethical-wall policy, registered on core's restrict-only overlay hook. Deny only: the allow mode this once had was a permission grant wearing a barrier's clothes. |
app/services/credentials.py, app/services/secrets.py |
Each user's Galena app token, encrypted at rest (AES-256-GCM, key from SECRET_KEY in the environment). The only thing Sygna stores recoverably. |
Node kinds are a registry, not an enum
Core stores node.kind as text and leaves the vocabulary to each application
(services/nodes.node_kinds()): core's workspace / group / folder, plus whatever the
application provides. Sygna provides matter; Galena provides project. Contributing a kind
costs nothing in core — no enum, no migration, nothing for the other application to agree to,
which is the whole point of the registry and was Dredd core prerequisite #1.
NodeKind survives in app/enums.py as a constants holder so the comparisons throughout this
codebase keep reading the way they did. A StrEnum compares equal to its own string, so they
work unchanged against a text column — but node.kind is now a plain str, so reads do not
take .value. That is the one thing that broke on adoption and it broke loudly.
Byte-identical — what is still copied
Three files, and only because none of them is code a package can hold:
| File | Galena | Why |
|---|---|---|
backend/alembic/env.py |
same code, docstring differs | Alembic's entry point. Each application owns its own migrations; only the harness is identical. The code is (the URL used directly, make_engine online, strip_tls_params offline); the docstring is not, because Galena's names its own schema in the shared managed database and Sygna's names none. |
db/init/01-roles.sh |
same | Creates the app (DML) and migrator (DDL) roles. A shell script the database container runs, not something importable. |
backend/scripts/license_gate.py |
same | The copyleft gate. Tooling, not runtime. |
scripts/shared_check.py still guards these three. Its job is much smaller than it was, and that
is the improvement: the things it used to guard are guarded by the package manager now.
The overlay hook — closed
This section used to say the hook belonged in core and did not exist yet, with Sygna wrapping
every entry point in the meantime. dredd-core v0.7.0 shipped it (authz.register_overlay),
applied on every path that answers an access question — the single node, the batch a list screen
uses, and a notification's recipients. Sygna's wrapper is gone; services/walls.py registers and
that is the whole of it.
It is restrict-only, and that is the part worth keeping in mind: an overlay may lower or
revoke a role, never raise one, and core discards a higher return rather than trusting the
overlay to behave. A seam that can grant is a privilege-escalation path one bad overlay away.
Sygna's WallMode.allow — which admitted somebody the grant tree gave nothing — was removed to
fit, and the fit was the smaller reason: it was a permission grant expressed as a barrier.
Rules that still hold
- Never
pip install -e ../dredd-corein a checkout that matters. It shadows the pin, and a local edit to core then changes this application's behaviour with nothing in the repository recording it — the drift this document existed to stop, returning by a side door.deploy_check.pyasserts the pin is a git tag. - A core change means a tag bump and a repin in both applications, never a workaround in one. dredd-core is at 0.x with two consumers; expect to rub against an assumption occasionally.
- dredd-core is private, so CI needs
DREDD_CORE_TOKEN— a fine-grained read-only PAT, per repository.deploy_check.pyasserts the workflow has it.