Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions PYEGERIA_ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ re-test candidates moved into *Awaiting re-test* below the open sections.
create-from-template) and 7 (`viewElementGUID`) are still open.

**Open pyegeria items**
- ISSUE-182: an element hidden by zone security (403-020) was reported as AUTHORIZATION_ERROR_401 (fixed in 6.2.34)
- ISSUE-181 (HIGH): Dr.Egeria Parent ID on an Update deleted an unrelated relationship of the parent type, e.g. a folder's member (fixed for 6.2.32; moves to the Appendix on release)
- ISSUE-174: link methods discarded the new relationship GUID (fixed for 6.2.19; moves to the Appendix on release)
- ISSUE-155: pyegeria gaps against Egeria `main` since 6.2 (omvs_audit + source diff, V6.2..05a5e982)
Expand All @@ -194,6 +195,56 @@ into the entry now, so it isn't rediscovered from scratch later.

---

### ISSUE-182: an element hidden by zone security is reported as "AUTHORIZATION_ERROR_401"

**Layer:** pyegeria · **Severity:** medium: misleading diagnosis, no wrong data · **Status:** fixed 2026-11-10 on branch `docs/issue-182-unauthorized-banner`; released in 6.2.34 · **Found:** 2026-11-10 on 6.2.32 (laz), reading a Report zoned `['peterprofile']` as erinoverview; the Architect confirmed `is_not_visible_error` is True for it.

**What:** `get_element_by_guid` as erinoverview on that Report, through `BaseServerClient._async_get_element_by_guid_`, logs a banner that starts:

```
=> AUTHORIZATION_ERROR_401
=> User not authorized received for user - `erinoverview`.
```

Egeria actually said something different. The reply was wrapped in HTTP 200, with `relatedHTTPCode` 403, `OPEN-METADATA-SECURITY-403-020` and `exceptionClassName` …`UserNotAuthorizedException`: the element is in a zone this user can't see. Those fields appear lower down, under "Egeria error information", but the first two lines say 401.

**Why it happens:**
- `_base_server_client._async_make_request` raises `PyegeriaUnauthorizedException` for two different failures:
- a transport 401 (a bad or expired token);
- an Egeria-wrapped 401/403 whose exception is a `UserNotAuthorizedException` (`_is_authorization_failure`).
- `PyegeriaUnauthorizedException.__init__` (`pyegeria/core/_exceptions.py`) always uses `PyegeriaErrorCode.AUTHORIZATION_ERROR`, whose `http_code` is 401 and `message_id` is `AUTHORIZATION_ERROR_401`. The `message_id` becomes `pyegeria_code`, the banner's first line, whatever Egeria returned.

**Why it matters:** the two need opposite responses.
- A 401 means "re-authenticate": get a new token or check the credentials. The error's own `user_action` says the same.
- A 403-020 means "this element is hidden from you by zone security": a new token changes nothing.

An operator reading the banner chases credentials. In the Portal, one zoned Report on a Dashboard Sheet then looks like a broken sign-in.

Related: `PyegeriaErrorCode` labels 401 `AUTHORIZATION_ERROR` and 403 `AUTHENTICATION_ERROR`, which is the wrong way round. A 401 is unauthenticated; a 403 is authenticated but not permitted.

**Proposed fix:**
- Build the banner from what Egeria returned. When `additional_info` carries `relatedHTTPCode` / `exceptionErrorMessageId`, the first lines would read, for example, "403 OPEN-METADATA-SECURITY-403-020: not visible to user `erinoverview`", followed by Egeria's own message and user action.
- Keep `AUTHORIZATION_ERROR_401` and its "check your credentials" action only for a real transport 401.
- Keep the exception class (`PyegeriaUnauthorizedException`, a `PyegeriaAPIException`) and `related_http_code` unchanged, so callers don't break. That covers the 401 retry in `_async_make_request` and `dashboard_resolver.is_not_visible_error`, which already checks for 403.
- Optionally, distinguish the two cases on the exception itself (e.g. `e.not_visible` or `e.message_id`), so callers don't have to parse text.

**Test to add:** an Egeria-wrapped 200 response with `relatedHTTPCode` 403, `exceptionClassName` `org.odpi.openmetadata.frameworks.openmetadata.ffdc.UserNotAuthorizedException` and `exceptionErrorMessageId` `OPEN-METADATA-SECURITY-403-020`. Check that:
- the exception is still a `PyegeriaUnauthorizedException`;
- `related_http_code` is 403;
- `str(e)` names 403 and the message id and doesn't say `AUTHORIZATION_ERROR_401`.

