Eliminate duplicated error placeholders#300
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #294 by consolidating placeholder definitions: it removes the duplicated RuntimeErrorPlaceholder enum and moves/standardizes placeholder usage around a single ErrorPlaceholder in the JVM runtime, updating compiler/context, generators, tests, and documentation accordingly. It also includes additional build/tooling updates (dependency report output relocation, Gradle wrapper bump, agent docs/skills updates, and version bump).
Changes:
- Moved/renamed
ErrorPlaceholderinto:jvm-runtime(io.spine.validation) and removed the duplicatedRuntimeErrorPlaceholderenum (replaced with a deprecated alias). - Updated compiler/context and Java generators to use the new
io.spine.validation.ErrorPlaceholder. - Updated docs and dependency-report generation paths; bumped project version and Gradle wrapper.
Reviewed changes
Copilot reviewed 50 out of 52 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps Validation snapshot version. |
| tests/validating/src/test/kotlin/io/spine/test/options/setonce/SetOnceViolationITest.kt | Updates placeholder key usage in (set_once) integration test. |
| tests/validating/src/test/kotlin/io/spine/test/options/goes/GoesViolationITest.kt | Switches test imports from RuntimeErrorPlaceholder to ErrorPlaceholder. |
| jvm-runtime/src/main/kotlin/io/spine/validation/TimestampValidator.kt | Updates imports to use ErrorPlaceholder. |
| jvm-runtime/src/main/kotlin/io/spine/validation/TemplateStringExts.kt | Updates imports to use ErrorPlaceholder. |
| jvm-runtime/src/main/kotlin/io/spine/validation/RuntimeErrorPlaceholder.kt | Removes duplicated enum. |
| jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt | Moves/renames placeholder enum into runtime package and introduces deprecated alias. |
| java/src/main/kotlin/io/spine/tools/validation/java/setonce/SetOnceConstraintViolation.kt | Updates placeholder imports to io.spine.validation.ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequireOptionGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/PatternGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/GoesGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/DistinctGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/ChoiceGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/RangeGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/MinGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/MaxGenerator.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/BoundedFieldGenerator.kt | Adjusts imports to use runtime ErrorPlaceholder. |
| java/src/main/kotlin/io/spine/tools/validation/java/expression/TemplateStrings.kt | Points placeholder enum import to io.spine.validation.ErrorPlaceholder. |
| gradle/wrapper/gradle-wrapper.properties | Bumps Gradle wrapper distribution URL. |
| docs/dependencies/pom.xml | Adds generated dependency POM under docs/dependencies. |
| docs/content/docs/validation/user/04-validators/implement-a-validator.md | Updates validator docs placeholder usage. |
| docs/content/docs/validation/developer/validation-model.md | Updates docs about placeholder enumeration/duplication. |
| docs/content/docs/validation/developer/runtime-library.md | Updates runtime library docs to remove RuntimeErrorPlaceholder mention. |
| docs/content/docs/validation/developer/adding-a-built-in-option.md | Updates contributor docs about placeholders/runtime needs. |
| context/src/main/kotlin/io/spine/tools/validation/option/SetOnceOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/RequireOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/required/RequiredOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/PatternOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/GoesOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/DistinctOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/option/ChoiceOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/ErrorPlaceholders.kt | Imports runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/bound/RangeOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/bound/MinOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/src/main/kotlin/io/spine/tools/validation/bound/MaxOption.kt | Updates placeholder imports to runtime ErrorPlaceholder. |
| context/build.gradle.kts | Adds dependency on :jvm-runtime for placeholder enum. |
| CLAUDE.md | Updates internal agent-doc path reference. |
| buildSrc/src/test/kotlin/io/spine/gradle/report/license/DependencyReportOutputTest.kt | Adds tests for new dependency report output locations. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt | Writes generated POM under docs/dependencies. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/license/Paths.kt | Centralizes output directory and adds outputFile() helper. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/license/LicenseReporter.kt | Writes merged license report under docs/dependencies. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt | Adjusts Core-JVM compiler/plugin version for tests. |
| .gitignore | Removes ignore rule for .claude/worktrees. |
| .github/workflows/ensure-reports-updated.yml | Renames workflow step label for dependency report checks. |
| .agents/version-policy.md | Updates version policy docs to reference a skill doc. |
| .agents/skills/bump-version/SKILL.md | Adds “bump-version” skill documentation. |
| .agents/skills/bump-version/agents/openai.yaml | Adds agent interface metadata for bump-version. |
| .agents/skills/bump-gradle/SKILL.md | Adds “bump-gradle” skill documentation. |
| .agents/skills/bump-gradle/agents/openai.yaml | Adds agent interface metadata for bump-gradle. |
Comments suppressed due to low confidence (1)
jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt:74
- Replacing
RuntimeErrorPlaceholderwith a Kotlintypealiasis only source-level compatibility for Kotlin. It will break (1) binary compatibility for already-compiled clients expectingio.spine.validation.RuntimeErrorPlaceholderas a real enum class, and (2) all Java source usage since typealiases are not visible from Java. If backward compatibility is required, keep a real deprecatedRuntimeErrorPlaceholdertype (e.g., a deprecated enum delegating toErrorPlaceholdervalues, or a deprecated wrapper exposing the old API) and migrate callers gradually.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 167d3e5e76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 47 out of 49 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt:74
- The deprecated
typealias RuntimeErrorPlaceholder = ErrorPlaceholderdoes not preserve binary compatibility (already-compiled Kotlin/Java code will still reference the removedRuntimeErrorPlaceholderenum class) and it is not visible from Java sources at all. If backward compatibility is required, consider keeping a deprecatedRuntimeErrorPlaceholderdeclaration (e.g., an enum delegating toErrorPlaceholdervalues or a class/object exposing the same constants) for at least one release line.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 47 out of 49 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt:74
RuntimeErrorPlaceholderis now a Kotlintypealias, which is source-compatible only. It does not generate a JVM type, so any already-compiled Kotlin/Java code that referencedio.spine.validation.RuntimeErrorPlaceholderwill fail at runtime (binary incompatible). If backward binary compatibility is required, keep a deprecatedenum class RuntimeErrorPlaceholderwith the same FQCN and constants (you can delegate each constant’svalueto the correspondingErrorPlaceholderconstant to avoid duplicating the strings).
| [validation-plugin]: https://github.com/SpineEventEngine/validation/blob/master/context/src/main/kotlin/io/spine/tools/validation/ValidationPlugin.kt | ||
| [default-message]: https://github.com/SpineEventEngine/validation/blob/master/context/src/main/kotlin/io/spine/tools/validation/DefaultErrorMessage.kt | ||
| [error-placeholder]: https://github.com/SpineEventEngine/validation/blob/master/context/src/main/kotlin/io/spine/tools/validation/ErrorPlaceholder.kt | ||
| [option-generator-pkg]: https://github.com/SpineEventEngine/validation/tree/master/java/src/main/kotlin/io/spine/tools/validation/java/generate/option |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt:74
RuntimeErrorPlaceholderis now a Kotlintypealias, which does not produce a JVM type. This breaks Java source compatibility (io.spine.validation.RuntimeErrorPlaceholderno longer exists) and also breaks binary compatibility for already-compiled clients. If backward compatibility is required, keep a real deprecatedenum class RuntimeErrorPlaceholder(or another JVM-visible type) and map its entries toErrorPlaceholdervalues.
jvm-runtime/src/main/kotlin/io/spine/validation/ErrorPlaceholder.kt:28- Changing the package from
io.spine.tools.validationtoio.spine.validationis a breaking change for existing consumers (both source and binary). If this type was previously published under the old package, consider providing a deprecated shim inio.spine.tools.validation(e.g., a delegating enum or other JVM-visible wrapper) to preserve compatibility, or explicitly treat this as a breaking release.
This PR addresses #294 by moving the
ErrorPlaceholdertype into thejvm-runtimemodule.We need this enumeration in JVM validation runtime because message validators (e.g.
io.spine.time.validation.LocalDateValidator) may need the placeholders for their work.The
RuntimeErrorPlaceholderwas transformed into the deprecated type alias for backward compatibility.Other notable changes
configwas updated.