@abloatai/ablo 0.34.0 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -0
- package/CHANGELOG.md +10 -0
- package/dist/cli.cjs +488 -426
- package/docs/index.md +2 -0
- package/docs/operating-on-your-database.md +109 -0
- package/package.json +1 -1
package/docs/index.md
CHANGED
|
@@ -50,6 +50,7 @@ Three things stay true no matter how you use Ablo:
|
|
|
50
50
|
- [Client Behavior](./client-behavior.md) — Options, errors, retries, timeouts, and imports.
|
|
51
51
|
- [Debugging & Logs](./debugging.md) — Turn on the `[Ablo]` coordination trace (`debug` / `logLevel`) to watch claims, queueing, and grants while you build — or read the same activity in code via `ClaimLog` to render an activity feed.
|
|
52
52
|
- [Connect Your Database](./data-sources.md) — Keep canonical rows in your app database without giving Ablo database credentials.
|
|
53
|
+
- [Operating on Your Database](./operating-on-your-database.md) — Which actions run freely, which to verify first, and which belong to a human — and how to tell.
|
|
53
54
|
- [React](./react.md) — Provider, hooks, and reactive reads for React apps.
|
|
54
55
|
- [API Keys](./api-keys.md) — Bearer tokens for the public API.
|
|
55
56
|
|
|
@@ -77,6 +78,7 @@ Three things stay true no matter how you use Ablo:
|
|
|
77
78
|
- [Guarantees](./guarantees.md) — Confirmed writes, optimistic state, stale-write protection, and agent lifecycle.
|
|
78
79
|
- [Coordination](./coordination.md) — `claim`, `claim.state`, and `claim.queue` for active work.
|
|
79
80
|
- [Connect Your Database](./data-sources.md) — Where data lands when your app database is canonical.
|
|
81
|
+
- [Operating on Your Database](./operating-on-your-database.md) — The safety model for working on a live database: reversible model writes vs. human-gated DDL, and the read-only checks that resolve the doubt.
|
|
80
82
|
- [Receipt](./api.md#receipt) — Confirm what landed.
|
|
81
83
|
- [Usage](./api.md#usage) — Metering and audit dimensions.
|
|
82
84
|
- [Audit Log](./audit.md) — Trace any confirmed write back to the human behind it.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Operating on Your Database
|
|
2
|
+
|
|
3
|
+
Ablo sits over your database as a coordination layer, not an owner. It reads
|
|
4
|
+
your Postgres replication stream and routes each write through a claim-checked
|
|
5
|
+
commit that lands in your own tables. It never runs DDL, never migrates, never
|
|
6
|
+
drops. That single boundary is why almost everything you do through Ablo is
|
|
7
|
+
either read-only or reversible — and why the few actions that aren't are easy to
|
|
8
|
+
name. This page is how to tell them apart, so you can work on a real database
|
|
9
|
+
without guessing which move is the dangerous one.
|
|
10
|
+
|
|
11
|
+
The habit that makes it easy is to look before you act. One command shows you
|
|
12
|
+
the real shape of your database measured against your schema, and changes
|
|
13
|
+
nothing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx ablo check # read-only — reports which columns fit your models and which don't
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
When a question is about the live database — does this column exist, is it
|
|
20
|
+
nullable, will this write fit — you can usually answer it by observing rather
|
|
21
|
+
than reasoning in the dark.
|
|
22
|
+
|
|
23
|
+
## The floor: what Ablo never does
|
|
24
|
+
|
|
25
|
+
These hold on every database Ablo connects to, and they are what bound the blast
|
|
26
|
+
radius of anything you do through the model API:
|
|
27
|
+
|
|
28
|
+
- It **never runs DDL or migrations** on your database, and never drops a table
|
|
29
|
+
or column. Schema changes to your own tables are always your application's
|
|
30
|
+
action, run with your admin credential — never Ablo's.
|
|
31
|
+
- It **never owns your rows.** Canonical data stays in your tables; Ablo hosts
|
|
32
|
+
only the transaction log and the coordination state.
|
|
33
|
+
- Every model write is **claim-checked and recorded.** A write based on a row
|
|
34
|
+
that moved under you is rejected rather than applied, and the prior value is
|
|
35
|
+
retained in the log, so a confirmed change is attributable and
|
|
36
|
+
reconstructable.
|
|
37
|
+
|
|
38
|
+
So a normal `ablo.<model>.update(...)` cannot silently corrupt your database:
|
|
39
|
+
the worst case is a clean rejection and a re-read, not a lost row.
|
|
40
|
+
|
|
41
|
+
## Three kinds of action
|
|
42
|
+
|
|
43
|
+
Sort any action you're about to take into one of these, and the right move
|
|
44
|
+
follows.
|
|
45
|
+
|
|
46
|
+
**Run freely — read-only or reversible.**
|
|
47
|
+
Reads (`retrieve`, `list`, `get`), `ablo check`, and `ablo pull` observe and
|
|
48
|
+
never change anything. Previews — `--show-sql`, `--dry-run` — print the exact
|
|
49
|
+
SQL a command would run without executing it. Model writes through
|
|
50
|
+
`ablo.<model>.create` / `update` are claim-checked, optimistic, rolled back if
|
|
51
|
+
the server rejects them, and recorded in the log with the prior value. All of
|
|
52
|
+
these are safe to run on your own initiative.
|
|
53
|
+
|
|
54
|
+
**Verify first — needs one look at the live database.**
|
|
55
|
+
Routing an existing table's writes through a model requires the model to match
|
|
56
|
+
the table's real columns. Run `ablo check`: it names the columns that fit and
|
|
57
|
+
the ones that don't, so a `NOT NULL` column your model doesn't set shows up as a
|
|
58
|
+
line in the report rather than a surprise at commit time. Decide the model shape
|
|
59
|
+
from what `check` tells you, then proceed. Nothing here is risky — it just reads
|
|
60
|
+
better after you've seen the ground truth.
|
|
61
|
+
|
|
62
|
+
**Hand to a human — irreversible, outside the log's protection.**
|
|
63
|
+
Raw DDL on the live database — `ALTER TABLE … OWNER TO`, adding or dropping a
|
|
64
|
+
column, changing a constraint — changes the database itself and is not covered
|
|
65
|
+
by the reversible log, so it belongs to a person with their hand on it. So does
|
|
66
|
+
a `connect` cutover run with its confirmation skipped (`--yes`): the prompt
|
|
67
|
+
exists because the step provisions real roles and reconciles publication on a
|
|
68
|
+
live database, and on a shared or production database that confirmation is the
|
|
69
|
+
human's to give. Removing a model from your schema belongs here too — for the
|
|
70
|
+
reason below.
|
|
71
|
+
|
|
72
|
+
## The one action that isn't what it looks like
|
|
73
|
+
|
|
74
|
+
Deleting a model from `ablo/schema.ts` reads like a code cleanup, but it is a
|
|
75
|
+
schema change. Your schema is a desired-state declaration: `ablo push` diffs it
|
|
76
|
+
against the server's copy, and a model that has vanished from the schema can be
|
|
77
|
+
read as a table that should no longer exist. "Nothing imports it" answers a
|
|
78
|
+
code question. The question that governs safety is *does removing this drop a
|
|
79
|
+
real table on the next push* — and that one is answered against the database,
|
|
80
|
+
not the codebase. Before removing a model that maps a live table, confirm the
|
|
81
|
+
table is gone or empty and that your push path is additive; otherwise keep the
|
|
82
|
+
model until the data is dealt with. A `load: 'manual'` mapping is often present
|
|
83
|
+
precisely to hold a table in place, so treat its comment as load-bearing.
|
|
84
|
+
|
|
85
|
+
## The verification loop
|
|
86
|
+
|
|
87
|
+
Most of the uncertainty in working on a live database dissolves into a few
|
|
88
|
+
read-only checks:
|
|
89
|
+
|
|
90
|
+
- `ablo check` — does the live database match the schema? Reports the exact
|
|
91
|
+
column-by-column fit. Read-only.
|
|
92
|
+
- `ablo pull` — what is actually in the database, expressed as a schema.
|
|
93
|
+
Read-only, like `prisma db pull`.
|
|
94
|
+
- `--show-sql` / `--dry-run` on `connect` and `migrate` — the exact statements,
|
|
95
|
+
printed and unexecuted, so you approve the SQL before it runs.
|
|
96
|
+
- Read the row and its claim state before you write — `retrieve` / `list`, and
|
|
97
|
+
`ablo.<model>.claim.state({ id })` for who is already working on it.
|
|
98
|
+
|
|
99
|
+
The pattern underneath all of it is steady: reads and model writes flow freely
|
|
100
|
+
because the boundary and the log make them safe, DDL and cutovers pause for a
|
|
101
|
+
human because they change the database itself, and the space between the two is
|
|
102
|
+
one `ablo check` away from certain.
|
|
103
|
+
|
|
104
|
+
## See also
|
|
105
|
+
|
|
106
|
+
- [Connect Your Database](./data-sources.md) — the one path a database joins Ablo.
|
|
107
|
+
- [Guarantees](./guarantees.md) — what a confirmed write, a stale check, and a claim promise.
|
|
108
|
+
- [CLI & Migrations](./cli.md) — `check`, `pull`, `migrate`, and their read-only / preview flags.
|
|
109
|
+
- [Schema Contract](./schema-contract.md) — how the schema drives push, and why it is a desired-state declaration.
|