Aias00 opened a new issue, #8027:
URL: https://github.com/apache/shenyu/issues/8027

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues.
   
   ### Current Behavior
   
   TagServiceImpl.update loads the persisted tag, but builds its effective 
update object from the partial DTO and only restores parentTagId/ext. 
updateSubTags replaces the persisted node in its working map with that partial 
object. buildExtParamByParentTag then copies its possibly null tagName/tagDesc 
into descendants' ext ancestry. Meanwhile updateByPrimaryKeySelective preserves 
the edited tag's original database fields when those DTO fields are null. The 
successful update therefore leaves the actual parent row and descendant 
ancestry inconsistent.
   
   ### Expected Behavior
   
   Fields omitted from an accepted partial update should retain their persisted 
values both in the edited tag row and every descendant ancestry representation. 
Rebuild descendants from a fully merged effective tag, preserving unrelated ext 
metadata and existing transaction rollback behavior.
   
   ### Steps To Reproduce
   
   1. Create parent tag C with a non-empty name/description and descendant D.
   2. Send PUT /tag/id/{C} with only tagDesc changed, omitting tagName and 
parentTagId. TagDTO has no requirement forcing a complete replacement payload.
   3. C's selective database update retains its old name, but D.ext.parent is 
rebuilt from a TagDO whose name is null.
   4. Repeat with only a name change: the existing description can be omitted 
from descendant ancestry.
   5. Also test a parent-only move and multiple descendant levels.
   
   These are proposed service/API regression tests based on source and SQL 
semantics, not an executed database reproduction.
   
   ### Environment
   
   - ShenYu master / 2.7.2-SNAPSHOT, commit 
`34f2ed036747936a5e28aea2c94cd9b3cddcce47`.
   - Source-inspection report. The reporting environment has no available JDK; 
no Maven/JUnit, live backend or Redis reproduction is claimed.
   - Existing runtime behavior; unrelated to proposed plugin orchestration.
   
   ### Debug logs
   
   No runtime logs captured. Code evidence follows.
   
   ### Code evidence
   
   - [Partial update object passed to descendant 
rebuild](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/TagServiceImpl.java#L95-L113)
   - [Ancestry copies possibly missing 
name/description](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/TagServiceImpl.java#L256-L268)
   - [buildTagDO copies omitted fields as 
null](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/TagDO.java#L157-L176)
   - [Edited row selectively retains null 
fields](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-admin/src/main/resources/mappers/tag-sqlmap.xml#L151-L174)
   - [Optional update 
fields](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/TagDTO.java)
   
   ### Suggested fix direction
   
   Merge the DTO's supplied fields into a copy of the persisted tag before 
computing its ancestry and propagating changes to descendants. Define omitted 
versus explicitly cleared fields consistently with the supported update 
contract; do not switch selective SQL to destructive full replacement.
   
   ### Acceptance criteria
   
   - Description-only, name-only and parent-only updates preserve omitted 
name/description values in every descendant's ancestry.
   - Parent moves still rebuild the correct complete ancestor chain.
   - Unrelated ext fields remain intact; transaction rollback tests continue to 
pass.
   - Include mapper/API behavior with omitted JSON fields rather than only full 
DTOs.
   
   ### Related work and scope
   
   Follow-up to closed #7772. That fix restores parent/ext ancestry but does 
not merge the persisted name and description into the partial update object 
before descendant propagation. This report is the remaining omitted-field case, 
not a duplicate of the already-fixed missing-ext reconstruction. Suggested 
priority: P2.
   


-- 
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