epam / epam/ai-dial-client-python

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

Offen
#140 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
7
Forks
2
Ø Merge
1 T. 18 Std.
Gemergte PRs (30 T.)
8

Beschreibung

### 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Bestätige zunächst, dass ein DIAL Core-Release den Commit 73d28e48 enthält und dass der vom Client unterstützte Core-Bereich die Entfernung zulässt. Lies dann aidial_client/types/metadata.py, den Hinweis zur Skills-Auflistung in README.md und tests/resources/skills/; entferne die genannten Validatoren und Ableitungstests, aktualisiere das Fixture und die Docstrings und führe die Skills-Ressourcentests aus. Erledigt ist es, wenn node_type unverändert durchgereicht wird und Ordner als FOLDER dargestellt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Refactoring
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.