Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 61 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,54 @@ there is described in full here. This list is where to start.
TypeScript and Python, `csharp.packageNamespaces` in C#. Java and Kotlin never renamed.
- **`meta init` and `metaobjects init` scaffold the package output layout.** New projects get
`outputLayout: "package"` (one directory per metadata package); `dotnet meta init` writes the
matching C# keys. An existing project changes nothing: the engine default stays flat.
matching C# keys. A project generated by 1.2.0 to 1.2.3 changes nothing: the engine default
stays flat.
- **C#, from a 1.2.4 release candidate: the package layout and package namespaces are opt-in.**
The 1.2.4 candidates always wrote C# under one directory per metadata package and declared
each type, materialized shared enums included, in its package's namespace. 1.3.0 keeps the flat
default of 1.2.0, so the same project regenerated with neither key set moves every file into one
directory and every type into `Namespace`, and `Fr019SharedEnum.SharedEnumTypeReference` returns
the bare enum name instead of a `global::`-qualified one (code that splits the namespace off it
finds no `.`). To keep the candidates' output, set
`"csharp": { "outputLayout": "package", "packageNamespaces": true }` in
`.metaobjects/config.json`; a self-hosted runner that builds its own `GenConfig` sets
`OutputLayout = OutputLayout.Package` and `PackageNamespacesFromMetadata = true`.
- **A hand-composed registry adds the four vocabulary packs.** Reporting
(`metaobjects-reporting`: `object.report`, `dimension.*`, `measure.*`, `segment.filter`,
`@segment`) and requirements (`metaobjects-requirements`) were part of the core provider in 1.2
and are now their own providers. View expressions (`metaobjects-view-expressions`:
`origin.function`, `@union`, `@unionAll`, `@grain`, `@grainOrdinal`) is new in 1.3.0 for a
project on 1.2.0 to 1.2.3; the 1.2.4 candidates carried it in core. Rules (`metaobjects-rules`:
`api.*`, `operation.*`, `binding.*`, `transition.*`) is new in 1.3.0. Every port's default
bundle carries all four, so a project that loads through the default changes nothing. A registry
composed from a 1.2 provider list does not carry the packs split from its core. A model that
uses a type or subtype of a missing pack (`object.report`, `segment.filter`, `origin.function`)
fails to load with an unknown type or subtype, naming it. An attribute that a missing pack adds
(`@segment`, `@union`, `@unionAll`, `@grain`, `@grainOrdinal`) is refused with
`ERR_UNKNOWN_ATTR` only by a strict load; a non-strict load, the C# `MetaDataLoader` default,
does not report it. Compose from the default bundle (C#
`Provider.ComposeRegistry(CoreTypes.LibraryProviders)`, TypeScript `coreProviders`, Python
`core_providers`), or add the four providers to your list. Java and Kotlin discover them
through `META-INF/services`, as before.
- **Postgres views qualify a relation only when its entity declares `@schema`.** The 1.2.4
candidates wrote every relation in a generated view body as `public."X"`; 1.3.0 writes `"X"`
unless the entity declares `@schema` (1.2.0 to 1.2.3 qualified none). From a candidate, expect
every regenerated Postgres view body to differ in `meta migrate`: one view replacement per view,
as with the `LEFT OUTER` item below. An unqualified relation is resolved through the
`search_path` in force when the view is created, so a migration that replaces views under a
non-default `search_path` should set it first (`SET LOCAL search_path TO <schema>, public;`).
- **C#, EF Core on Postgres: an index name over 63 bytes is now the name Postgres stores.** The
context declares a declared, `@unique` or foreign-key index name longer than 63 bytes cut to 63
UTF-8 bytes, as Postgres cuts it. A migration snapshot from an earlier build still holds the
long name, so the first `dotnet ef migrations add` after upgrading scaffolds a `RenameIndex`
from the long name to the cut one, which Postgres refuses: the index already has the cut name.
Delete the `RenameIndex` calls from that migration's `Up` and `Down` (leaving them empty when
nothing else changed) and keep its snapshot, so the snapshot catches up without touching the
database.
- **C#, from a 1.2.4 release candidate: `UseIdentityStartMigrations()` is gone.** The candidates
generated it in `<Context>DesignTimeServices.g.cs`, latterly as an `[Obsolete]` no-op beside the
design-time services that replaced it. 1.3.0 does not generate it, so a call no longer compiles:
delete every `.UseIdentityStartMigrations()` call. Nothing else changes, since it did nothing.
- **`@dbSetName` is `@collectionName`.** The attr was never published under its first name, so
there is no alias: a model that set `@dbSetName` in a pre-release build renames it.
- **`api.unknownFields: reject` is the one deliberate default change.** A generated create, PUT
Expand Down Expand Up @@ -3158,8 +3205,8 @@ four `rules.*` and `verify.lifecycle.unreachable` settings, held to `fixtures/ru
apply. EF finds the services through an `[assembly: DesignTimeServicesReference]` generated
beside them when the migrations live in the context's project, EF's default; for any other
migrations or startup project, `dotnet meta gen` warns and prints the line to add there. Nothing
is registered at runtime. `UseIdentityStartMigrations()` is kept as an `[Obsolete]` no-op so a
call to it compiles; remove it.
is registered at runtime. `UseIdentityStartMigrations()`, which the 1.2.4 release candidates
generated (latterly as an `[Obsolete]` no-op), is not generated: remove the call.
- **C#, upgrade note: a self-hosted codegen runner sets `GenConfig.Dialect`.** `@sequenceStart` and
the identity-start rewrite are emitted only when the dialect is `postgres`. `CodegenCli` reads it
from `.metaobjects/config.json` `migrate.dialect`; a runner that builds its own `GenConfig` must
Expand Down Expand Up @@ -3551,6 +3598,17 @@ four `rules.*` and `verify.lifecycle.unreachable` settings, held to `fixtures/ru