Also check that a bare transport 401 still says `AUTHORIZATION_ERROR_401` and its credentials action.

**Done:**
- `PyegeriaErrorCode.FORBIDDEN_ERROR` is new: message_id `AUTHORIZATION_ERROR_403`, message "HTTP Code: 403 <Egeria's message, starting with its id> (user `<user>`)", and a "a new token will not help" action.
- `PyegeriaUnauthorizedException` uses it when Egeria's `relatedHTTPCode` is 403, and sets `egeria_message_id`. A transport 401 or a wrapped 401 is unchanged.
- Class and `related_http_code` are unchanged, and the token retry still fires only on a transport 401.
- The message_id keeps the `AUTHORIZATION_ERROR` prefix and the text carries "HTTP Code: 403". This is because the Portal's `_is_auth_error` helpers match those substrings (tech_catalog and audit handlers match only "AUTHORIZATION_ERROR"/"NOT_AUTHORIZED"). With it, `egeria_error_mapping._auth_status` now answers 403 instead of 401.
- trellis classifies by class and by the OPEN-METADATA-SECURITY-403 marker. Egeria's sentence is still the first marker occurrence, so `_refusal_sentence` is unchanged.
- **The 401/403 name swap is not changed.** `AUTHORIZATION_ERROR_401` is matched as text by the Portal (10 handlers, both stacks) and trellis (`egeria_clients.classify_token_check_failure`), so renaming it is a coordinated change for later. `AUTHENTICATION_ERROR` (403) is unused and marked so.

Tests: `tests/micro-tests/test_issue_182_forbidden_banner.py`.

### ISSUE-181: Parent ID on an Update deletes an unrelated relationship of the parent type (e.g. a folder's member)

**Layer:** pyegeria (Dr.Egeria) · **Severity:** HIGH: silent membership loss, no error or warning · **Status:** fixed 2026-11-10 on branch `fix/ops-commands-review` (the proposed fix below; separate commit from ISSUE-175..180), targets 6.2.32 · **Found:** 2026-11-10, by the publish-portal-specs builder while renaming `ReportSpecFolder::EgeriaPortal` (fe5aad27); confirmed by the Architect's read-back of consumer folders phase 1 (e71e4e90).
Expand Down
128 changes: 128 additions & 0 deletions docs/release-notes/6.2.34.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# pyegeria 6.2.34

pyegeria 6.2.34 makes these changes:
- A Report can name a collection by qualifiedName (W1).
- A Report can show a saved query's answer, cached or live, with parameters (Route B).
- Every trend point says whether its number is exact (W2).
- Dr.Egeria's Saved Query commands take Formula and Formula Type.
- An element hidden by zone security is reported as a 403, not a 401 (ISSUE-182).

## New

