feat(webex): skip records with unresolved references

Merged
PT
2d ago
+378-2

Problem

A Webex mapping can reference records of an earlier mapping that its filters removed, for example a workspace whose locationId points to a location filtered out of the LocationSite mapping. A scalar reference is passed to the destination without a check, so the Infrahub destination stops the run because it cannot find the peer. The only workarounds today are lists of excluded IDs in the config, or a parent resource that sends one workspaces request per location.

Change

New opt-in Webex resource option skip_unresolved_references (default false). When it is on, after filters and transforms:

  • a record whose single reference matches no loaded record of the referenced mapping is dropped;
  • in a list reference, only the unresolved items are removed and the record is kept;
  • empty reference values are left as they are;
  • the referenced mapping must load first (order), or the adapter raises a ValueError;
  • each mapping that loses records or list items logs one warning with the counts and up to 20 unresolved values.

The change is limited to the Webex adapter, its tests, its docs page and a changelog fragment.

Testing

  • Webex adapter tests: 46 passed. Full test suite: 417 passed, 6 skipped.
  • Ruff, ty, yamllint and pylint on the changed Webex files pass.
  • Tested against a Webex organization and a local Infrahub: all workspaces were read in one request, rooms in filtered-out locations were skipped with a warning, and a second run found no differences.