Suppress Java codegen warnings via Gradle DSL; fix duplicate and false-positive warnings#309
Suppress Java codegen warnings via Gradle DSL; fix duplicate and false-positive warnings#309alexander-yevsyukov wants to merge 65 commits into
Conversation
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/68b0cb8a-7b52-4402-9110-5252ffe52f56 Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/e964dc0d-3376-4fb4-bdb2-ae3dce54cab8 Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/35bfa4c1-1992-4221-b4ab-a9c658269d4c Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/35bfa4c1-1992-4221-b4ab-a9c658269d4c Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/f90f333f-cd83-44ed-9a22-42cbbad478ae Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
…d-error-placeholders' into copilot/fix-duplicated-warning-message # Conflicts: # java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/BoundedFieldGenerator.kt # version.gradle.kts Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/f7e81e60-437d-4fd5-a6c4-7549d5cd987a Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
…ns/b81d4af0-e5e0-46d0-adb7-40a8f1c67aa7 Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/validation/sessions/c0c59d00-5e83-41d0-8488-c2618a6ea31a Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
…o copilot/fix-false-warning-for-required-id # Conflicts: # java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
…opilot/fix-duplicated-warning-message # Conflicts: # java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
…quired-id' into address-issues
There was a problem hiding this comment.
Pull request overview
This pull request updates the Validation project version/dependency reports and adjusts (required) validation generation so that primitive-typed “assumed required” entity IDs (e.g. int32 id) are not treated as required, with accompanying test coverage. It also tightens repository AI-agent operational rules (no history-writing without explicit authorization) and enhances the version-bumped gate to auto-discover the publishing version key.
Changes:
- Bump Validation version to
2.0.0-SNAPSHOT.434and refresh dependency versions/reports (Base/Jackson/SnakeYAML, etc.). - Prevent
(required)codegen for unsupported primitive field types by filtering required fields viaRequiredFieldSupport.isSupported(). - Add test fixtures and specs covering entity IDs with primitive types and update Claude/agent safety and tooling hooks.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps published Validation version to 2.0.0-SNAPSHOT.434. |
| tests/validating/src/testFixtures/proto/spine/test/tools/validate/entity.proto | Updates header and adds NumberStats entity with primitive int32 id. |
| tests/validating/src/test/kotlin/io/spine/test/options/AssumedRequiredITest.kt | Adds integration test asserting primitive entity IDs aren’t required. |
| java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt | Filters required-field codegen to supported field types only. |
| docs/dependencies/pom.xml | Updates generated dependency POM snapshot versions. |
| docs/dependencies/dependencies.md | Updates generated dependency/license report content and timestamps. |
| context-tests/src/testFixtures/proto/spine/validation/assumed_required_id_spec.proto | Adds proto stub for entity with int32 id for compiler/context testing. |
| context-tests/src/test/kotlin/io/spine/tools/validation/AssumedRequiredIdSpec.kt | Adds spec ensuring no warnings are emitted for int32 ID assumed-required handling. |
| CLAUDE.md | Adds explicit rule prohibiting commits/pushes/tags without current authorization. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt | Updates referenced Validation SDK version constants. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt | Bumps spine-base version to 2.0.0-SNAPSHOT.390 and updates header year. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt | Bumps Jackson BOM/runtime versions (2.21.3) and annotations version (2.21). |
| build.gradle.kts | Removes forced pin to spine-validation-java-runtime:2.0.0-SNAPSHOT.360. |
| .claude/settings.json | Adds post-tool hook to run update-copyright.sh. |
| .agents/tasks/prohibit-automatic-commits.md | Adds task doc describing the “no history writes without authorization” goal/plan. |
| .agents/skills/version-bumped/scripts/version-bumped.sh | Adds publishing-version-key auto-discovery and more flexible parsing. |
| .agents/skills/dependency-audit/SKILL.md | Updates audit procedure guidance and batching recommendations. |
| .agents/skills/bump-version/SKILL.md | Adds explicit ## Commit authorization constraints for the skill. |
| .agents/skills/bump-gradle/SKILL.md | Adds explicit ## Commit authorization constraints for the skill. |
| .agents/scripts/update-copyright.sh | Introduces post-tool hook script to refresh copyright years. |
| .agents/safety-rules.md | Adds “Commits and history-writing” safety policy. |
| .agents/quick-reference-card.md | Adds quick reminder linking to the new history-writing safety rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…essage' into address-issues # Conflicts: # docs/content/docs/validation/developer/build-and-release.md # docs/content/docs/validation/user/01-getting-started/adding-to-build.md # docs/dependencies/dependencies.md # docs/dependencies/pom.xml # java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt # java/src/main/kotlin/io/spine/tools/validation/java/generate/option/bound/BoundedFieldGenerator.kt # version.gradle.kts
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 44 out of 46 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
gradle-plugin/src/main/kotlin/io/spine/tools/validation/gradle/ValidationExtension.kt:153
warningsis created withproject.objects.newInstance(Warnings::class.java), butWarningsalso has an@Injectconstructor that requires aProjectparameter. This is the same instantiation mismatch as withJavaand can cause extension creation to fail. Prefer injectingObjectFactoryintoWarnings, or passprojectintonewInstance(...).
| import io.spine.dependency.local.Base | ||
| import io.spine.dependency.local.Spine | ||
|
|
Three related fixes around Validation Compiler warnings, plus the
documentation that exposes the new configuration knob.
1. Suppress unsigned-integer warning via Gradle DSL
Users can now silence the "unsigned integer types are not supported in
Java" warning emitted for
uint32/uint64fields with(range),(min), or(max):spine { validation { java { warnings { unsignedFields.set(false) } } } }Implementation:
:java-settingsproto-only module hostingspine.validation.java.ValidationWarnings.ValidationExtensiongains nestedjava { warnings { ... } }blocks(both
abstract @Injectclasses inside the extension, per theSpine nested-DSL convention). Positive polarity throughout —
truemeans emit.
ValidationGradlePluginalways writes the typedValidationWarningsin
Format.ProtoBinaryto the Spine Compiler settings directory forthe consumer
JavaValidationRenderer. The renderer reads it viaLoadsSettingsand injects the flag intoUnsignedIntegerWarnings.2. Deduplicate unsigned-integer warning reporting
BoundedFieldGeneratorpreviously had the warning call commented out(see issue #227). Re-enabled it and routed it through
UnsignedIntegerWarnings, which now dedupes per(file, span)and iscleared at the start of each render. Suppression state is also cleared
before each compilation.
3. Fix false-positive
(required)warning for primitive assumed IDsRequiredGeneratorno longer emits the "field assumed required"warning when the assumed-required field is a primitive type (e.g.
int64 id = 1as the first field of an entity). Regression coveragein
AssumedRequiredIdSpecandAssumedRequiredITest.4. New "Validation Gradle plugin" docs section
docs/content/docs/validation/user/06-gradle-plugin/_index.mddocumentsthe plugin and every property of
ValidationExtension(enabled,warnings.unsignedFields), with a forward link fromAdding to build. Sidenav updated.