- **`saved_query`: a saved query as the source of a Report (Route B).**
`saved_query(client, name, mode="cached"|"live", output="count"|"list")` is a registered analytic
function, so a Report can name a SavedQuery by qualifiedName and a tile can show its answer as a count
KPI or a list.
- **As the viewer:** the SavedQuery is found by an exact qualifiedName find, as the viewer, so zones
apply.
- **cached:** the members of its Results Set, `asOf` its last refresh. A query never refreshed is "not
established", not 0.
- **live:** runs the stored request now with the viewer's token. It reads every page (an empty page is
the end), up to 20 pages of 500. A read that stops at that bound is a lower bound: `value` is None,
`capped` is true and `display` reads "≥N".
- **Absence is never 0:** a missing, ambiguous, hidden (not_permitted) or failed read is
`not_established`, with the reason.
- **Security:** a SavedQuery's Query URL is authored data, so it never chooses where the viewer's token
goes. The same class of problem was behind the Portal's `?url=` leak. The URL is only checked, never
followed:
- its path must be the one allow-listed endpoint, MetadataExpert
`metadata-elements/by-search-conditions`, given relative or under this client's own
`/servers/<view server>`;
- the stored host is not the boundary, because the URL is never followed: a different http(s)
scheme or host:port is accepted and noted in the result's `how`. The Portal stores the
in-container URL, `https://host.docker.internal:9443/...`, while EA, notebooks and the CLI use
`https://localhost:9443`;
- refused with a sentence, and nothing is sent: user info, a scheme-relative or non-http(s) URL, a
query string or fragment, an encoded or dotted path, another view server, a path off the
allow-list, or a body that isn't a FindRequestBody;
- the request is made by pyegeria's own `find_metadata_elements` on the viewer's client.
- **Parameters: a saved query as a template, with one model shared with the Portal.**
- **Declaring:** `additionalProperties.parameters` is a JSON list of `{name, type, default?,
searchPath?, requestPath?}`, using the Portal's types (string, integer, number, boolean, list), with
no coercion. There are no placeholders, so the stored bodies stay runnable: Egeria's Smart Collections
connector runs `queryURL`/`queryRequestBody` literally.
- **`searchPath`** (default `name`) is where the Portal applies a value, in its stored search
(`formula`, else `additionalProperties.searchSpec`). **`requestPath`** is where live mode applies it,
in `queryRequestBody`: typed, as a value only, never a key and never the URL.
- **The effective value, by the Portal's own rule:** the value given, else the stored search value,
else the default. The Portal records this map for every declared name as `lastRefreshParams`. A
cached answer is returned only when that record equals it, and is labelled "as of <time>, for k=v,
...". For other values, or when no values were recorded, it is refused, pointing to live mode.
- **A registered Smart Collection** (`additionalProperties.smartCollection == "true"`, the Portal's
own test) is re-run by Egeria's SmartCollectionsMembershipManager about every 30 minutes, from its
stored request. Its cached answer therefore stands only for the stored effective values, whatever a
refresh recorded. It is labelled "kept current by Egeria", needs no Portal refresh time, and is
refused for other values, pointing to live mode.
- **Live mode:** every parameter's effective value is set at its `requestPath`. That value comes
from `formula` (what the Portal ran), never from the value already in `queryRequestBody`, since the
two can differ (the Portal strips paging from `formula`). A declared `pageSize` becomes the read's
page size; `startFrom` stays the read's own. A parameter with no `requestPath` applies to the
Portal's search only, so it is refused live when it's given, or when its value would be a default.
- **Refused with a sentence, before anything runs:** an undeclared name, a wrong type, a string with
control characters or over 512 characters, a path that isn't a plain dotted path or points nowhere,
or params on a query that declares none.
- The shared Portal-shaped fixture is `tests/micro-tests/data/saved_query_portal_shaped.json`, a
byte-identical copy of the Portal's own (9ff668d1). Its `cases[]` are the contract both sides test.
- The Portal's `/api/insights/search` formula isn't run here: it's the Portal's own API. Use cached
mode, or save the query as a Smart Collection, which stores the find request.

- **Dr.Egeria: `Create Saved Query` / `Update Saved Query` take Formula and Formula Type.** A seeded
SavedQuery can now carry its query: the Portal's insights refresh re-runs `formula` (with formulaType
`egeria-insights-search-v1`). Both are Advanced-level attributes of the `Saved Query Base` bundle, and
`SavedQueryProcessor` writes them as DataSet's `formula` / `formulaType` on create and on update. The
advanced template and the report specs are regenerated.

- **Collection Members takes the collection's qualifiedName (W1).** The "Collection Members" report spec
required `collection_guid`, so a Report had to pin a GUID, and its dashboard tile broke
(CLIENT_ERROR_400) once the collection was re-created. The spec now takes any one of `collection_guid`,
`collection_qname` or `collection_name`.
- **Precedence:** `get_collection_members` resolves a name: qualifiedName, then display name, then GUID.
So a stale GUID beside a valid qualifiedName (what a merge update leaves) no longer asks Egeria for
the dead GUID. GUID-only calls are unchanged.
- **A name that matches nothing** raises `PyegeriaNotFoundException` (relatedHTTPCode 404) naming the
collection, before any members request. Before, it surfaced as "Neither server_guid nor server_name
were provided", or as the name sent in the URL as a GUID.

## Fixed