### Fixed

- **TypeScript: a literal compared with an enum is written as the stored value.** A view over an
`@intValueMap` enum wrote `= 'Unknown'` against an integer column when the enum sat behind a
computed operand (`coalesce`, `nullif`, `greatest`, `least`, a `case` result) as well as a bare
field. The emitter now writes the mapped integer (or the `@stringValueMap` string) on every
operand that yields an enum.
- **C#: a parameter or argument list has no trailing comma.** A broken `Piece.Args` list ends
with its last item and no comma whatever `trailingComma` says; a broken `Piece.List` keeps its
trailing comma, which C# accepts in an initializer or collection expression.
- **C#: `CsWriter.Braced("")` writes the lone `{` of an anonymous block.** An empty head used to
write a blank line, because `Line("")` requests one.

- **TypeScript: the service, queries and CRUD-route generators no longer import an entity module
nobody wrote.** When the filter of `serviceFile()`, `serviceRoutesFile()`,
`serviceRoutesHonoFile()`, `queriesFile()`, `routesFile()` or `routesFileHono()` admitted an
Expand Down
2 changes: 1 addition & 1 deletion docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/codegen-skip-conformance/`](../fixtures/codegen-skip-conformance/) (when `gen` may skip and what a local `verify --codegen` may answer, ADR-0064) | one case table in `cases.json`, plus the manifest layout vectors in `manifests.json` (ADR-0064 Amendment 1) | ✓ | ✓ | ✓ (through the Java runner) | ✓ | ✓ | ✓ (every case but the three-way merge one) |
| [`fixtures/codegen-noop/`](../fixtures/codegen-noop/) (vocabulary with no lowering yet: FR-044 reporting, what is lowered and what stays inert; ADR-0066 business rules, inert everywhere) | 2 model pairs (`reporting/` and `rules/`, each `with` vs `without`) | ✓ (codegen + migrate) | ✓ | ✓ | ✓ | ✓ | `rules/` (the layer generators lower it; the flat ones stay inert) |
| [`fixtures/cube-model/`](../fixtures/cube-model/) (FR-044 Plan 4 — the `cube-model` generator's golden Cube files, plus the canonical model's golden) | 46 cases (36 trees + 10 errors) + 1 canonical golden | ✓ (the exporter is TypeScript-only, spec R6; its `cube` lane also loads the files into a real Cube) | — | — | — | — | — |
| [`fixtures/writer-conformance/`](../fixtures/writer-conformance/) (ADR-0063 — the code writer generators write through) | 91 cases (33 core + 10 TypeScript + 9 Java + 12 Kotlin + 6 C# + 13 Python + 8 Rust) | ✓ (the first writer; core and TypeScript dialect) | ✓ (core and Java dialect; `JavaWriter` in `codegen-base`) | ✓ (core and Kotlin dialect; `KotlinWriter` in `codegen-kotlin`) | ✓ (core and C# dialect) | ✓ (core and Python dialect) | ✓ (core and Rust dialect) |
| [`fixtures/writer-conformance/`](../fixtures/writer-conformance/) (ADR-0063 — the code writer generators write through) | 93 cases (33 core + 10 TypeScript + 9 Java + 12 Kotlin + 8 C# + 13 Python + 8 Rust) | ✓ (the first writer; core and TypeScript dialect) | ✓ (core and Java dialect; `JavaWriter` in `codegen-base`) | ✓ (core and Kotlin dialect; `KotlinWriter` in `codegen-kotlin`) | ✓ (core and C# dialect) | ✓ (core and Python dialect) | ✓ (core and Rust dialect) |
| [`fixtures/contract-conformance/`](../fixtures/contract-conformance/) (FR-022 — the `contract-schema` and `openapi` generators' golden trees and refusals) | 22 cases (17 trees + 5 errors) | ✓ (one neutral engine, ADR-0034 Amendment 10; the generated API lanes also hold real traffic to the documents) | — | — | — | — | — |
| [`fixtures/explorer-conformance/`](../fixtures/explorer-conformance/) (the docs view: a loaded project + the verify payload, manifest and routes in, one `explorer.json` out) | 3 cases (`shop`, `crm`, `model-alone`) | ✓ | ✓ (`DocsView`, and the `docs-site` generator end to end) | ✓ (the JVM builder, through `codegen-kotlin`'s `docs-site`) | ✓ (`MetaObjects.DocsView`, and the `docs-site` generator end to end) | ✓ (`metaobjects.docs_view`, and the `docs-site` generator end to end) | ✓ (`metaobjects::docs_view`, and the `docs-site` generator end to end) |

Expand Down
3 changes: 3 additions & 0 deletions docs/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ points to `docsSiteFile()` for people and `agentDocsFile()` for agents.
relationships, and enums with their member sets. It **cites the migrations rather than
restating the DDL** — the migration files are the DDL, they are generated, and a page
that reproduces `CREATE TABLE` is a second spelling that goes stale.
It lists the tables `meta migrate` manages: an abstract base, a sourceless object, an
`@unmanaged` object and an object outside the project's scope have none, and a TPH
hierarchy is one table. A project whose tables are all owned elsewhere gets views only.
- **`agent/ui.md`** — before touching a form or a grid. Per field: the control the form
renders, label, HTML type, rules, form-excluded, and what the LIST endpoint accepts for
filtering and sorting; plus each declared `layout.dataGrid`. The endpoint under each
Expand Down
2 changes: 2 additions & 0 deletions docs/features/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ column type is that subtype's. A string cast may name a text `@dbColumnType` spe
NULL of an unbounded varchar is `{ cast: { value: null }, as: string, dbColumnType: varchar }`.
An enum casts to an integer only when it is stored as one (`@intValueMap`), which is also how an
int-stored enum and an int meet in one `case`: `then: { cast: { field: status }, as: int }`.
A literal compared with an enum (`{ value: <member> }`) is written as the member's stored value,
on either side and on any operand that yields the enum, a computed one included.

**Functions** (`{ fn, args }`). Beside `coalesce`: `greatest` and `least` (ordered arguments of
one type), `nullif` (two of one type), `lower`, `upper`, `btrim` (a string, optionally the
Expand Down
4 changes: 2 additions & 2 deletions docs/ports/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ design-time services from assembly …" when they are found.
The start in the model, and the services, are emitted only for a project whose
`.metaobjects/config.json` names `"migrate": { "dialect": "postgres" }` (a self-hosted runner sets
`GenConfig.Dialect`). Any other project gets neither, with a warning, and never needs the Npgsql
package. `UseIdentityStartMigrations()`, the registration of an earlier runtime SQL rewrite, is
kept as an `[Obsolete]` no-op so a call to it still compiles; remove the call.
package. `UseIdentityStartMigrations()`, the registration of an earlier runtime SQL rewrite in the
1.2.4 release candidates, is no longer generated, so a call to it does not compile; remove the call.


**CHECK constraints** are the ones `meta migrate` creates: each scalar `field.enum`
Expand Down
4 changes: 3 additions & 1 deletion fixtures/writer-conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ The `kotlin` ops are `package` (a name), `use` (a name), `useAs` (a name, then t
dialect's defaults unless it states options.

The `csharp` ops are `header` (lines), `using`, `usingStatic` (a namespace or type), `usingAlias`
(alias, target) and `docSummary` (lines), beside the core ops. A `csharp` case may state
(alias, target), `docSummary` (lines) and `braced` (a head, then the ops written inside the
block), beside the core ops. A `csharp` list may state `"trailingComma": false`, the C# writer's
`Piece.Args`. A `csharp` case may state
`"options": {"usingOrder": "sorted"}`; the default order is the order the generator named them.

The `rust` ops are `use` (a path, then the names), `doc` and `prose` (one text each),
Expand Down
35 changes: 35 additions & 0 deletions fixtures/writer-conformance/cases/cs-braced-anonymous-block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"description": "Braced with an empty head writes a lone { for an anonymous block, not a blank line, and Braced with a head writes the head then { on its own line.",
"dialect": "csharp",
"ops": [
[
"braced",
"public void M()",
[
[
"line",
"var a = 1;"
],
[
"braced",
"",
[
[
"line",
"var b = a;"
]
]
]
]
]
],
"expected": [
"public void M()",
"{",
" var a = 1;",
" {",
" var b = a;",
" }",
"}"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"description": "An argument or parameter list (Piece.Args) that breaks puts no comma after its last item, which C# refuses there, while the dialect's other lists keep the trailing comma.",
"dialect": "csharp",
"ops": [
[
"line",
"public static void Configure",
{
"list": {
"open": "(",
"items": [
"ModelBuilder modelBuilder",
"IReadOnlyDictionary<string, string> columnNamesByProperty",
"ILogger<ConfigureContext> logger"
],
"close": ")",
"trailingComma": false
}
}
],
[
"line",
"var names = new[] ",
{
"list": {
"open": "{",
"items": [
"\"alphaAlphaAlphaAlphaAlpha\"",
"\"betaBetaBetaBetaBetaBetaBeta\"",
"\"gammaGammaGammaGammaGamma\"",
"\"deltaDeltaDelta\""
],
"close": "}",
"pad": true
}
},
";"
]
],
"expected": [
"public static void Configure(",
" ModelBuilder modelBuilder,",
" IReadOnlyDictionary<string, string> columnNamesByProperty,",
" ILogger<ConfigureContext> logger",
")",
"var names = new[] {",
" \"alphaAlphaAlphaAlphaAlpha\",",
" \"betaBetaBetaBetaBetaBetaBeta\",",
" \"gammaGammaGammaGammaGamma\",",
" \"deltaDeltaDelta\",",
"};"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,3 @@ private static bool OnlyTheStart(AlterColumnOperation operation, string oldOptio
: Equals(operation[n], o[n]));
}
}

/// <summary>Kept for one release so code written against the earlier runtime registration still
/// compiles. It does nothing: the identity start is applied at design time.</summary>
public static class AppDbContextIdentityStartMigrations
{
private const string Message = "UseIdentityStartMigrations() is no longer needed and does nothing: the identity start is " +
"applied at design time by AppDbContextDesignTimeServices, which dotnet ef migrations add finds on its own. Remove the call.";

/// <summary>Does nothing.</summary>
[Obsolete(Message)]
public static DbContextOptionsBuilder UseIdentityStartMigrations(this DbContextOptionsBuilder options) => options;

/// <summary>Does nothing.</summary>
[Obsolete(Message)]
public static DbContextOptionsBuilder<TContext> UseIdentityStartMigrations<TContext>(this DbContextOptionsBuilder<TContext> options)
where TContext : DbContext => options;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ public void A_postgres_project_gets_the_design_time_services_and_the_start()
Assert.DoesNotContain("Npgsql.EntityFrameworkCore.PostgreSQL.", services.Replace("\"Npgsql.EntityFrameworkCore.PostgreSQL\"", ""));
Assert.DoesNotContain(".Internal", services);
Assert.DoesNotContain("EF1001", services);
// The earlier runtime registration survives for one release as an [Obsolete] no-op, so
// an adopter's UseIdentityStartMigrations() call still compiles (EfModelGapsTests proves it).
Assert.Contains("public static class AppDbContextIdentityStartMigrations", services);
Assert.Equal(2, services.Split("[Obsolete(Message)]").Length - 1);
Assert.Contains("DbContextOptionsBuilder UseIdentityStartMigrations(this DbContextOptionsBuilder options) => options;", services);
// The earlier runtime registration's [Obsolete] no-op, kept through the 1.2.4 candidates, is
// not generated: 1.3.0 removes it (EfModelGapsTests proves a call to it no longer compiles).
Assert.DoesNotContain("UseIdentityStartMigrations", services);
Assert.DoesNotContain("[Obsolete", services);
}

[Fact]
Expand Down
Loading
Loading