Skip to content

DEMO, do not merge: showing the #1034 gate go red - #1125

Closed
Rafael-SOWNet wants to merge 2 commits into
masterfrom
demo/generated-files-gate-goes-red
Closed

Rafael-SOWNet wants to merge 2 commits into
masterfrom
demo/generated-files-gate-goes-red

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Not for merge. This is acceptance criterion 1 of #1034, which asks that the gate be "demonstrated by pushing exactly that and showing the red".

The only change over #1124 is one line of Sources/Utils/Utils/TupleToIntervalTest.txt — a template edited without regenerating its output. Expected: Generated Files Up To Date fails, naming Sources/Tests/UnitTests/Convenience/TupleToIntervalTest.cs and printing the diff.

Will be closed once it has gone red.

…d matching

Nothing rebuilt the checked-in generated files and compared, so a template could stop matching its
output and the build stayed green -- the file only being discovered to be unregenerable the next
time somebody actually tried. That had already happened once, to
`EquationSystemFunctionPattern.txt`, repaired by #1029.

It had happened twice. `TupleToIntervalTest.txt` still named `MathS.Matrices.Interval`, which does
not exist, so regenerating `TupleToIntervalTest.cs` produced eighteen CS0117 errors -- measured, not
inferred. The generator had also drifted on the namespace, writing `UnitTest.Extensions` where the
test project uses `AngouriMath.Tests.Extensions`, and had lost the `Area` trait every test class
here carries so that `dotnet test --filter` can select by area. All three are repaired.

**And two of the three T4 templates did not emit the copyright header**, which is worse than
cosmetic: IDE0073 is an error in this repository, so regenerating either of them produced a file
that failed the build outright. The issue proposed excluding the header block when diffing; emitting
it is better, because then the generated file is the committed file and there is no exclusion that
could quietly grow to hide a real difference. `MathAllMethods.tt` already emitted it and already
reproduced exactly, so this makes the other two match the one that worked -- BOM included, which
that file does not have either and which no `.editorconfig` rule asks for.

`Sources/Utils/regenerate_all.sh` regenerates everything in place. The three T4 templates are read
out of `AngouriMath.csproj` rather than listed in the script, because a list written twice is a list
that drifts, and this one would drift in the direction of covering less. It resolves paths from its
own location rather than from the working directory, and it looks `t4` up rather than assuming it is
on PATH -- `dotnet tool install -g dotnet-t4` installs a binary called `t4`, so `dotnet t4` fails
with a message that reads as a typo.

`GeneratedFilesUpToDate.yml` runs it and fails on any difference, printing the diff rather than
"files differ". Demonstrated by breaking a template without regenerating its output: the job's diff
step exits 1 and names `TupleToIntervalTest.cs`.

The ANTLR parser keeps its own job, `GrammarUpToDate.yml`, because it needs a Java runtime where
this needs a dotnet tool -- so neither goes red for the other's reason.

Part of #1034.
@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

Its job is done: the gate went red on the intended step and named the file. Evidence linked on #1124.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant