Skip to content

fix(dr-egeria): link/detach commands that reported success but sent nothing - #566

Merged
dwolfson merged 4 commits into
odpi:mainfrom
dwolfson:fix/dre-detach-member
Nov 9, 2026
Merged

dwolfson merged 4 commits into
odpi:mainfrom
dwolfson:fix/dre-detach-member

Conversation

@dwolfson

@dwolfson dwolfson commented Nov 9, 2026

Copy link
Copy Markdown
Member

fix(dr-egeria): link/detach commands that reported success but sent nothing

Branch: dwolfson:fix/dre-detach-member → odpi/egeria-python:main. Three signed commits on top of #563 (0fdf951a): 5032e4c1 (routing), 5b604591 (unresolved-end guards + release notes) and 77d936a7 (release-note wording: 21 false successes; 10 already failed, unchanged).

Users affected before 6.2.28: 21 Dr.Egeria phrasings, listed below, sent no request to Egeria and still reported success. The relationship was not created or removed. Re-run any document that used them.

The bug

Seen live on pyegeria 6.2.27 (2026-11-09): this block reported "Operation completed" but sent no request, and the CollectionMembership was still there afterwards.

## Detach Member from Collection
### Collection Id
...
### Element Id
...

CollectionLinkProcessor.apply_changes (md_processing/v2/collection_manager_processor.py) chose its call by substring of the canonical object type.

  • "Detach Member from Collection" is not registered by name. It resolves through the compact spec's alternate names to "Add Member to Collection", so the object type is "Member to Collection". That is where the rendered heading "Detach Member to Collection" came from.
  • The Detach branch tested only "Collection Membership" and "Collection Member", so nothing matched.
  • No elif ran, yet the code after the chain still logged success and returned "Operation completed".

Every phrasing that matched no branch: 21 false successes, plus 10 that already failed (unchanged)

I checked all 154 Link/Detach phrasings registered to CollectionLinkProcessor, through the real setup_dispatcher() registry, and dispatched each candidate.

21 silent no-ops: valid command, passed validation, sent nothing, reported success.

# Phrasing Relationship Now calls
1 Detach Member from Collection CollectionMembership _async_remove_from_collection
2 Detach Member from Folder CollectionMembership _async_remove_from_collection
3 Detach Member->Collection CollectionMembership _async_remove_from_collection
4 Detach Member CollectionMembership _async_remove_from_collection
5 Remove Member from Collection CollectionMembership _async_remove_from_collection
6 Remove Member from Folder CollectionMembership _async_remove_from_collection
7 Remove Member->Collection CollectionMembership _async_remove_from_collection
8 Remove Member CollectionMembership _async_remove_from_collection
9 Unlink Member from Collection CollectionMembership _async_remove_from_collection
10 Unlink Member from Folder CollectionMembership _async_remove_from_collection
11 Unlink Member->Collection CollectionMembership _async_remove_from_collection
12 Unlink Member CollectionMembership _async_remove_from_collection
13 Add Collection to Resource ResourceList _async_attach_collection
14 Add Collection from Resource ResourceList _async_attach_collection
15 Attach Collection to Resource ResourceList _async_attach_collection
16 Attach Collection from Resource ResourceList _async_attach_collection
17 Link Collection to Resource ResourceList _async_attach_collection
18 Link Collection from Resource ResourceList _async_attach_collection
19 Detach Collection from Resource ResourceList _async_detach_collection
20 Remove Collection from Resource ResourceList _async_detach_collection
21 Unlink Collection from Resource ResourceList _async_detach_collection

For rows 13–21, the object type "Collection to Resource" matched neither the old Link test "Attach Collection" nor the old Detach tests "Attach Collection" / "Resource List".

10 that already failed, unchanged: they never reported success. These are registered but have no compact spec, so validation already stops them with "No specification found for command: …". I confirmed this through dispatch().

# Phrasing Would map to
22 Link Product-Product DigitalProductDependency
23 Detach Digital Product from Digital Product DigitalProductDependency
24 Remove Digital Product from Digital Product DigitalProductDependency
25 Unlink Digital Product from Digital Product DigitalProductDependency
26 Detach Business Capability from Digital Service DigitalSupport
27 Remove Business Capability from Digital Service DigitalSupport
28 Unlink Business Capability from Digital Service DigitalSupport
29 Detach Business Capability from Supporting Capability BusinessCapabilityDependency
30 Remove Business Capability from Supporting Capability BusinessCapabilityDependency
31 Unlink Business Capability from Supporting Capability BusinessCapabilityDependency