- **An element hidden by zone security is no longer reported as a 401 (ISSUE-182).**
- **Before:** when Egeria refuses a read because the element is in a zone the user can't see
(`OPEN-METADATA-SECURITY-403-020`, wrapped in relatedHTTPCode 403), pyegeria said
"AUTHORIZATION_ERROR_401 … User not authorized" and told you to check your credentials.
- **Now:** it says `AUTHORIZATION_ERROR_403` and "HTTP Code: 403 OPEN-METADATA-SECURITY-403-020 <Egeria's
message> (user `…`)". The exception carries `egeria_message_id`.
- **Unchanged:** the class (`PyegeriaUnauthorizedException`), `related_http_code`, and a transport 401 (still
`AUTHORIZATION_ERROR_401`, still retried once with a new token). A 403 is never retried.
- **If you match the text:** "AUTHORIZATION_ERROR" still matches both. "AUTHORIZATION_ERROR_401" now matches
only a real 401.

## Changed

- **Every trend point says whether its number is exact (W2).** `metric_trend` points now carry
`measurement = {exact, capped, at_least, how, reasons}`. A scalar point also carries `display`.
- **`how`:** "native" (Egeria's count), "find" (a short find page), "find-capped", "not-measured",
"error" (the snapshot failed), "mixed", or "measured" (the target made no element count).
- **A lower bound is never a bare number:** a count that stopped at the find page cap keeps its value
None, and its `display` reads "≥500" (the cap). The reason, with the bound, is in
`measurement.reasons`. An enclosing `recording_unmeasured()` still collects every note, as before.
- **SERIES:** a trend whose only inexact points are lower bounds is now drawn. Each bound is plotted at
its bound, with a "≥N" label and a tooltip, and the subtitle says "N of M points are lower bounds".
A trend with a point that has no number at all still draws no chart, and says why. BAR, PIE and DICT
are unchanged: no chart over an unmeasured count.
- **`strict=True`** (new on `metric_trend`) is passed to a target that takes `strict`. If any point is
not exact, the call raises `TrendNotExact` with those points, instead of returning them.
- **Finding, checked 2026-11-10:** the live trend 200, 200, 1065 that raised W2 is true.
- **Source:** Egeria's native count honours `asOfTime`; `countMetadataElements` passes it to the
repository's SQL COUNT.
- **Live, read-only on laz:** GlossaryTerm reads 200 up to 96 hours ago and 1061 from 72 hours ago (a
glossary load). Paged finds 45 days back end at exactly 200 with page sizes of 70, 200 and 1000.
Asset reads 288 on the same dates, so nothing caps at 200.
- **Already safe:** pyegeria's `count_elements` never returned the find cap as a value: the
repository population has no fallback, and the viewer fallback at the cap returns None plus a note.
- **What was missing:** that truth didn't reach each trend point, so a trend with one bound drew no
chart at all.

## Follow-ups (other apps, after release)

- The Portal's and Egeria Advisor's own trend renderers should show `display` (or the "≥N" marker) for a
point whose `measurement.capped` is true, never `value` alone.
42 changes: 41 additions & 1 deletion md_processing/data/compact_commands/commands_report_compact.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,44 @@
"max_cardinality": 1,
"level": "Advanced",
"Journal Entry": "2026-11-10: added -- Create Dashboard Sheet sets Ownership the way `pyegeria.view.dashboards migrate --owner` does (DB-3)."
},
"Formula": {
"variable_name": "formula",
"inUpdate": true,
"attr_labels": "",
"examples": "",
"default_value": "",
"valid_values": [],
"existing_element": "",
"description": "The logic implemented by this process, expressed in the language of the business rather than any one implementation language.",
"generated": false,
"style": "Simple",
"user_specified": true,
"unique": false,
"input_required": false,
"min_cardinality": 0,
"max_cardinality": 1,
"level": "Advanced",
"Journal Entry": ""
},
"Formula Type": {
"variable_name": "formula_type",
"inUpdate": true,
"attr_labels": "",
"examples": "",
"default_value": "",
"valid_values": [],
"existing_element": "",
"description": "The specification language used to express the Formula (e.g. SQL, Python, natural language).",
"generated": false,
"style": "Simple",
"user_specified": true,
"unique": false,
"input_required": false,
"min_cardinality": 0,
"max_cardinality": 1,
"level": "Advanced",
"Journal Entry": ""
}
},
"bundles": {
Expand Down Expand Up @@ -1241,7 +1279,9 @@
"inherits": "Asset",
"own_attributes": [
"Query URL",
"Query Request Body"
"Query Request Body",
"Formula",
"Formula Type"
]
},
"Report Spec Base": {
Expand Down
Loading
Loading