Skip to content

Layered config phase 5: identity references and hub roles, a value must name something that exists and a hub list edit sends the UI's role calls - #11

Merged
nbarrett-anet merged 26 commits into
mainfrom
intent-refactor-06
Nov 25, 2026
Merged

nbarrett-anet merged 26 commits into
mainfrom
intent-refactor-06

Conversation

@nbarrett-anet

@nbarrett-anet nbarrett-anet commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A value that names another object is now checked against what exists. Hubs can be named by name or by logical ID. A change to a segment's hub lists makes the save do what the Orchestrator UI does: it sends the hub role calls in the UI's order, then writes device settings with the hub rows the VCO made. A save that fails part-way says what it did, and a second save finishes the job.

Identity references

  • New markers in pyvelo.core: Provides, RefersTo and HubRole. A model walker (walk_fields) finds them, and the phase 3 ref owners now use it too.
  • Reference check. An interface's segment and a QoS rule's backhaul hub must name something that exists. On an edge, what the profile provides counts. A new value that names nothing raises DanglingReferenceError before any request, and the message says what to send instead. A value that was already dangling as read gives a reference_kept warning and is written as it was.
  • The backhaul ref is derived. On edges and profiles, a QoS rule's backhaul hub carries a deviceSettings:backHaulEdge ref. The ref points at the profile's hub service for that segment, looked up by segment object ID and hub logical ID. apply fills in the service. A hub the profile has not saved yet is refused, with advice to save that first. An edge that has no QoS module gets one insert that carries the ref.
  • Hubs by name or logical ID. HubResolver (in pyvelo.config.resolvers.hub) resolves both. HubIdentity is exported from pyvelo.core and pyvelo_intent. The VPN hub lists are now keyed by logical ID, with the name as the label. BackhaulEdge is keyed by edge_logical_id and gains edge_id.

Hub roles

  • The steps. Adding a hub to, or removing one from, a segment's vpn lists gives role steps in the UI's order:

    1. disable backhaul
    2. disable bridge
    3. disable hub
    4. enable hub
    5. enable backhaul
    6. enable bridge

    plan() shows them, and render() lists them.

  • The rules. A list edit that the UI would not allow raises HubListError before any request. This covers a hub in a list where its role doesn't fit, or a hub whose type or name disagrees with its logical ID. A rule that was already broken as read gives a hub_list_as_read warning. Segments whose lists give one hub different roles give hub_roles_disagree.

  • Hub in use. Removing a hub that edge QoS rules still use warns and names the edges. on_hub_in_use="refuse" makes that a refusal. The check reads edgeQOSUsage.

  • The save order:

    1. The device settings version is read.
    2. The hub services are read, with two getEnterpriseServices requests.
    3. Every step is checked, then only the steps not already done are sent.
    4. The services are read again.
    5. Device settings are written with the new hub rows.
    6. The other modules are written.

    A conflict at the version read, before any step, refreshes the state as any conflict does.

  • Part-way failure. A failed step, or a failed write after a step was sent, raises SaveStepError with SaveProgress attached. A second save sees which steps are already done and skips them.

Behaviour changes

  • The VPN hub lists are keyed by logical ID, so a selector on them uses the hub's logical ID or name.
  • A QoS rule's backhaul hub now gets its deviceSettings:backHaulEdge ref on save, on edges and profiles.
  • A profile save that changes a segment's hub lists now sends role calls before the device settings write.
  • A one-module plan_module or update_module refuses a change to the hub lists, because the role calls need the pipeline.
  • ConfigPlan gains steps and check_warnings. A save with no changes but some steps still runs.
  • New exceptions: DanglingReferenceError, HubListError, HubServiceNotFoundError, and SaveStepError (with SaveProgress).
  • Fixed: EnterpriseServiceBase.edge_qos_usage read the alias edgeQosUsage, which dropped every usage row. It now reads edgeQOSUsage.
  • The edge disable wrappers return None when the VCO answers null.
  • The live write guard admits the role calls only for the hub named by PYVELO_IT_HUB.

Known gaps (follow-ups)

  • Planning very large profiles is slower. On a profile with 3,000 QoS and 3,000 firewall rules, plan() takes 5.7–6.1 s, against 5.0–5.3 s before. The reference check takes about 0.2 s of that. The rest is in plan_module and needs its own profiling.
  • A backhaul-only removal doesn't warn. Removing a hub from only the backhaul list gives no "in use" warning.
  • Removing a segment gives no disable steps. That can't happen while segment removal is refused, but it must be added when removal lands.
  • Warnings for already-broken values can attach to the wrong item. They are matched by path, so a positional insert can shift the match. That gives either a spurious refusal or a missed warning.
  • One piece of refusal advice fails as printed. When the hub is already in the Branch-to-Hub list, the DanglingReferenceError advice doesn't work as written. The message says what to leave out.
  • The dry-run docs are behind. A dry run now raises step refusals, and the README's dry-run bullet doesn't say so.
  • Some files are large: pipeline.py (1,867 lines), testing/module_store.py (1,210) and hub_steps.py (826).

Test plan

  • scripts/check.sh on Python 3.14: ruff clean, basedpyright 0 errors, pytest 6394 passed / 2 skipped.
  • The same suite on Python 3.13: it passed (exit 0).
  • The live suite collects 45 tests (19 + 26). None were run.
  • Thirteen tasks, each with a review and fix rounds, then a whole-branch review and one fix wave with a scoped re-review.
  • The live suite has not been run on this branch. It needs a lab hub named by PYVELO_IT_HUB. A run settles whether the VCO accepts the role calls in the UI's order and writes the hub rows the test store assumes.

@nbarrett-anet
nbarrett-anet added this pull request to stack #7 November 24, 2026 14:54
@nbarrett-anet nbarrett-anet changed the title intent refactor 06 Layered config phase 5: identity references and hub roles, a value must name something that exists and a hub list edit sends the UI's role calls Nov 24, 2026
@nbarrett-anet
nbarrett-anet force-pushed the intent-refactor-06 branch 4 times, most recently from c64384f to d16f813 Compare November 25, 2026 03:36
Base automatically changed from intent-refactor-05 to main November 25, 2026 03:38
…d, and the hub lists are keyed by logical ID
…CO does and checks the hub list against the refs; an Edge disable that finds nothing returns None
…usters, and a hub named once fills its list or rule entry
…rvice for that segment, on an edge as on a profile
…nd a hub not yet saved is refused with how to save it first
…aved as one insert carrying its backhaul row
… steps in the UI's order, and one module write alone cannot change those lists
…y call, and one already broken as read is a warning
…y off is refused, not passed as broken as read
…he ones already in place, and writes the hub rows the steps made
…ore the steps, and a dropped hub row is refused
@nbarrett-anet
nbarrett-anet merged commit ca25f30 into main Nov 25, 2026
3 checks passed
@nbarrett-anet
nbarrett-anet deleted the intent-refactor-06 branch November 25, 2026 03:51
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.

1 participant