So the false successes number 21, not 31. Rows 22–31 fail at validation, before apply_changes runs, both before and after this PR.

The other 123 phrasings route to the same relationship as before, so their behaviour is unchanged.

The fix

Commit 1 (5032e4c1): routing

  • Route on the compact spec's OM_TYPE (CollectionMembership, ResourceList, AgreementItem, …). Every phrasing of a command resolves to the same spec, so this does not depend on how the canonical name is worded. A phrase table remains only as a fallback for phrasings that have no spec.
  • An unmatched type now fails loudly. _relationship_type() raises ValueError(... nothing was sent to Egeria), and execute() reports that as a failure result. The Link and Detach chains both end in else: raise.
  • ResourceList attribute name. These branches read Resource Id, but the compact spec declares Collection Id + Element Id, and validation requires Element Id. So even routed correctly, the resource GUID would have been None. Both names are now accepted.

Commit 2 (5b604591): no detach sends an unresolved end (read-back P3)

  • New _require_guids(attributes, *names). Every detach branch now refuses with "…: did not resolve to a GUID: (); nothing was sent to Egeria" instead of sending None. That covers CollectionMembership, ResourceList, DataDescription, DigitalSubscriber, BusinessCapabilityDependency, DigitalSupport, DigitalProductDependency (pair path) and AgreementItem (pair path).
    • Reachable today through validation: Collection Id (Member, Data Description) and Subscription Id (Digital Subscriber) are optional in their specs, so leaving one out reached the API as None.
    • Backstop only: the required ends that don't resolve are already blocked by validation ("Execution blocked: Referenced element … not found"). The guard is a second line of defence for those.
  • Detach Agreement Actor:
    • The pair path called self._async_resolve_agreement_actor_relationship_guid, which existed only on CollectionManagerProcessor, so it died with AttributeError. That method is now shared.
    • It fails when Agreement Name or Actors did not resolve, or when no AgreementActor relationship exists for any listed actor. Before, it logged a warning and returned "Operation completed".
    • If only some listed actors are not linked, it detaches the others and adds a warning.
  • docs/release-notes/6.2.28.md (new): a Fixed section that lists the 21 phrasings and tells users to re-run, plus the guards.

Tests

tests/micro-tests/test_collection_link_detach_dispatch.py (35 cases) uses the real setup_dispatcher() and V2Dispatcher.dispatch() with a fake client:

  • Commit 1:
    • Detach/Remove/Unlink Member variants each send exactly one remove_from_collection(collection_guid, element_guid).
    • Add Member still sends one add.
    • Collection to/from Resource attach and detach route correctly.
    • An unmatched type raises on both Link and Detach and makes no calls.
    • Every registered Link/Detach phrasing resolves to a handler.
  • Commit 2, for each of the seven pair-detach types:
    • With both ends resolved, it sends exactly one call with the right GUIDs.
    • With an end left out, the dispatcher result is failure, it makes no call, and the message names the attribute.
    • Called directly, the processor refuses an unresolved end, even when validation let it through.
    • Agreement Actor with no Actors fails, and an actor that isn't linked fails.
    • Agreement Actor by pair detaches the relationship it finds. This case was AttributeError before.
  • Run against the previous code:
    • Commit 1's cases: 10 of 11 fail on upstream; Add Member is the regression guard that passes.
    • Commit 2's new cases: 13 of 35 fail on 5032e4c1, all of them exactly the behaviour this commit adds.

Full micro-suite (uv run -p 3.13 pytest tests/micro-tests/, counts from JUnit XML): 2414 tests: 2411 passed, 0 failed, 0 errors, 3 skipped (Python 3.13, on 5b604591 atop 0fdf951a)

No Egeria writes. Tests only. There is no live proof: a real attach-then-detach on a scratch membership is two Egeria writes and needs the owner's word.

