epam / epam/ai-dial-client-python

Skills: drop the node_type workaround once the DIAL Core fix is released

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
7
Forks
2
Avg merge
1d 18h
Merged PRs (30d)
8

Description

### Name and Version

aidial-client 0.16.1

### What is the problem this feature will solve?

The read side (#136) ships a client-side workaround for a DIAL Core bug in the skill file listing. That bug is now **fixed upstream**, so the workaround is dead weight — but it cannot be removed yet, because the fix is not in a released Core.

**The bug** ([epam/ai-dial-core#1912](https://github.com/epam/ai-dial-core/issues/1912), closed): a *non-recursive* listing of a skill's files reported its subfolders with `nodeType: "ITEM"` — the same value as the files beside them — so only the trailing `/` on `url` distinguished them.

```
GET /v2/metadata/skills/{bucket}/{path}/files/ # recursive=false
```
```jsonc
{
"items": [
{ "name": "SKILL.md", "url": ".../files/SKILL.md", "nodeType": "ITEM" },
{ "name": "agents", "url": ".../files/agents/", "nodeType": "ITEM" } // a directory
]
}
```

**The workaround**, in `aidial_client/types/metadata.py`: a field validator on `SkillFileItem` and `SkillFileMetadata` that derives `node_type` from `url`, so callers of this library never see the discrepancy.

**The fix**: [epam/ai-dial-core#1914](https://github.com/epam/ai-dial-core/pull/1914), commit `73d28e48` — `ComplexResourceService.listFiles` now builds folder entries as `ResourceFolderMetadata` rather than `ResourceItemMetadata`.

**Why this is not done yet:** the fix landed on `development` roughly four minutes *after* Core `0.47.1` was cut, so it is in no release. Removing the workaround now would break anyone running a released Core — subfolders would silently come back as `ITEM` again.

### What is the feature you are proposing to solve the problem?

Once a DIAL Core release contains `73d28e48`, remove the workaround and let `node_type` pass through exactly as Core sends it.

**Steps**

1. `aidial_client/types/metadata.py` — delete `_node_type_from_url` and both `PYDANTIC_V2` / v1 validator pairs on `SkillFileItem` and `SkillFileMetadata`. Drop the now-unused `Any` / `validator` / `field_validator` imports.
2. Update the docstrings on `SkillItem` and `SkillFileItem` that describe the derivation.
3. `README.md` — drop the note in the skills file-listing section explaining that `node_type` is corrected; state that a non-recursive listing distinguishes folders with `node_type == "FOLDER"`.
4. `tests/resources/skills/` — remove the two tests covering the derivation, and update the captured non-recursive fixture so its directory entries carry `"nodeType": "FOLDER"`.

**Note on the fixture:** the post-fix `nodeType` values were derived by reading the Core patch, not captured from a running Core. Re-capture a real non-recursive listing against a Core that contains the fix before relying on them. The folder branch copies no timestamps, so directory entries should still have no `updatedAt`.

**Preconditions**

- A DIAL Core release containing `73d28e48` exists.
- The client's minimum supported Core version is at or above that release, or the project accepts that older deployments lose correct `node_type` on this one listing.

### What alternatives have you considered?

**Keep the workaround indefinitely.** Rejected. It is a permanent tax on a bug that no longer exists, and it makes the client rewrite data the server sends correctly — which is worse than a no-op, because it hides Core's real response from anyone debugging against it.

**Remove it now, before a Core release contains the fix.** Rejected. `aidial-client` is published to PyPI and its users run whatever Core their deployment provides. Breaking them for a fix they cannot yet have is a bad trade for deleting ~25 lines.

**Replace the validator with a derived `is_folder` accessor** that leaves `node_type` untouched and answers `node_type == "FOLDER" or url.endswith("/")`. Rejected for this issue: it would be correct against both old and new Core, but it adds public API surface to solve a problem that is disappearing on its own, and it was not what the review asked for. Worth revisiting only if the Core fix turns out not to ship.

Contributor guide

Open the contributing guide

Research direction

First confirm that a DIAL Core release contains commit 73d28e48 and that the client's supported Core range permits removal. Then read aidial_client/types/metadata.py, the skills listing note in README.md, and tests/resources/skills/; remove the named validators and derivation tests, update the fixture and docstrings, and run the skills resource tests. Done means node_type passes through and folders are represented as FOLDER.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.