Skip to content

Name the first missing placeholder of a declaration, the same on every run - #111

Merged
david-Darkcollective merged 1 commit into
developfrom
fix/placeholder-declaration-order
Oct 12, 2026
Merged

david-Darkcollective merged 1 commit into
developfrom
fix/placeholder-declaration-order

Conversation

@david-Darkcollective

Copy link
Copy Markdown
Member

Fixes #110

When a declaration had several ${NAME} placeholders with no value, the error named an arbitrary one, and which one changed between JVM runs. ConnectionDeclaration (properties), HttpSourceConfig (headers) and GeneratorSourceConfig (arguments) copied their maps with Map.copyOf, which iterates in an order randomised per JVM. All three now keep declaration order in an unmodifiable LinkedHashMap and still refuse a null key or value. The other copyOf calls in the declaration ASTs are List.copyOf, which already keeps order.

As a side effect, headers are now sent and printed in the order they were declared.

One name or all of them: the message still names only the first missing placeholder. Resolution stops at the first gap, as it does for a value that breaks a header. A stable first name is enough for an example or a test, and it leaves the message format relix-cli already matches alone. Reporting every gap would mean collecting failures across the whole Execution, and that can come later if anyone asks for it.

Tests

  • LangAstValidationTest.DeclaredOrder: twenty entries in reverse order keep that order for a connection's properties, an http source's headers and a generator's arguments. A null value is still refused.
  • PlaceholdersTest: a connection with eight missing placeholders, and an http source with six missing headers, fail with the exact message naming the first one as written.

All five new assertions fail on develop without the fix. ./gradlew check passes.

Once this is on develop, relix-cli (DarkCollective/relix-cli#42) can show an example with several missing placeholders.

…y run

With several ${NAME} placeholders in one declaration and no value for
them, the error named whichever one the resolver met first, and that
changed between JVM runs (#110): ConnectionDeclaration copied its
properties, HttpSourceConfig its headers and GeneratorSourceConfig its
arguments with Map.copyOf, whose iteration order is randomised per JVM.

Each now keeps declaration order in an unmodifiable LinkedHashMap, and
still refuses a null key or value. So the error names the first
missing placeholder as written, and headers are also sent and printed
in the order they were declared.

The message still names one placeholder, not all of them: resolution
stops at the first gap, as it does for a value that breaks a header,
and a stable first name is what an example or a test needs.

Fixes #110
@david-Darkcollective
david-Darkcollective merged commit 19ca533 into develop Oct 12, 2026
3 checks passed
@david-Darkcollective
david-Darkcollective deleted the fix/placeholder-declaration-order branch October 12, 2026 14:59
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