Skip to content

[code sync] Merge code from sonic-net/sonic-utilities:202605 to 202608#404

Merged
mssonicbld merged 2 commits into
Azure:202608from
mssonicbld:sonicbld/202608-merge
Jul 14, 2026
Merged

[code sync] Merge code from sonic-net/sonic-utilities:202605 to 202608#404
mssonicbld merged 2 commits into
Azure:202608from
mssonicbld:sonicbld/202608-merge

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator
* 351be6e8 - (origin/202605) fix GCU patch sorter crash on create-only field change referenced by a leaf-list (#4681) (2026-07-13) [mssonicbld]<br>```

mssonicbld and others added 2 commits July 13, 2026 19:44
…a leaf-list (#4681)

#### Why I did it

The GCU (`generic_config_updater`) patch sorter aborted with an unhandled `ValueError ("'<x>' is not in list")` when a `config replace` / apply-patch changed a create-only PORT field (e.g. `lanes` during a breakout) while that port was a member of a multi-member leaf-list such as `ACL_TABLE.ports`.

During move validation the sorter transiently removes the port from the leaf-list in the simulated intermediate config, but a still-present leafref to it then fails to resolve (`list.index` raises `ValueError`). The exception propagated out of `RemoveCreateOnlyDependencyMoveValidator._validate_member` and aborted the whole sort, so any GCU/config-replace-based breakout failed on a realistic switch config (auto-rollback). The native `config interface breakout` path avoids GCU and is unaffected.

#### How I did it

Treat an unresolvable reference in a simulated intermediate config as an *invalid move*: catch the error in `_validate_member` and return `False` so the DFS backtracks to a valid ordering instead of letting the exception propagate and abort the whole sort.

#### How to verify it

Added a regression test that reproduces the create-only PORT field change against a multi-member `ACL_TABLE.ports` leaf-list and asserts the move is rejected rather than raising:

```
python3 -m pytest tests/generic_config_updater/patch_sorter_test.py \
 -k test_validate__unresolvable_ref_in_simulated_config__move_rejected
```

Verified the new test **fails** with the original code (raising the reported `ValueError`) and **passes** with the fix.

#### Which release branch to port

- [x] 202605

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
@mssonicbld mssonicbld merged commit 4d44d0c into Azure:202608 Jul 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant