Do not capture what a specification declares - #2546
Conversation
The artifact catalogue walked every nested type, so a fixture a specification declares to assert something about a contract was captured as though the application shipped it. It does not: the fixture is Debug-only and stripped from anything deployed. Where the fixture stands in for a real artifact the effect is worse than an extra entry. A specification that declares a second projection over a read model that already has one makes the captured document say the read model is built twice, which is not legal Screenplay - so the document does not compile and nothing downstream can read it. Recognised by the base class rather than by the members a specification usually holds: one that only inspects a contract has no Because, and those are exactly the ones that declare a fixture.
|
Reviewer context. Found by capturing a real application. Both came from projections declared inside specification classes:
Each exists so the specification can assert something about the real projection's contract, and each was emitted beside it — so the read model had three builders. Why the base class and not the members. Verified end to end, not just in specs. Packed this branch locally, pointed the CLI at it and regenerated Ada:
That last row is the point: the two errors blocked Studio's import outright, because it will not parse a document with errors. With them gone, Ada imports — 17 modules, 241 slices — and round-trips back to a document that compiles. The spec was vacuous first, and I nearly shipped it that way. My initial fixture put the specification in a namespace that produced no slice, so nothing was captured with or without the change and all three facts passed either way. Reverting the source and re-running is what caught it. In its current shape all three fail with the fix reverted. Not verified: no other application was captured, so this rests on Ada plus the spec. And the fix stops recursion into specifications entirely — a type nested in one is never an artifact — which is the intent, but it is broader than projections. |
Source strings as constants rather than inline arguments, the note as a documentation comment, and no unnecessary using. Debug does not treat these as errors and Release does, which is what CI builds.
Fixed