diff --git a/PYEGERIA_ISSUES.md b/PYEGERIA_ISSUES.md index 0550e07c..23522a71 100644 --- a/PYEGERIA_ISSUES.md +++ b/PYEGERIA_ISSUES.md @@ -286,6 +286,44 @@ they're holding real port materialization until this exists server-side --- +### ISSUE-160: `AutomatedCuration`'s template builders miss placeholders Egeria's templates now use, so created elements keep literal `~{name}~` values (folder endpoint `~{directoryAddress}~` breaks folder surveys) + +**Layer:** Pyegeria · **Status:** partly fixed on branch `fix/issue-160-template-placeholders` (owner approved 2026-10-21); not yet merged or released. The rest is listed below for the owner. **Found:** 2026-10-21, live by the RE coordinator against Egeria `main` 05a5e982 with pyegeria 6.2.7. Two FileFolders made with `create_folder_element_from_template` had Endpoint `networkAddress` = `~{directoryAddress}~`. Egeria's Folder Survey then failed with `BASIC-FILE-CONNECTOR-404-001` "The folder named ~{directoryAddress}~ ... does not exist" (engine action `c1d924b5`). The same folders also kept `versionIdentifier` = `~{versionIdentifier}~` and `deployedImplementationType` = `~{deployedImplementationType}~` (record `~/.re-gate/repair-folder-endpoints-20261021T143415Z.json`). + +**Cause (Egeria `origin/main` d8f72cbe25, read-only):** no placeholder was renamed (`git log -S` on `PlaceholderProperty.java`). Egeria **added** placeholders that pyegeria never sends: +- **`directoryAddress` / `fileAddress`:** added by `156650efd6` (2026-07-19, "file system control for file cataloging"). They are now the Endpoint address in the folder and file templates (`DataAssetTemplateDefinition` `FILE_FOLDER_TEMPLATE`, `DATA_FOLDER_TEMPLATE`, `CSV_FILE_TEMPLATE`, ...). The templates still use `directoryPathName` / `filePathName` in the qualifiedName, so both are needed. +- **`deployedImplementationType`:** in every folder/file placeholder list (`getFolderPlaceholderPropertyTypes`, `getDataFilesPlaceholderPropertyTypes`). +- **`databaseDescription`:** the PostgreSQL Relational Database template's description placeholder (`PostgresPlaceholderProperty.DATABASE_DESCRIPTION`); pyegeria sent `description`. + +An unsent placeholder is stored as the literal `~{name}~`. `body_slimmer` drops `None` values, so an optional argument left unset has the same effect. + +**Fixed on the branch** (`pyegeria/omvs/automated_curation.py`; signatures unchanged): +| Method | Added | +|---|---| +| `create_folder_element_from_template` | `directoryAddress` (= `path_name`), `deployedImplementationType: "File System Directory"` | +| `create_csv_data_file_element_from_template`, `get_create_csv_data_file_element_from_template` | `fileAddress` (= `file_path_name`), `deployedImplementationType: "CSV Data File"` | +| `create_secrets_store_element_from_template` | `fileAddress` (= `file_path_name`), `deployedImplementationType: "YAML File Secrets Collection"` | +| `create_postgres_database_element_from_template` | `databaseDescription` (= `description`; `description` still sent) | + +Tests: `tests/micro-tests/test_issue_160_template_placeholders.py` (5 cases; all fail on the old code, all pass on the fix). The full micro-test suite (1,409) passes in a clean python:3.13-slim container. + +**Live check 2026-10-21 14:52Z** (Egeria `main` 05a5e982, erinoverview, after a peer round; the fixed code on this branch): `create_folder_element_from_template("/tmp/pyeg_rt_folder_20261021T145254Z", ..., version="1.0")` created FileFolder `e9a45c7f` with `deployedImplementationType` "File System Directory" and `versionIdentifier` "1.0". Its anchored Endpoint `8f003544` had **`networkAddress` = `/tmp/pyeg_rt_folder_20261021T145254Z`**. The folder, Connection `18ef2ee9` and Endpoint had no `~{...}~` left in their own properties. A metadata-expert delete (`deleteMethod: PURGE`, `cascadedDelete: true`) removed all three; each was verified gone by GUID. A first run (`a3475d3e`) confirmed the folder fields but its script missed the Endpoint. Exact `networkAddress` searches (forLineage) afterwards found no leftover for that run either. The survey itself was not run. + +**Not fixed: needs the owner's decision.** These are API additions or behaviour choices, not one-line key fixes. +1. **Postgres server and database credentials:** both templates now take `secretsStorePathName` and `secretsCollectionName` (credentials come from a secrets store). pyegeria never sends them, so the connection keeps literals. pyegeria still sends `databaseUserId` / `databasePassword`, which the templates no longer list (`312c172639`, `56fa898e43`), so those are dead. Proposed: add optional `secrets_store_path_name` / `secrets_collection_name` parameters, and deprecate `db_user` / `db_pwd`. +2. **Optional arguments left unset:** `versionIdentifier`, `description`, `fileSystemName` and the like are dropped when `None`, so they stay `~{...}~` (RE's `versionIdentifier` case). Options: send `""` for unset optional placeholders, or document that callers must pass them. +3. **Unsent template placeholders in the Unity Catalog and Kafka builders:** + - UC catalog: `ucServerQualifiedName`; + - UC table and function: `rootSchemaTypeQualifiedName`; + - UC volume: `directoryPathName`, `localStorageLocation`; + - UC server and Kafka server: `resourceName` (Kafka also `versionIdentifier`). + Add parameters for them where a caller can know the value. +4. **The secrets-store builder's fallback** to a "Keystore File" technology type (`_async_get_template_guid_for_technology_type`) matches no template on `origin/main`. + +Builders with no hard-coded keys (`create_elem_from_template`, Dr.Egeria's "Placeholder Property Values" attribute) are unaffected. The UC schema builder sends all its placeholders. + +--- + ### ISSUE-159: no archive wrappers on the project or collection managers, and no restore wrapper at all, although Egeria offers both **Layer:** Pyegeria · **Status:** open, logged only (no fix without the owner's word) · **Found:** 2026-10-20, raised by the Resource Explorer expansion-architecture session: RE's investigation-delete ruling needs a Project archived through the project manager and restored by GUID. Facts confirmed here against Egeria `origin/main` 05a5e982 and pyegeria upstream `main`, read-only. diff --git a/pyegeria/omvs/automated_curation.py b/pyegeria/omvs/automated_curation.py index 4a8f4084..3bc02107 100644 --- a/pyegeria/omvs/automated_curation.py +++ b/pyegeria/omvs/automated_curation.py @@ -754,6 +754,9 @@ async def _async_create_secrets_store_element_from_template( "placeholderPropertyValues": { "fileSystemName": file_system_name, "filePathName": file_path_name, + # ISSUE-160: the template's endpoint address is ~{fileAddress}~. + "fileAddress": file_path_name, + "deployedImplementationType": "YAML File Secrets Collection", "fileName": file_name, "description": description, "fileType": file_type, @@ -975,6 +978,9 @@ async def _async_create_csv_data_file_element_from_template( "fileName": file_name, "fileType": file_type, "filePathName": file_path_name, + # ISSUE-160: the template's endpoint address is ~{fileAddress}~. + "fileAddress": file_path_name, + "deployedImplementationType": "CSV Data File", "versionIdentifier": version_identifier, "fileEncoding": file_encoding, "fileExtension": file_extension, @@ -1083,6 +1089,9 @@ async def _async_get_create_csv_data_file_element_from_template( "fileName": file_name, "fileType": file_type, "filePathName": file_path_name, + # ISSUE-160: the template's endpoint address is ~{fileAddress}~. + "fileAddress": file_path_name, + "deployedImplementationType": "CSV Data File", "versionIdentifier": version_identifier, "fileEncoding": file_encoding, "fileExtension": file_extension, @@ -1300,6 +1309,8 @@ async def _async_create_postgres_database_element_from_template( "portNumber": port, "databaseUserId": db_user, "description": description, + # ISSUE-160: the database template's description placeholder is databaseDescription. + "databaseDescription": description, "databasePassword": db_pwd, }, } @@ -1408,7 +1419,10 @@ async def _async_create_folder_element_from_template( "initialClassifications": initial_classifications, "placeholderPropertyValues": { "directoryPathName": path_name, + # ISSUE-160: the template's endpoint address is ~{directoryAddress}~. + "directoryAddress": path_name, "directoryName": folder_name, + "deployedImplementationType": "File System Directory", "versionIdentifier": version, "fileSystemName": file_system, "description": description, diff --git a/tests/micro-tests/test_issue_160_template_placeholders.py b/tests/micro-tests/test_issue_160_template_placeholders.py new file mode 100644 index 00000000..8e30ddd6 --- /dev/null +++ b/tests/micro-tests/test_issue_160_template_placeholders.py @@ -0,0 +1,85 @@ +""" +ISSUE-160: AutomatedCuration's template builders did not send placeholders that +Egeria's templates now use, so the created elements kept literal ~{name}~ values: +- File System Directory: endpoint address ~{directoryAddress}~ (a folder survey + then fails with BASIC-FILE-CONNECTOR-404-001), and deployedImplementationType. +- CSV Data File / YAML File Secrets Collection: endpoint address ~{fileAddress}~, + and deployedImplementationType. +- PostgreSQL Relational Database: the description placeholder is databaseDescription. +No live server: the template lookup and the create call are captured. +""" +import pytest + +from pyegeria.omvs.automated_curation import AutomatedCuration + + +def _client(captured: dict, monkeypatch) -> AutomatedCuration: + monkeypatch.setattr(AutomatedCuration, "check_connection", lambda self: "test") + client = AutomatedCuration("view-server", "https://localhost:1", "user", "pwd") + + async def fake_template_guid(type_name, **kwargs): + captured["technology_type"] = type_name + return "template-guid" + + async def fake_create(body=None): + captured["body"] = body + return "new-guid" + + client._async_get_template_guid_for_technology_type = fake_template_guid + client._async_create_elem_from_template = fake_create + return client + + +@pytest.mark.asyncio +async def test_folder_sends_directory_address_and_deployed_type(monkeypatch): + captured = {} + client = _client(captured, monkeypatch) + await client._async_create_folder_element_from_template( + "/data/landing", "landing", "fs1", description="d", version="1.0") + + values = captured["body"]["placeholderPropertyValues"] + assert captured["technology_type"] == "File System Directory" + assert values["directoryAddress"] == "/data/landing" + assert values["directoryPathName"] == "/data/landing" # still used in the qualifiedName + assert values["deployedImplementationType"] == "File System Directory" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("method", ["_async_create_csv_data_file_element_from_template", + "_async_get_create_csv_data_file_element_from_template"]) +async def test_csv_sends_file_address_and_deployed_type(method, monkeypatch): + captured = {} + client = _client(captured, monkeypatch) + await getattr(client, method)("a.csv", "CSV Data File", "/data/a.csv", "1.0") + + values = captured["body"]["placeholderPropertyValues"] + assert captured["technology_type"] == "CSV Data File" + assert values["fileAddress"] == "/data/a.csv" + assert values["filePathName"] == "/data/a.csv" + assert values["deployedImplementationType"] == "CSV Data File" + + +@pytest.mark.asyncio +async def test_secrets_store_sends_file_address_and_deployed_type(monkeypatch): + captured = {} + client = _client(captured, monkeypatch) + await client._async_create_secrets_store_element_from_template( + "secrets/s.omsecrets", "s.omsecrets", "d", "1.0") + + values = captured["body"]["placeholderPropertyValues"] + assert captured["technology_type"] == "YAML File Secrets Collection" + assert values["fileAddress"] == "secrets/s.omsecrets" + assert values["deployedImplementationType"] == "YAML File Secrets Collection" + + +@pytest.mark.asyncio +async def test_postgres_database_sends_database_description(monkeypatch): + captured = {} + client = _client(captured, monkeypatch) + await client._async_create_postgres_database_element_from_template( + "sales", "pg1", "db.example", "5432", "u", "p", description="Sales data") + + values = captured["body"]["placeholderPropertyValues"] + assert captured["technology_type"] == "PostgreSQL Relational Database" + assert values["databaseDescription"] == "Sales data" + assert values["databaseName"] == "sales"