Skip to content

Rewrite gocmlclient with layered API/services architecture and comprehensive tests#11

Merged
rschmied merged 91 commits into
mainfrom
bravenewworld
Mar 17, 2026
Merged

Rewrite gocmlclient with layered API/services architecture and comprehensive tests#11
rschmied merged 91 commits into
mainfrom
bravenewworld

Conversation

@rschmied

Copy link
Copy Markdown
Owner

What

Near-complete rewrite of gocmlclient into a clean, testable, package-oriented library with explicit models, a structured API layer, and service-specific modules.

Highlights

  • New architecture split into:
    • pkg/client: public client + options (stable surface)
    • internal/api: HTTP client, middleware, request/response handling, stats
    • internal/auth: auth manager/providers/storage/transport
    • internal/services: per-domain services (lab/node/link/interface/group/user/extconn/imagedef/system/annotations)
    • pkg/models + pkg/errors: typed models and consistent error handling
  • Major test expansion:
    • Large unit-test coverage across api/auth/httputil/services/models/errors
    • New integration/ suite for end-to-end coverage (labs, nodes, links, interfaces, groups, users, annotations, system, smoke, topology)
  • Reliability/behavior improvements:
    • Centralized client identity headers (internal/httputil/headers.go)
    • Retry middleware respects context/cancellation
    • Better query building + request helpers
    • More tolerant lab import (nullable warnings) + API discrepancy fixes
  • Feature/schema updates:
    • Classic + "smart" annotations support
    • Node model enhancements (Priority, PyATS)
    • Updated schemas for ImageDefinition and SystemInformation
  • Tooling/docs:
    • New helper CLIs: cmd/dtest and cmd/cml-version
    • CI/logging improvements
    • Compatibility layer removed; docs refreshed
    • Repo governance additions (CODE_OF_CONDUCT/CONTRIBUTING) and license/readme updates
  • Dependency hygiene:
    • Vendored dependencies removed (rely on modules via go.mod/go.sum)

Breaking/behavior notes

  • Old top-level monolithic files and APIs removed (e.g., prior lab.go, node.go, link.go, auth.go layout); consumers should migrate to pkg/client + typed services/models.
  • Integration tests and CLIs provide new entry points for verification and troubleshooting.

Test

  • go test ./...
  • Integration suite under ./integration (where environment supports it)

Ralph Schmieder and others added 29 commits September 12, 2025 15:48
- Enhance RetryMiddleware to avoid re-reading req.Body and support context cancellation.
- Implement body cloning for safe retry attempts; drain response for connection reuse.
- Update User model to improve opt-in handling with string enums, ensuring backward compatibility.
- Introduce new integration tests for environment loading and topology validation.
- prefer schema /labs/{id}/{start|stop|wipe} with legacy fallback on 404
- align LabService.Labs query params with OpenAPI (show_all)
- update lab service unit tests to exercise schema-first behavior
- Modify envBool signature and update default behavior for IT
- Adjust Node.Create fields to remove CPUs from tests
- Change JSON tags on models for consistency and presence
- Wire linkService with Interface and Node services for improved integration
- strengthen group IT coverage for members and associations
- improve temp lab and user creation logic in tests
- tidy UserUpdatePassword signature for clarity
- add exclude_configurations option for deterministic payloads
- include client identification headers for requests with body
- remove vendored dependencies to simplify the project structure
- new helper ApplyClientIdentityHeaders to set headers
- shift client ID generation to per-client, add version support
- update API client and auth provider to store and apply headers
- introduce version stamp via internal/version package
- add PyAtsCredentials struct for authentication
- migrate legacy fields into NodeOperational
- support object configuration shape in UnmarshalJSON
- add tests for configuration integrity and round-trip presence
- LabImport now implements UnmarshalJSON to handle schema with
  warnings=null
- Added tests for warnings null and warnings array scenarios
- Removed stale progress.md document from the repo
- add Timeout and Features map to SystemInformation
- introduce MACAddress field to Interface
- make SchemaVersion and Description optional in ImageDefinition
- replace DiskImage1 with pointer and add new fields
- add new tests for feature unmarshal and DiskImage1 access
- update tests to match new ImageDefinition fields
- introduce new models for Annotation shapes
- include services for managing annotations
- integrate Annotation and SmartAnnotation services in Client
- enhance README with usage examples and formatting
- add unit and integration tests for new features
- include minor service interface updates and package comments
- BREAKING changes: compatibility layer removed; specific tests
  adjusted. Updated README to reflect no backward compatibility
  and Go 1.25 requirement.

- Added NodeStaging support for lab models and new Makefile
  integration target for testing.
- refactor logging with central wrapper and default settings
- add CLI for version control with environment and flags support
- update CI workflows and Makefile to exclude cmd packages
- add and adjust various tests including annotation models
- add CODE_OF_CONDUCT.md and CONTRIBUTING.md for contributors
- update LICENSE with new copyright year range 2022-2026
- minor formatting updates in README.md (line breaks and indentation)
@rschmied rschmied merged commit 629a854 into main Mar 17, 2026
5 checks passed
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