Skip to content

feat: extend specs with create/update/remove types - #13

Draft
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/specs-crud-operations
Draft

feat: extend specs with create/update/remove types#13
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/specs-crud-operations

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

What

Extends the specs system to generate POST, PUT, and DELETE methods from YAML declarations — not just GET.

Why

The specs system could only generate listable (GET list) and getfromid (GET by ID) methods. All write operations (create_server, create_floating_ip, delete_floatingip) were hardcoded in service classes, defeating the purpose of declarative API specs. This was the #1 architectural limitation noted in multiple FIXMEs.

How

Three new spec types in Specs::Roles::Service:

  • create: POST with resource_key wrapping (body: {server: {...}}, response unwrap)
  • update: PUT with UID template substitution + resource wrapping
  • remove: DELETE with UID template substitution

A _resolve_uri helper handles the version-prefix doubling issue (Network routes include /v2.0/ while root_uri() also prepends it).

Migrated 3 hardcoded methods to specs, added 3 new spec-generated methods (update_floatingip, update_port, delete_server_from_uid).

Testing

  • All 23 existing tests pass (backward compatible)
  • 11 new tests in t/specs-crud.t covering each type for both Compute and Network services
  • Verified correct HTTP method and URL for all generated methods

🤖 Generated with Claude Code


Quality Report

Changes: 8 files changed, 363 insertions(+), 48 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The specs system previously only generated GET-based methods (listable
and getfromid types), forcing all POST/PUT/DELETE operations to be
hardcoded in service classes. This adds three new spec types:

- create: POST with resource key wrapping/unwrapping
- update: PUT with UID substitution and resource wrapping
- remove: DELETE with UID substitution

Migrates hardcoded methods to spec-generated ones:
- Compute::create_server → specs (create type)
- Network::create_floating_ip → specs (create type)
- Network::delete_floatingip → specs (remove type)
- Adds update_floatingip, update_port, delete_server_from_uid

Also implements proper post/put/delete accessors on the Specs role
(previously stubs that died) and adds _resolve_uri helper to handle
version-prefixed routes correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant