The data
Thirteen tables. The centre is items —the archive— and everything else hangs
off cuentas, which is what this system knows how to talk to.
Table and column names stay in Spanish. They are what the database, the
migrations and the code actually say: translating them here would leave you
looking for a flows table that does not exist. Each one is explained in
English; only the identifier is left untouched.
The diagram
Four more tables hang off nothing and so stay out of the diagram: ajustes
(key/value, including the general brake), alertas (the notices and whether
they were delivered), latidos (which worker beats and when) and
metricas_diarias (the daily summary).
The constraints that are guards
These are not shape validations: they are project rules held up by the database, where they do not depend on a programmer remembering them.
| Constraint | What it prevents |
|---|---|
items_atribucion_obligatoria | That an atribucion_sin_permiso item exists without a link to the original. Attribution is not a convention: it is a CHECK. |
items_regimen_check | An invented regime. Only consentido or atribucion_sin_permiso. |
cuentas_rol_plataforma_coherente | Declaring that you publish to Instagram (you cannot) or that you read from LinkedIn (there is no client). It mirrors the platform table in the code. |
consentimientos_destino_no_vacio | A permission naming an empty list of destinations: it would read as “permission granted” and enable nothing. |
rutas_clave_unica + immutability trigger | That a flow’s identity changes. Without it, every rename would come in as a new flow on import. |
UNIQUE (item_id, cuenta_destino_id, ronda) | Publishing the same thing twice to the same destination. It is what makes “disseminate” idempotent. |
Why is cuentas_destino an array of UUIDs and not a text with the network?
Because permission is per account, not per network. With two Mastodon
accounts, a permission scoped to mastodon enabled both, and there was no way
to consent to one and not the other. The previous version stored 'mastodon'
and that was exactly the flaw: wider than what the person actually asserted.
Why the archive stores bytes and not URLs
archivo_estado has six values and two of them do not heal on their own:
| State | Means | Does it fix itself? |
|---|---|---|
pendiente | Not downloaded yet | Yes, the downloader picks it up |
descargando | In progress | Yes |
listo | The bytes are there | — |
sin_medios | A text-only post: there is nothing to download | — (not a shortfall) |
fallido | The download failed | No. The downloader only takes pendiente/descargando |
purgado | Disk was freed on purpose | No. It has to be fetched again |
sin_medios exists so as not to lie. A text post has no file, and marking
it pendiente would leave it forever in the downloader’s queue, counting as
work that never gets done. It is not a shortfall: there is simply nothing to
fall short of.