[nrf noup] [west zap] Refinements and fixes to some edge cases#719
Merged
markaj-nordic merged 4 commits intoMay 29, 2026
Merged
Conversation
…tion Some XML cluster definitions do not contain the dedicated 'name' entry in the attribute field, instead they just add name of the cluster as a text to the attribute definition. Added a fallback logic, so that such cases are handled to avoid ending up with null attributes in zcl.json file. This mimics the ZAP loader behavior. Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no>
Fixed the handling of the case when the default cluster definition file (zcl.json) is used as both input and output to the command. Without the fix, the script removes the zcl.json and exits, because the removed file cannot be copied. Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no>
It turns out that the subprocess may return no output if the Chromium cannot use sandbox due to the missing permissions. Added a workaround that raises an exception if the command execution output is empty, so that it can be handled with the fix_sandbox_permissions() call. Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no>
e01ed3e to
8ac2240
Compare
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Apr 29, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the west zap-* helper scripts to better handle a few edge cases around ZAP execution failures, zcl.json syncing, and custom-cluster XML parsing.
Changes:
- Prevent
zap-syncfrom deleting the SDK defaultzcl.jsonwhen the same path is passed as both input and output. - Add a workaround to trigger sandbox-permissions recovery when the ZAP subprocess produces no output.
- Add fallback logic to deduce attribute names from XML when the
nameattribute is missing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
scripts/west/zap_sync.py |
Avoids unlink/copy when -j points at the default zcl.json; adds empty-stdout sandbox workaround. |
scripts/west/zap_gui.py |
Adds the same empty-stdout sandbox workaround to GUI launching. |
scripts/west/zap_common.py |
Adjusts user guidance for “Unknown attribute” and changes stdout printing behavior. |
scripts/west/zap_append.py |
Adds attribute-name fallback logic when parsing custom cluster XML. |
Comments suppressed due to low confidence (1)
scripts/west/zap_append.py:69
get_attribute_name()returnsNonewhen it can’t infer a name, butadd_custom_attributes_from_xml()still records and writes that value intoattributeAccessInterfaceAttributes(which becomesnullin JSON). If the goal is to avoid null attribute entries, skip attributes when the name can’t be deduced (or raise a clear error) instead of appendingNone.
for attribute in cluster.findall('attribute'):
attr_type = attribute.get('type')
attr_name = get_attribute_name(attribute)
if attr_type and attr_type not in types:
attributes_with_missing_types.append({
'cluster': cluster_name,
'attribute': attr_name,
'type': attr_type
})
kkasperczyk-no
approved these changes
May 18, 2026
Contributor
kkasperczyk-no
left a comment
There was a problem hiding this comment.
LGTM, worth to address the copilot comments and checking if it works on desk.
- Refined error handling - Reduced the verbosity Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no>
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
May 28, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Contributor
Author
The valid Copilot comments have been addressed. |
markaj-nordic
pushed a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
May 28, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
markaj-nordic
pushed a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
May 29, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
markaj-nordic
pushed a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
May 29, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
ArekBalysNordic
approved these changes
May 29, 2026
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
May 29, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
rlubos
pushed a commit
to nrfconnect/sdk-nrf
that referenced
this pull request
Jun 3, 2026
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-connectedhomeip#719 Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[nrf noup] [west zap-gui] Refine error handling
It turns out that the subprocess may return no output
if the Chromium cannot use sandbox due to the missing
permissions. Added a workaround that raises an exception
if the command execution output is empty, so that it
can be handled with the fix_sandbox_permissions() call.
Signed-off-by: Marcin Kajor marcin.kajor@nordicsemi.no
[nrf noup] [west zap-sync] Handle overwriting of the default zcl file
Fixed the handling of the case when the default
cluster definition file (zcl.json) is used as both
input and output to the command. Without the fix,
the script removes the zcl.json and exits, because
the removed file cannot be copied.
Signed-off-by: Marcin Kajor marcin.kajor@nordicsemi.no
[nrf noup] [west zap-append] Add fallback to the attribute name deduction
Some XML cluster definitions do not contain the dedicated
'name' entry in the attribute field, instead they just
add name of the cluster as a text to the attribute
definition. Added a fallback logic, so that such cases
are handled to avoid ending up with null attributes in
zcl.json file. This mimics the ZAP loader behavior.
Signed-off-by: Marcin Kajor marcin.kajor@nordicsemi.no
Testing
Tested manually when adding a custom cluster.