This is an automated email from the ASF dual-hosted git repository. jamesfredley pushed a commit to branch task/add-agents-md-15145 in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit f9d59169e1593f53df9c4b0a68963f090d5a9665 Author: James Fredley <[email protected]> AuthorDate: Fri Jan 30 13:56:14 2026 -0500 Address matrei's review feedback on AGENTS.md and skills - Clarify @GrailsCompileStatic usage for artefact classes only - Fix test isolation warning about static state cleanup - Replace @ResourceLock with @Shared (no Spock parallel execution) - Update documentation URLs to grails.apache.org - Fix grails-developer skill: logback-spring.xml, spring/resources.groovy - Add integration-test/groovy directory to project structure - Update to ContainerGebSpec for Geb tests - Update plugin coordinates to org.apache.grails.plugins - Change codeStyle to check task (more general) - Use single quotes for simple strings in Groovy examples --- .agents/skills/grails-developer/SKILL.md | 40 +++++++++++++++++--------------- .agents/skills/groovy-developer/SKILL.md | 6 ++--- AGENTS.md | 14 +++++------ 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.agents/skills/grails-developer/SKILL.md b/.agents/skills/grails-developer/SKILL.md index f29373dd99..3f7ff29974 100644 --- a/.agents/skills/grails-developer/SKILL.md +++ b/.agents/skills/grails-developer/SKILL.md @@ -61,8 +61,8 @@ myapp/ ├── grails-app/ │ ├── conf/ # Configuration │ │ ├── application.yml # Main config -│ │ ├── logback.xml # Logging config -│ │ └── spring/ # Spring bean definitions +│ │ ├── logback-spring.xml # Logging config +│ │ └── spring/resources.groovy # Spring bean definitions │ ├── controllers/ # Request handlers │ ├── domain/ # GORM domain classes │ ├── i18n/ # Message bundles @@ -74,7 +74,8 @@ myapp/ ├── src/ │ ├── main/groovy/ # Additional Groovy classes │ ├── main/java/ # Java classes -│ └── test/groovy/ # Test specifications +│ ├── test/groovy/ # Test specifications +│ └── integration-test/groovy/ # Integration test specifications ├── build.gradle # Build configuration └── gradle.properties # Project properties ``` @@ -750,11 +751,11 @@ class BookServiceIntegrationSpec extends Specification { ### Functional Test with Geb ```groovy -import geb.spock.GebSpec +import geb.spock.ContainerGebSpec import grails.testing.mixin.integration.Integration @Integration -class BookFunctionalSpec extends GebSpec { +class BookFunctionalSpec extends ContainerGebSpec { void "can view book list"() { when: @@ -785,22 +786,22 @@ class BookFunctionalSpec extends GebSpec { // build.gradle // Spring Security -implementation 'org.grails.plugins:spring-security-core:6.0.0' +implementation 'org.apache.grails.plugins:grails-spring-security-core:7.0.1' // Database Migration (Liquibase) -implementation 'org.grails.plugins:database-migration:4.2.0' +implementation 'org.apache.grails.plugins:grails-database-migration:5.0.1' // Caching -implementation 'org.grails.plugins:cache:6.0.0' +implementation 'org.apache.grails.plugins:grails-cache:7.0.0' // Async support -implementation 'org.grails.plugins:async:5.0.0' +implementation 'org.apache.grails.plugins:grails-async:7.0.0' // Fields plugin for form rendering -implementation 'org.grails.plugins:fields:5.0.0' +implementation 'org.apache.grails.plugins:grails-fields:7.0.0' // Asset Pipeline -runtimeOnly 'org.grails.plugins:asset-pipeline:5.0.0' +runtimeOnly 'com.bertramlabs.plugins:asset-pipeline-grails:5.0.8' ``` ### Spring Security Configuration @@ -832,12 +833,12 @@ grails.plugin.springsecurity.controllerAnnotations.staticRules = [ ./gradlew integrationTest # Integration tests # Build -./gradlew build -PskipTests # Build without tests +./gradlew build # Build with tests ./gradlew bootJar # Executable JAR ./gradlew bootWar # WAR file # Code quality -./gradlew codeStyle # Check style +./gradlew check # Run all verification tasks # Clean ./gradlew clean @@ -851,7 +852,7 @@ grails.plugin.springsecurity.controllerAnnotations.staticRules = [ - Let Grails infer configurations where possible. ### Performance -- Use `@GrailsCompileStatic` on controllers and services. +- Use `@GrailsCompileStatic` on controllers, services, and domain classes. - Enable query caching for read-heavy operations. - Use pagination for large result sets. - Avoid N+1 queries with eager fetching or batch size. @@ -869,15 +870,16 @@ grails.plugin.springsecurity.controllerAnnotations.staticRules = [ - Use Geb for critical user workflows. ### Code Style -- Use `@GrailsCompileStatic` for type safety and performance. +- Use `@GrailsCompileStatic` or `@CompileStatic` for type safety and performance. - Prefer services for business logic over controllers. - Use command objects for complex form handling. - Keep controllers thin, services fat. ## Resources -- **Grails 7 User Guide**: https://docs.grails.org/latest/guide/single.html -- **GORM Documentation**: https://gorm.grails.org/latest/ -- **Grails Plugins**: https://plugins.grails.org/ +- **Grails 7 User Guide**: https://grails.apache.org/docs/latest/guide/single.html +- **GORM Documentation**: https://grails.apache.org/docs/latest/grails-data/ +- **Grails Plugins**: https://grails.apache.org/plugins.html +- **Groovy 4 Documentation**: https://docs.groovy-lang.org/docs/groovy-4.0.30/html/documentation/ - **Spock Framework**: https://spockframework.org/spock/docs/2.3/all_in_one.html -- **Geb Manual**: https://gebish.org/manual/current/ +- **Geb Manual**: https://groovy.apache.org/geb/manual/current/ diff --git a/.agents/skills/groovy-developer/SKILL.md b/.agents/skills/groovy-developer/SKILL.md index 7accc5b520..ba29714994 100644 --- a/.agents/skills/groovy-developer/SKILL.md +++ b/.agents/skills/groovy-developer/SKILL.md @@ -52,15 +52,15 @@ Activate this skill for any Groovy-related task, including: ### Concise Syntax ```groovy // No semicolons required -def name = "Grails" +def name = 'Grails' // Optional parentheses for method calls -println "Hello World" +println 'Hello World' list.each { println it } // Optional return keyword String greet(String name) { - "Hello, $name" // Last expression is returned + "Hello, $name" // Last expression is returned (GString needs double quotes) } ``` diff --git a/AGENTS.md b/AGENTS.md index 86ace2d3d2..fcfa52282e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,7 +42,7 @@ export GRADLE_OPTS="-Xms2G -Xmx5G" ## Critical Rules 1. **Use `jakarta.*` NOT `javax.*`** - All packages migrated to Jakarta EE 10 -2. **Use `@GrailsCompileStatic`** - Not plain `@CompileStatic` in Grails classes +2. **Use `@GrailsCompileStatic`** - Not plain `@CompileStatic` in Grails artefact classes 3. **Use `GrailsWebRequest.lookup()`** - For thread-safe request context in tests 4. **No wildcard imports** - Use explicit imports 5. **4 spaces, no tabs** - See `.editorconfig` @@ -174,7 +174,7 @@ name ?: 'Unknown' books*.title // DO: Static compilation -@GrailsCompileStatic +@GrailsCompileStatic // or @CompileStatic for non-artefact classes class MyService { } // DON'T: Wildcard imports @@ -186,11 +186,11 @@ class MyService { } ## Test Isolation -> **WARNING**: Tests run in parallel (`maxParallelForks > 1`). Static state causes flaky tests. +> **WARNING**: Tests run in parallel (`maxParallelForks > 1`). Static state that is not properly reset in test cleanup can cause flaky tests in subsequent tests within the same fork. - Use `GrailsWebRequest.lookup()` for thread-local context - Clear artefacts: `grailsApplication.artefactInfo.clear()` -- Use `@ResourceLock` for shared resources +- Use `@Shared` for fields that should be reused by multiple feature methods in a Spec ## Build Commands @@ -241,7 +241,7 @@ See `CONTRIBUTING.md` for full details. |---------|----------| | Out of memory | `export GRADLE_OPTS="-Xms2G -Xmx5G"` | | Container missing | Use `-PskipTests` or install Docker/Podman | -| Flaky tests | Check static state pollution, use `@ResourceLock` | +| Flaky tests | Check static state pollution, ensure proper cleanup in tests | | Cache issues | `./gradlew --rerun-tasks` | | Deprecation details | `./gradlew <task> --warning-mode all` | @@ -252,9 +252,9 @@ Please see the page of the [ASF Security Team](https://www.apache.org/security/) ## Resources -- **Grails 7 Guide**: https://docs.grails.org/latest/guide/single.html +- **Grails 7 Guide**: https://grails.apache.org/docs/latest/guide/single.html - **Groovy 4 Docs**: https://docs.groovy-lang.org/docs/groovy-4.0.30/html/documentation/ - **Spock 2.3 Docs**: https://spockframework.org/spock/docs/2.3/all_in_one.html -- **GORM Docs**: https://gorm.grails.org/latest/ +- **GORM Docs**: https://grails.apache.org/docs/latest/grails-data/ - **Issues**: https://github.com/apache/grails-core/issues - **Slack**: https://grails.slack.com
