You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c3455eb
Browse filesBrowse the repository at this point in the historyBrowse files
feat: fail verify on hand edits and add migrate.foreignKeyIndexes (1.3.0 PRs 6-7) (#577)
* feat: fail verify on hand edits and index foreign keys on request (1.3.0 PRs 6-7)
verify.handEdits in .metaobjects/config.json: "fail" makes `meta verify --codegen`
exit 1 on a hand-edited generated file, naming the file and both remedies;
--allow-hand-edits relaxes it for one run, --forbid-hand-edits still forces it.
A project without the key keeps the notice and exit 0; `meta init` writes
"fail". The C#, Java, Kotlin and Python gates already byte-compare and fail;
the docs now say so.
migrate.foreignKeyIndexes: every foreign key nothing already leads with gets a
plain <table>_<columns>_idx index, separate from the efcore preset (which
indexes them already and so adds nothing). Honoured by meta migrate / verify
--db, the Drizzle reference template, the C# DbContext generator and the Kotlin
Exposed table generator; Java OMDB and Python map no indexes. `meta init`
writes it on; projects without it are unchanged and keep the advisory, which
now names the option. Persistence corpus gains two migration scenarios.
C# gen and both verify --codegen paths pass foreignKeyIndexes and conventions.
* no-mistakes(review): Document that custom schemaConventions reach only the TS toolchain
* no-mistakes(document): docs: note FK-index option in conventions table
* no-mistakes(document): docs: link conventions note to FK-index option
|[`fixtures/persistence-conformance/`](../fixtures/persistence-conformance/)|62 (55 query + 7 migration) | all 62; the 24 `report-*` and the `-15` decimal scenarios also on SQLite, MySQL and D1, `decimal-exact` also on MySQL (a scenario's `engines:` key is exact) | 55 query (migrations TS-only, ADR-0015); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query (via Exposed); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query; the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query (pg8000); the `report-*` and `engines:` scenarios also on SQLite (`sqlite3`) and MySQL (PyMySQL) |
38
+
|[`fixtures/persistence-conformance/`](../fixtures/persistence-conformance/)|64 (55 query + 9 migration) | all 64; the 24 `report-*` and the `-15` decimal scenarios also on SQLite, MySQL and D1, `decimal-exact` also on MySQL (a scenario's `engines:` key is exact) | 55 query (migrations TS-only, ADR-0015); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query (via Exposed); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query; the `report-*` and `engines:` scenarios also on SQLite and MySQL | 55 query (pg8000); the `report-*` and `engines:` scenarios also on SQLite (`sqlite3`) and MySQL (PyMySQL) |
39
39
|[`fixtures/api-contract-conformance/`](../fixtures/api-contract-conformance/)| 123 (31 core + 10 tph + 9 m2m + 5 jsonb + 2 write-through + 2 secret-fields + 2 enum-default + 12 projection + 37 report + 11 decimal + 2 duration) | ✓ (Fastify reference + generated lane); `report/`, `decimal/` and `duration/` also on SQLite, MySQL and D1 | ✓ (embedded HTTP + JDBC); `report/`, `decimal/` and `duration/` generated controllers over OMDB on Postgres, SQLite and MySQL | ✓ (embedded HTTP + Exposed); `report/`, `decimal/` and `duration/` also on SQLite and MySQL | ✓ (Kestrel + Npgsql); `report/`, `decimal/` and `duration/` also on SQLite and MySQL | ✓ (FastAPI + pg8000); `report/`, `decimal/` and `duration/` also on SQLite and MySQL |
|[`fixtures/duration-wire/`](../fixtures/duration-wire/)| 1 vector file: the `wire` vectors (parse, precision, refused) every port passes, and the `codecs` groups (Postgres text read and write, stored microseconds) each port passes only for the codecs it has | ✓ (`metadata` / `runtime-ts` and the generated helper) | ✓ | ✓ | ✓ | ✓ |
@@ -423,9 +423,9 @@ All 37 fixtures → [features/migrations-and-drift.md](features/migrations-and-d
423
423
may carry `"isArray": true`; with `fields` it is a list of objects, without it a list of
424
424
scalars. The six `verify-positional-accessor-*` cases pin where `-last` is available.
Copy file name to clipboardExpand all lines: docs/features/cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ vocabulary everywhere, each port implementing the modes it supports.
53
53
| Subverb | What it checks | Touches a DB? |
54
54
|---|---|---|
55
55
|`verify --db`|**Schema drift** — does the live database (or snapshot) match the metadata? (migrate engine, ADR-0015) | yes |
56
-
|`verify --codegen`|**Codegen drift** — regenerate from metadata into a temp dir and fail if it differs from the committed generated output. Catches "metadata changed but `meta gen` wasn't re-run". A hand-edited generated file is NOT drift — `meta gen` three-way-merges hand edits by design, so the gate compares the *generated contribution* against the committed `.gen-state/.hashes.json` rather than the file byte-for-byte. It still LISTS every generated file carrying a hand edit (count + paths, and how to see the edit) as a notice that does not change the exit code; `--forbid-hand-edits` makes any hand edit fail the build, for teams that want generated code untouchable (Node `meta` only). | no |
56
+
| `verify --codegen` | **Codegen drift** — regenerate from metadata into a temp dir and fail if it differs from the committed generated output. Catches "metadata changed but `meta gen` wasn't re-run". **A hand-edited generated file** (Node `meta`): `meta gen` three-way-merges hand edits, so the gate compares the *generated contribution* against the committed `.gen-state/.hashes.json` and reports each edited file separately, by path, with how to see the edit and how to drop it. What that report does to the exit code is the `verify.handEdits` key in `.metaobjects/config.json`: `"fail"` exits 1, `"notice"` (and a project without the key, as before 1.3) prints it and exits 0. `meta init` writes `"fail"` for a new project. `--allow-hand-edits` relaxes `fail` to a notice for one run; `--forbid-hand-edits` makes a hand edit fail for one run whatever the key says. The other ports compare the generated files byte for byte, so any edit is drift and fails: `dotnet meta verify --codegen`, `mvn metaobjects:verify` (Java and Kotlin) and `metaobjects verify --codegen` each exit non-zero and name the file. | no |
57
57
|`verify --templates`|**Template/prompt drift** — `Renderer.verify` checks each `template.*` node's `{{field}}` references against its payload VO (FR-004). A Jinja body (Python and TypeScript, ADR-0061) is checked the same way. | no |
58
58
|`verify --docs`|**Removed in 1.1.0** (ADR-0034 Amendment 9). It prints where the check went and exits 2: documentation is written by entries in `generators`, so `verify --codegen` checks it with the rest of the declared output. | — |
59
59
|`verify --deps`|**Dependency drift** (FR-023) — re-resolves each declared dependency (its `path`, its installed `npm` / `python` package, or its `maven` / `nuget` package in the local cache) and compares its installed artifact's hash against `.metaobjects/deps.lock.json`, same comparison as `meta deps check`. Needs the publisher reachable, so it is never part of the bare-`verify` default. A `drifted` or `unresolved` dependency fails with `ERR_DEPENDENCY_UPSTREAM_DRIFT`. **Node `meta`; Python (`metaobjects verify --deps`, plus `metaobjects deps check`), C# (`dotnet meta verify --deps`), and Java and Kotlin (`-Dmeta.verify.mode=deps`) have the `path`-only counterpart.** See [`metadata-dependencies.md`](metadata-dependencies.md). | no |
Copy file name to clipboardExpand all lines: docs/features/language-differences.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,8 @@ project.
46
46
|**Field names on the wire**| The model's names, in every port |||||
47
47
|**Decimals and null members on the wire**| Each port writes its serializer's default; a `wire` setting makes them identical. The per-port table is under [The wire setting](api-contract.md#the-wire-setting)|||||
48
48
|**Hand edits to a generated file**| Merged (three-way) on the machine that generated it; refused by name elsewhere | Refused by name, or overwritten with `WithHandEdits(HandEdits.Overwrite)`| Refused by name, or overwritten with `<handEdits>overwrite</handEdits>`| Same as Java | Refused by name, or overwritten with `handEdits: overwrite`|
49
+
|**`verify --codegen` on a hand-edited generated file**| Set by `verify.handEdits`: `"fail"` (what `meta init` writes) exits 1, `"notice"` or no key reports the file and exits 0; `--allow-hand-edits` / `--forbid-hand-edits` change it for one run | Byte comparison: any edit is drift and fails | Same as C# | Same as C# | Same as C# |
50
+
|**Foreign-key indexes (`migrate.foreignKeyIndexes`)**|`meta migrate` creates them; the Drizzle and Prisma mappings declare them | The `AppDbContext` declares them | No index mapping to declare | The Exposed tables declare them | No index mapping to declare |
49
51
|**Own a generator**|`npx meta eject`|`dotnet meta eject`|`mvn metaobjects:eject`|`mvn metaobjects:eject`|`metaobjects eject`|
50
52
|**Requirement authoring lint**| Yes (advisory) | No | No | No | No |
0 commit comments