Repository navigation
fix(csharp): resolve 1.3.0 upgrade blockers from C# estate triage - #682
Merged
Merged
Conversation
- C# writer: Piece.Args, a parameter or argument list that breaks with no
trailing comma (C# refuses one there); Braced("") writes a lone { for an
anonymous block instead of a blank line. Two csharp writer-conformance cases.
- TypeScript view lowering: an enum literal compared with an @intValueMap or
@stringValueMap enum in an origin.computed expression is written as the
stored value, not the member name.
- C#: stop generating the UseIdentityStartMigrations [Obsolete] no-op shim
kept through the 1.2.4 candidates.
- CHANGELOG upgrade list: the C# layout and package-namespace opt-in for
projects coming from a 1.2.4 candidate, the four vocabulary packs a
hand-composed registry must add, Postgres view schema qualification and
search_path, EF index names over 63 bytes, the removed shim. Agent schema
page docs state which tables it lists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Piece.Argswrites parameter and argument lists with no trailing comma, andCsWriter.Braced("")writes a lone{for an anonymous block. Covered by newcs-list-args-no-trailing-commaandcs-braced-anonymous-blockwriter-conformance cases, plus updatedWriterConformanceTests.Piece.Listkeeps its trailing comma.DbContextGeneratorno longer emits the<Context>IdentityStartMigrationsUseIdentityStartMigrations()shim in<Context>DesignTimeServices.g.cs. Matching golden file andIdentityStartDialectTests/EfModelGapsTestsupdated.extract-view-spec.ts): an enum literal compared against an@intValueMapor@stringValueMapfield is written as the stored value, including through computed operands (coalesce,nullif,greatest,least,caseresults). Covered by newenum-literal-in-computed-expr.test.ts.SET LOCAL search_pathsuggestion, the EF Core index-name truncationRenameIndexcase, and removal ofUseIdentityStartMigrations(). Fixed-section entries added for the three bug fixes.docs/,spec/code-writer.mdand the writer-conformance README updated to match.Validation
Risk Assessment
✅ Low: The changes are narrow (view enum-literal encoding, two C# writer fixes, removal of a no-op shim, upgrade docs), and the four fixes from the last round match the current code with no material defect found; I ran no tests.
Testing
Baseline configured command passed at this commit; no source changed this turn, so not re-run. Ran TS enum-literal focused test (12 pass) and C# codegen tests incl. writer conformance (42 pass). Both unit-level, not live CLI runs, so no scenario marked live. CHANGELOG corrections and DesignTimeServices shim removal not driven.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/typescript/packages/codegen-ts/src/projection/extract-view-spec.ts:933- The enum literal is encoded only when the other operand is a bare{field}, so item 5's failure is still reachable through a compound operand. Example:{op: eq, left: {fn: coalesce, args: [{field: status}, {field: status}]}, right: {value: "Unknown"}}over an @intValueMap enum. By the code, it loads: coalesce infers enum, eq is legal for enum, andliteralComparisonProblemskips a non-field operand. The view then emitsCOALESCE(...) = 'Unknown'against integer columns. A @stringValueMap enum silently compares the member name instead of the stored string. The same gap applies to either comparison side (lines 1011-1012) and to a coalesce used as a simple CASEoperand(line 972). It also applies to other operands that return an enum (nullif, greatest, least, or a case whose results are enum fields). The CHECK emitter already handles coalesce:storedFieldOfin migrate-ts/src/check-expression.ts:115. Apply the same stored-field resolution here, covering the other enum-returning nodes too, and add a coalesce case to the new test.server/typescript/packages/codegen-ts/src/projection/extract-view-spec.ts:933-subAgainstcallsfieldOf(other)before checking thatxis a string literal, and again for every simple CASE arm.lookupis not side-effect free. For a dotted path ending in a derived origin.first field, each call re-runsinlineEntityDerived, which reserves a new alias throughshortAliasFor. So a computed expression comparing such a path, even with no enum involved, can get different subquery alias names than before. That changes the view body and can cause an unneeded view replacement. Returnsub(x, temporal)first whenxis not{ value: <string> }. For comparisons, reuse the already resolvedlf/rf; for CASE, resolve the operand field once.CHANGELOG.md:95- The hand-composed registry upgrade note is inaccurate in two ways. First, it says all four packs were split out of core. At v1.2.0 and v1.2.3 only reporting and requirements vocabulary could have been in a 1.2 provider list.metaobjects-rulesandmetaobjects-view-expressionsare new in 1.3.0 (the view-expressions provider header says so). Second, it says any model using their vocabulary fails with an unknown type or subtype. Attributes such as @union, @unionall, @Grain and @grainOrdinal are not types: an omitted pack gives ERR_UNKNOWN_ATTR only under a strict load, and C#MetaDataLoaderdefaults to strict=false. Separate the packs moved out of core from the new ones, and limit the load-failure statement to types and subtypes, stating the strict-load condition for attributes.server/typescript/packages/codegen-ts/test/projection/enum-literal-in-computed-expr.test.ts:34- The test is titledne, gt and a literal on the left are mapped too, but it never exercises gt; it covers only ne and a left-side literal with eq. Removegtfrom the title.server/csharp/MetaObjects.Codegen/Writer/CodeWriter.cs:49- Fixed thePiece.ListXML doc. It gavef(a, b)and<A, B>as examples, but a brokenListtakes a trailing comma, which is the item 6 mistake. The comment now points toPiece.Argsfor argument, parameter and type lists. Comment only.🔧 Fix applied.
1 info still open:
server/csharp/MetaObjects.Codegen/Writer/CodeWriter.cs:49- Fixed thePiece.ListXML doc. It gavef(a, b)and<A, B>as examples, but a brokenListtakes a trailing comma, which is the item 6 mistake. The comment now points toPiece.Argsfor argument, parameter and type lists. Comment only.scripts/ci-local.sh --affected --strict-toolchainsbun test packages/codegen-ts/test/projection/enum-literal-in-computed-expr.test.ts in server/typescript (12 pass)dotnet test --filter FullyQualifiedName~WriterConformance in server/csharp (MetaObjects.Codegen.Tests: 42 pass)spec/decisions/ADR-0063-generators-own-layout.md:172- ADR-0063 (spec/decisions/ADR-0063-generators-own-layout.md, lines ~172 and ~186) still states C# lays out 'a trailing comma in broken lists' without the new parameter/argument-list exception. ADRs are decision records; the current contract is in spec/code-writer.md (Piece.Args). Left unchanged. Decide whether to add an ADR amendment.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.