nick-boss-tech opened a new pull request, #5069: URL: https://github.com/apache/solr/pull/5069
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-3657 ## What happens today **A failed copyField value is reported with the source field only.** When a value cannot be indexed into a copyField destination, the error reads `Error adding field '<source>'='<value>' msg=...`. The message names the source field and ends with the parse error. It does not name the destination that failed. For example, a non-numeric `id` value copied into a numeric destination in the test schema gives this kind of error. The wrapper that builds the message is [DocumentBuilder.java#L286-L297](https://github.com/nick-boss-tech/solr/blob/14edaca577c0c1c38dc50b1ffa632c31fd1613de/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java#L286-L297). ## What this change does **Copy-field errors now name the destination field. Error text changes for clients.** - Each copyField indexing call is wrapped. A failure is rethrown with the prefix `copyField destination '<field>': ` followed by the original message ([DocumentBuilder.java#L390-L406](https://github.com/nick-boss-tech/solr/blob/14edaca577c0c1c38dc50b1ffa632c31fd1613de/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java#L390-L406)). - The status code does not change. A `SolrException` keeps its code. Any other runtime exception becomes `BAD_REQUEST`, as before. - The outer message still names the source field. The destination text appears inside its `msg=` part. - Any client that matches the old message text will see a different message. ## Proof **The focused tests pass at this head. On base production, the pre-fix run has 2 failures.** - `DocumentBuilderTest` 17/17 and `TolerantUpdateProcessorTest` 11/11, verified 2026-10-07 at head `14edaca577c0`. Module check passed. - Pre-fix proof: PASS, with 2 failures on base production. - The new test, [`copyField_unparseableValueForNumericDestination_shouldThrowException`](https://github.com/nick-boss-tech/solr/blob/14edaca577c0c1c38dc50b1ffa632c31fd1613de/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java#L454-L482), checks the destination prefix, the source field name, and the 400 code. - The changed vector test, [`denseVector_incorrectCopyFieldDestinationDimension_shouldThrowException`](https://github.com/nick-boss-tech/solr/blob/14edaca577c0c1c38dc50b1ffa632c31fd1613de/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java#L429-L451), now expects the new message and checks the cause one level deeper. ## Limits - The vector message names the destination twice (`vector5`). This is cosmetic and left as is. I can open a follow-up for it on request. - The new wrapper carries the code, message and cause only. Other `SolrException` fields are not copied, as the existing outer wrapper also does. This is left as is. I can open a follow-up on request. Changelog: `changelog/unreleased/SOLR-3657-copyfield-error-names-destination.yml` ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
