Seed URL mappings index with runtime fallback#15956
Conversation
Add UrlMappingsIndexProperties and load path with fallback to runtime UrlMappingsHolder behavior. Assisted-by: Sisyphus:xai/grok-4.5 [gpt-coding]
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial SPI “landing pad” for future build-time URL-mappings indexing by reserving a descriptor location and exposing its presence to the runtime URL mappings holder, while preserving the existing runtime URL-matching behavior. It also adds an upgrade-note doc page and a unit test validating the “no index present” fallback path.
Changes:
- Added
UrlMappingsIndexPropertiesto load optionalMETA-INF/grails/url-mappings-index.propertiesfrom the classpath. - Wired
DefaultUrlMappingsHolderto load/expose the descriptor and emit a debug message when it’s present. - Added upgrade documentation and a unit test for the missing-descriptor fallback behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/UrlMappingsIndexProperties.java | New classpath descriptor loader for future URL mappings index metadata. |
| grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingsHolder.java | Loads and exposes the descriptor; logs when present while keeping runtime routing behavior. |
| grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsIndexPropertiesSpec.groovy | Adds fallback-path coverage when the descriptor is absent. |
| grails-doc/src/en/guide/upgrading/urlMappingsPrecompute.adoc | Documents the reserved descriptor location and current runtime behavior. |
| grails-doc/src/en/guide/toc.yml | Adds the new upgrade note page to the guide TOC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public static UrlMappingsIndexProperties load(ClassLoader classLoader) { | ||
| ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader; | ||
| if (loader == null) { | ||
| return EMPTY; | ||
| } | ||
| try (InputStream inputStream = loader.getResourceAsStream(LOCATION)) { | ||
| if (inputStream == null) { | ||
| return EMPTY; | ||
| } | ||
| Properties properties = new Properties(); | ||
| properties.load(inputStream); | ||
| return new UrlMappingsIndexProperties(true, properties); | ||
| } | ||
| catch (IOException e) { | ||
| throw new IllegalStateException("Unable to load " + LOCATION, e); | ||
| } | ||
| } |
|
The current implementation of To address these issues, it is recommended to:
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/UrlMappingsIndexProperties.java |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15956 +/- ##
==================================================
- Coverage 49.5403% 49.5383% -0.0020%
- Complexity 16922 16926 +4
==================================================
Files 1999 2000 +1
Lines 93754 93780 +26
Branches 16420 16423 +3
==================================================
+ Hits 46446 46457 +11
- Misses 40145 40156 +11
- Partials 7163 7167 +4
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 97b5cc9 Learn more about TestLens at testlens.app. |
Description
What was found
What changed
UrlMappingsIndexPropertiesfor optionalMETA-INF/grails/url-mappings-index.propertiesDefaultUrlMappingsHolderto prefer index data when presentOut of scope / follow-up
Related MD topics
Contributor Checklist
Issue and Scope
8.0.xas an experimental starter for 8.1 work.Code Quality
Licensing and Attribution
ai-generated-starting-pointlabel applied.Documentation
Assisted-by: Sisyphus:xai/grok-4.5 [gpt-coding]