Skip to content

Fix IS-04 grouphint role scoping - #915

Open
iibaranov-IG wants to merge 1 commit into
AMWA-TV:masterfrom
iibaranov-IG:fix/is0401-grouphint-role-scope
Open

iibaranov-IG wants to merge 1 commit into
AMWA-TV:masterfrom
iibaranov-IG:fix/is0401-grouphint-role-scope

Conversation

@iibaranov-IG

@iibaranov-IG iibaranov-IG commented Oct 1, 2026 •

Copy link
Copy Markdown

Fixes #859.

IS-04-01 test_23 now checks grouphint role uniqueness separately for Senders and Receivers within each group scope. This permits matching roles across signal-flow directions while retaining failures for duplicate roles among resources of the same type.

Regression coverage includes:

  • matching Sender/Receiver role passes
  • duplicate Sender role fails
  • duplicate Receiver role fails

Validated with:

  • python -m unittest tests/test_is0401_grouphint.py -v
  • flake8 --exclude=.venv .
  • python -m compileall -q nmostesting tests

@garethsb

garethsb commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The change to nmostesting/suites/IS0401Test.py LGTM. I'm certainly not against the introduction of unit and regression tests for the test suite itself as proposed here, but we surely need a documented way to run such tests and to do it in GitHub CI? @jonathan-r-thorpe what do you think?

If we accept the unit tests, they will need AMWA copyright and license, as per the repo's CONTRIBUTING.pdf.

@garethsb

Copy link
Copy Markdown
Contributor

Thanks, this looks good. Could you also add the following?

BCP-002-01 says an empty string in the grouphint tag doesn't indicate membership of any group, and an empty array should be handled like a missing tag. Currently test_23 fails an empty array, and treats "" as a group definition, which then fails with "too few parameters". With the change below, both cases get OPTIONAL. I'll also raise a PR on nmos-parameter-registers to make the grouphint wording clearer.

In nmostesting/suites/IS0401Test.py:

                         for tag_name, tag_value in resource["tags"].items():
                             if tag_name != grouphint:
                                 continue
-                            if not isinstance(tag_value, list) or len(tag_value) == 0:
-                                return test.FAIL("Group tag for {} {} is not an array or has too few items"
+                            if not isinstance(tag_value, list):
+                                return test.FAIL("Group tag for {} {} is not an array"
                                                  .format(resource_name.capitalize().rstrip("s"), resource["id"]))
-                            found_groups = True
                             for group_def in tag_value:
+                                # An empty string indicates no group membership
+                                if group_def == "":
+                                    continue
+                                found_groups = True
                                 group_params = group_def.split(":")
                                 group_scope = "device"

In tests/test_is0401_grouphint.py:

    def test_empty_string_indicates_no_group(self):
        sender = self.resource("sender-a")
        sender["tags"][GROUPHINT] = [""]
        result = self.run_test_23([sender], [])

        self.assertEqual(TestStates.OPTIONAL, result.state)

    def test_empty_array_indicates_no_group(self):
        sender = self.resource("sender-a")
        sender["tags"][GROUPHINT] = []
        result = self.run_test_23([sender], [])

        self.assertEqual(TestStates.OPTIONAL, result.state)

Both new tests fail on the current head of this PR and pass with the change. flake8 is clean.

Co-authored-by: Gareth's 🤖 buddy

@garethsb

Copy link
Copy Markdown
Contributor

The register clarification is now in AMWA-TV/nmos-parameter-registers#80. It makes role uniqueness per resource type and covers the empty array and empty string cases that the change above handles.

Co-authored-by: Gareth's 🤖 buddy

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IS-04-01 test_23 not working with Node having both senders and receivers and sharing a group name

2 participants