@metaobjectsdev/sdk 0.15.4 → 0.15.5

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.
@@ -98,6 +98,29 @@ So even in a Java or Python or C# project, schema migration and `verify --db` ru
98
98
  through the Node `meta` tool. The per-port `gen`/codegen tooling stays native to
99
99
  the language; only schema crosses to Node.
100
100
 
101
+ ## Never hand-edit the live database — apply schema only through the tool
102
+
103
+ The live schema is a derived artifact, exactly like generated code. **Do not mutate a running
104
+ database by hand** — no `psql`/console `ALTER TABLE` / `CREATE` / `DROP`, not to preview a column, not
105
+ to patch a mismatch, not to "just unblock" a boot. It is the single most common way a database ends up
106
+ in a state no migration can reproduce:
107
+
108
+ - The column now exists but no migration recorded it, so the next `meta migrate` (or a JVM app's
109
+ boot-time migrator) tries to add it again and dies on `column ... already exists` — or worse,
110
+ silently diverges and the drift only surfaces days later.
111
+ - "I'll just add it real quick so I can see it in the tool" is the exact rationalization to catch. It
112
+ doesn't *feel* like a schema change, so it skips the metadata-first check — but it is one.
113
+
114
+ Apply every schema change the same way: change the metadata, then let `meta migrate` (or, for a
115
+ project still driving its own migrator, a migration authored *to match* the regenerated schema) apply
116
+ it. Want to see a new column in a tool or an app? Apply the migration and re-read — never reach for
117
+ `psql`.
118
+
119
+ **Make `meta verify --db` a done-check, not just a CI gate.** Run it after any work that touched the
120
+ database or the schema-shaping metadata, before you consider the task finished — it introspects the
121
+ live DB against the metadata and fails on exactly this drift (a hand-added column, a missing index, a
122
+ mismatched type), catching a manual poke immediately instead of at the next boot.
123
+
101
124
  ## Interpreting conformance / test failures
102
125
 
103
126
  MetaObjects' behavior is pinned by cross-port **conformance corpora** (metamodel,
@@ -7,6 +7,7 @@ spine; generated code is the disposable artifact. Regenerate with `{{codegenComm
7
7
 
8
8
  ## Principles
9
9
  - Pattern-derivable from metadata = codegen, never hand-write — FKs, CRUD, validators, finders, and the database schema and migrations. The schema is a disposable, generated artifact: change the metadata and regenerate, never hand-write SQL.
10
+ - The **live database** is a derived artifact too — never hand-apply a schema change to a running DB (ad-hoc `psql`/console `ALTER`/`CREATE`/`DROP`), not even to preview a column or unblock a boot. Apply schema only through `meta migrate` (metadata → DDL). A hand-applied change drifts the live DB from the metadata + migration history and collides at the next migrate/boot ("column already exists") — a state no migration can reproduce. Run `meta verify --db` after any DB-touching work to catch that drift early.
10
11
  - Never hand-edit generated files — change the metadata and regenerate (three-way merge preserves hand-written regions).
11
12
  - Use the generated constants for any string that names metadata.
12
13
  - The loaded metadata model is READ-ONLY — never inject nodes or mutate the tree at load time (no "enrich the model on load" hooks). Need an extra field/column? Author it in the metadata, or derive it during codegen (read the metadata, emit output). Mutating the loaded model makes it diverge from what's declared — a bad practice reserved for very rare cases.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/sdk",
3
- "version": "0.15.4",
3
+ "version": "0.15.5",
4
4
  "description": "Workspace helpers and agent-docs utilities for MetaObjects projects.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "access": "public"
57
57
  },
58
58
  "dependencies": {
59
- "@metaobjectsdev/metadata": "0.15.4",
59
+ "@metaobjectsdev/metadata": "0.15.5",
60
60
  "zod": "^3.23.0"
61
61
  },
62
62
  "devDependencies": {