jdaugherty opened a new pull request, #16547:
URL: https://github.com/apache/grails-core/pull/16547

   ## Summary
   
   Addresses #15840 on `7.0.x` by keeping Spring profile document selection out 
of ordinary configuration merges.
   
   `NavigableMap.merge` previously applied Spring profile filtering recursively 
to every map. This could silently discard an entire configuration snapshot:
   
   - A nested `spring.profiles` settings map, such as `[active: 'alpha']`, was 
treated as a legacy profile selector, emptying the backup constructed with 
`PropertySourcesConfig(Map)`.
   - A saved configuration containing `spring.config.activate.on-profile=alpha` 
was rejected during restoration if another application changed the JVM-wide 
`spring.profiles.active` property to `beta`.
   
   The latter failure reproduces across independent application classloaders 
with separate `Holders` classes. The same reproduction passes on Grails 6.2.3 
and fails on released Grails 7.0.0 and 7.1.0.
   
   ## Changes
   
   - Select modern and legacy profile-specific YAML documents in 
`YamlPropertySourceLoader` before merging their values.
   - Make ordinary map/configuration merges preserve the supplied values, 
including nested profile settings and already-resolved profile metadata.
   - Replace tests of the private profile-filter helper with public YAML-loader 
tests for nested/dotted selectors, absent/matching/nonmatching profiles, 
settings maps, and loader reuse.
   - Add backup/clear/restore and isolated-classloader regression tests, plus 
coverage for nested application data resembling profile metadata.
   - Document runtime merge semantics in the configuration guide.
   
   The public method signatures and dependency versions are unchanged. The 
reporter's exact Tomcat deployment has not been reproduced; this fixes the 
demonstrated profile-filtering defect that can cause the reported configuration 
loss.
   
   ## Validation
   
   - Clean Java 17.0.18 builds of both affected modules:
     ```sh
     ./gradlew :grails-bootstrap:clean :grails-core:clean \
         :grails-bootstrap:build :grails-core:build --rerun-tasks --continue \
         --console=plain --quiet --max-workers=4 -PmaxTestParallel=2
     ```
     **352 tests, zero failures, three existing skips.**
   - Repository-wide `codeStyle` and `buildHealth`, plus 
`:grails-bootstrap:validateDependencyVersions` and 
`:grails-core:validateDependencyVersions`: passed. Build health reported 
non-fatal dependency advice only.
   - RAT license audit: passed with a local init script excluding generated 
Eclipse/language-server metadata and compiled `bin` output. The stock task 
initially scanned those generated files; no repository exclusions were changed.
   - `git diff --check`: passed.
   
   The newer `aggregateViolations` / `grails-test-report` verification setup is 
not available on `7.0.x`; this uses the branch's existing checks and module 
test reports. A repository-wide test suite was not run.
   
   ## AI assistance
   
   OpenCode was used for investigation, implementation, review of the diff, and 
test execution.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to