TDD: Registry reference resolution builds /agt/… instead of /agent/…, failing with HTTP 404 on compliant registries #132

Closed
opened 2026-08-10 15:01:31 +00:00 by CoreRasurae · 0 comments
Member

Metadata

  • Commit Message: test(registry): add failing regression for prefix-vs-type-name resolve path (#131)
  • Branch: tdd/m1-registry-resolve-full-type-names

Background and context

Companion TDD issue for #131 ("Registry reference resolution builds /agt/… instead of /agent/…, failing with HTTP 404 on compliant registries"). Per this project's mandatory Bug Fix TDD workflow, a failing Behave scenario proving the bug exists must be written and merged to master before any fix is implemented on a bugfix/ branch for #131.

The defect: _RegistryReferenceStrategy in src/cleveractors/registry/reference_resolver.py applies _TEMPLATE_TYPE_TO_PACKAGE_TYPE (TemplateType→Package-ID prefix) to the type passed on the wire, so RegistryClient.resolve_package(package_type="agent") requests GET /agt/{ns}/{name} instead of GET /agent/{ns}/{name}. A compliant registry (which routes full type names only, per docs/actor-registry-standard.md §8.2.2/§8.4.2) answers 404.

Current behavior

No Behave scenario asserts the request path that resolve_package constructs. In particular, nothing proves that a package_type="agent" reference resolves to the /agent/... route — so the prefix (agt, grh, skl) leaking into the URL segment goes undetected.

Expected behavior

A Behave scenario exists, tagged @tdd_issue @tdd_issue_131 @tdd_expected_fail, that:

  • Drives RegistryClient.resolve_package(package_type="agent", namespace=..., name=...) (or the full PackageContentResolver / agent-reference path) against a mock transport that captures the request URL.
  • Asserts the requested path is /agent/{ns}/{name} (full type name), not /agt/{ns}/{name}.
  • The assertion currently fails, because the bug is present (/agt/... is requested) — the scenario passes in CI only because the @tdd_expected_fail tag inverts the result, per this project's TDD tag rules.
  • The failing step raises/asserts via AssertionError only — never ValueError, RuntimeError, or any other exception type — so the TDD CI hook inverts it correctly.

Acceptance criteria

  • The scenario carries all three required tags: @tdd_issue, @tdd_issue_131, @tdd_expected_fail.
  • The scenario's failing step raises/asserts via AssertionError only.
  • Running the scenario's assertion with @tdd_expected_fail removed locally fails against current master, confirming the bug is genuinely reproduced.
  • nox -s unit_tests is green (CI passes via the @tdd_expected_fail inversion).
  • Coverage stays >= 97% (nox -s coverage_report).
  • The scenario is merged to master via its own PR before work begins on #131's fix.

Supporting information

  • Bug issue: #131.
  • Relevant code: cleveractors.registry.reference_resolver (_RegistryReferenceStrategy, _TEMPLATE_TYPE_TO_PACKAGE_TYPE), cleveractors.registry.client.RegistryClient.resolve_package, mock transport used by existing Behave registry client coverage (features/registry_http_client.feature / features/steps/registry_http_client_steps.py).
  • Forgejo dependency: #131 depends on this issue (this issue blocks #131), per this project's TDD-before-fix workflow.

Subtasks

  • Write a Behave scenario (in the existing features/registry_http_client.feature, or its closest registry-resolution equivalent) that captures the request URL for resolve_package(package_type="agent", ...) and asserts it is /agent/{ns}/{name}.
  • Implement any missing step definitions, extending the existing shared features/steps/*_steps.py file where one already covers the registry HTTP client.
  • Tag the scenario @tdd_issue @tdd_issue_131 @tdd_expected_fail.
  • Confirm the scenario's assertion fails when @tdd_expected_fail is removed locally (proving the bug), and passes CI with the tag in place.
  • Verify coverage >= 97% via nox -s coverage_report.
  • Run nox (all default sessions), fix any errors.

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details.
  • The commit is pushed to the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged.
  • This TDD issue is closed, with #131 depending on it (Forgejo dependency set at creation).
## Metadata - **Commit Message:** `test(registry): add failing regression for prefix-vs-type-name resolve path (#131)` - **Branch:** `tdd/m1-registry-resolve-full-type-names` ## Background and context Companion TDD issue for #131 ("Registry reference resolution builds /agt/… instead of /agent/…, failing with HTTP 404 on compliant registries"). Per this project's mandatory Bug Fix TDD workflow, a failing Behave scenario proving the bug exists must be written and merged to `master` before any fix is implemented on a `bugfix/` branch for #131. The defect: `_RegistryReferenceStrategy` in `src/cleveractors/registry/reference_resolver.py` applies `_TEMPLATE_TYPE_TO_PACKAGE_TYPE` (TemplateType→Package-ID prefix) to the type passed on the wire, so `RegistryClient.resolve_package(package_type="agent")` requests `GET /agt/{ns}/{name}` instead of `GET /agent/{ns}/{name}`. A compliant registry (which routes full type names only, per `docs/actor-registry-standard.md` §8.2.2/§8.4.2) answers `404`. ## Current behavior No Behave scenario asserts the request path that `resolve_package` constructs. In particular, nothing proves that a `package_type="agent"` reference resolves to the `/agent/...` route — so the prefix (`agt`, `grh`, `skl`) leaking into the URL segment goes undetected. ## Expected behavior A Behave scenario exists, tagged `@tdd_issue @tdd_issue_131 @tdd_expected_fail`, that: - Drives `RegistryClient.resolve_package(package_type="agent", namespace=..., name=...)` (or the full `PackageContentResolver` / agent-reference path) against a mock transport that captures the request URL. - Asserts the requested path is `/agent/{ns}/{name}` (full type name), not `/agt/{ns}/{name}`. - The assertion currently fails, because the bug is present (`/agt/...` is requested) — the scenario passes in CI only because the `@tdd_expected_fail` tag inverts the result, per this project's TDD tag rules. - The failing step raises/asserts via `AssertionError` only — never `ValueError`, `RuntimeError`, or any other exception type — so the TDD CI hook inverts it correctly. ## Acceptance criteria - [ ] The scenario carries all three required tags: `@tdd_issue`, `@tdd_issue_131`, `@tdd_expected_fail`. - [ ] The scenario's failing step raises/asserts via `AssertionError` only. - [ ] Running the scenario's assertion with `@tdd_expected_fail` removed locally fails against current `master`, confirming the bug is genuinely reproduced. - [ ] `nox -s unit_tests` is green (CI passes via the `@tdd_expected_fail` inversion). - [ ] Coverage stays >= 97% (`nox -s coverage_report`). - [ ] The scenario is merged to `master` via its own PR before work begins on #131's fix. ## Supporting information - Bug issue: #131. - Relevant code: `cleveractors.registry.reference_resolver` (`_RegistryReferenceStrategy`, `_TEMPLATE_TYPE_TO_PACKAGE_TYPE`), `cleveractors.registry.client.RegistryClient.resolve_package`, mock transport used by existing Behave registry client coverage (`features/registry_http_client.feature` / `features/steps/registry_http_client_steps.py`). - Forgejo dependency: #131 depends on this issue (this issue blocks #131), per this project's TDD-before-fix workflow. ## Subtasks - [ ] Write a Behave scenario (in the existing `features/registry_http_client.feature`, or its closest registry-resolution equivalent) that captures the request URL for `resolve_package(package_type="agent", ...)` and asserts it is `/agent/{ns}/{name}`. - [ ] Implement any missing step definitions, extending the existing shared `features/steps/*_steps.py` file where one already covers the registry HTTP client. - [ ] Tag the scenario `@tdd_issue @tdd_issue_131 @tdd_expected_fail`. - [ ] Confirm the scenario's assertion fails when `@tdd_expected_fail` is removed locally (proving the bug), and passes CI with the tag in place. - [ ] Verify coverage >= 97% via `nox -s coverage_report`. - [ ] Run `nox` (all default sessions), fix any errors. ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the first line matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details. - The commit is pushed to the branch matching the Branch in Metadata exactly. - The commit is submitted as a pull request to `master`, reviewed, and merged. - This TDD issue is closed, with #131 depending on it (Forgejo dependency set at creation).
CoreRasurae added this to the v2.1.0 milestone 2026-08-10 15:01:32 +00:00
CoreRasurae 2026-08-10 17:59:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveractors-core#132
No description provided.