Not proven / follow-ups (not in this PR)

  • _async_resolve_agreement_actor_relationship_guid matches elementGUIDAtEnd1/elementGUIDAtEnd2 on _async_get_relationships output. That shape is unproven live. If it is wrong, the detach now fails with "no AgreementActor relationship found" rather than reporting success.
  • Rows 22–31 are dead aliases. They should either get alternate names on the matching compact specs or be dropped from build_command_variants.
  • The Link branches still pass unresolved ends straight through. Required ends are blocked by validation, but optional ones are not: Collection Id on Add Member and Data Description, and Subscription Id on Subscriber. That is the same guard, on the create side.
  • apply_changes returns raw_block for a verb outside Link/Detach, and execute() then reports "Executed …".

🤖 Generated with Claude Code

CollectionLinkProcessor picked its link/detach call by substring of the
canonical object type. "Detach Member from Collection" resolves (via the
compact spec's alternate names) to "Add Member to Collection", so the object
type is "Member to Collection" -- which the Detach branch's
"Collection Membership"/"Collection Member" tests never match. No request
was sent, yet the command logged success and returned "Operation
completed". Seen live on pyegeria 6.2.27: the CollectionMembership stayed.

Route both branches on the compact spec's OM_TYPE instead (every phrasing
of a command resolves to the same spec), with a phrase table only as a
fallback for phrasings no spec resolves. A relationship type with no
handler now raises (-> failure result) instead of "Operation completed".

Of the 154 Link/Detach phrasings registered to this processor, 31 matched
no branch before this change. 21 of them resolve to a compact spec, pass
validation, and were silent no-ops reporting "Operation completed":
- Detach/Remove/Unlink Member [from Collection|from Folder|->Collection|]
  (12)
- Add/Attach/Link Collection to|from Resource and Detach/Remove/Unlink
  Collection from Resource (9): "Collection to Resource" matched neither
  "Attach Collection" nor "Resource List"
The other 10 (Link Product-Product; Detach/Remove/Unlink Digital Product
from Digital Product, Business Capability from Digital Service / from
Supporting Capability) have no compact spec and already fail validation
before apply_changes; they now also map to a handler.

The ResourceList branches also read a "Resource Id" attribute, but the
compact spec names that end "Element Id", so even a routed call would have
sent None. Accept either name, and refuse to send a ResourceList or
CollectionMembership request with an unresolved end.

Tests go through the real setup_dispatcher() registry and dispatch().

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…cesses

Follow-up to the routing fix, from the Architect read-back of 5032e4c.

Every CollectionLinkProcessor detach branch now refuses, naming the
attribute, when an end did not resolve to a GUID, instead of sending None
to Egeria: CollectionMembership, ResourceList, DataDescription,
DigitalSubscriber, BusinessCapabilityDependency, DigitalSupport, and the
pair paths of DigitalProductDependency and AgreementItem. Collection Id
(Member, Data Description) and Subscription Id (Digital Subscriber) are
optional in their compact specs, so leaving one out reached the API as
None; for required ends validation already blocks an unresolved
reference and this is a backstop.

Detach Agreement Actor without an explicit relationship GUID called
_async_resolve_agreement_actor_relationship_guid, which was defined only
on CollectionManagerProcessor, so it died with AttributeError. Share the
method. The detach now fails when Agreement Name or Actors did not
resolve, or when no AgreementActor relationship exists for any listed
actor (it used to warn and return "Operation completed"); if only some
are unlinked it detaches the rest and adds a warning.

docs/release-notes/6.2.28.md lists the 21 phrasings that were silent
no-ops before 6.2.28 (re-run documents that used them) and the 10 that
matched no branch but already failed validation for lack of a spec.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
… unchanged

Make the 6.2.28 note's second group explicit: the 10 spec-less phrasings
(Link Product-Product; Detach/Remove/Unlink Digital Product from Digital
Product, Business Capability from Digital Service / from Supporting
Capability) fail with "No specification found" before and after this
change and were never false successes. Nothing to re-run for them.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	docs/release-notes/6.2.28.md
@dwolfson
dwolfson merged commit b533b64 into odpi:main Nov 9, 2026
6 checks passed
dwolfson added a commit to dwolfson/egeria-python that referenced this pull request Nov 9, 2026
…ilter-kwargs

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	docs/release-notes/6.2.28.md
#	pyegeria/omvs/asset_catalog.py
#	pyegeria/view/format_set_executor.py
#	pyegeria/view/microflow.py
#	tests/micro-tests/test_rs_egeria_tier.py
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