Skip to content

refactor(v2)!: restructure repo into services/ + features/, bump module to /v2#268

Merged
NitinKumar004 merged 50 commits into
developmentfrom
feat/v2-restructure
Jul 12, 2026
Merged

refactor(v2)!: restructure repo into services/ + features/, bump module to /v2#268
NitinKumar004 merged 50 commits into
developmentfrom
feat/v2-restructure

Conversation

@NitinKumar004

Copy link
Copy Markdown
Collaborator

Why

The repository root had 43 top-level folders — nearly all of them public Go packages. For a published module, the directory layout is the public API (import path = directory path), so this reorg is a breaking change and ships as a new major version: the module path becomes github.com/stackshy/cloudemu/v2.

New layout (root: 43 → 9)

Organized by architectural role, so future additions have one predictable home:

github.com/stackshy/cloudemu/v2
├── cloudemu.go, doc.go        facade: New{AWS,Azure,GCP}
├── config/  errors/           foundational
├── services/<name>/           a cloud service = portable API + driver/  (add a service here)
├── providers/{aws,azure,gcp}/ in-memory backends
├── server/{aws,azure,gcp,wire}/  SDK-compat HTTP servers
├── features/<name>/           chaos, recorder, metrics, inject, ratelimit, topology
├── internal/                  private helpers (memstore, idgen, pagination, statemachine)
└── docs/ examples/ .github/
  • 28 service packagesservices/ (incl. kubernetes, cost, resourcediscovery — they emulate real cloud services).
  • 6 cross-cutting featuresfeatures/ (topology is cloudemu-only analysis, hence a feature, not a service).
  • pagination, statemachineinternal/ (private helpers, never part of the public API).

Migration for users

github.com/stackshy/cloudemu            → github.com/stackshy/cloudemu/v2
github.com/stackshy/cloudemu/storage    → github.com/stackshy/cloudemu/v2/services/storage
github.com/stackshy/cloudemu/chaos      → github.com/stackshy/cloudemu/v2/features/chaos
github.com/stackshy/cloudemu/server/aws → github.com/stackshy/cloudemu/v2/server/aws   (server/providers/config/errors keep their place, just gain /v2)

Commits

Split file-wise (~49 commits): one per moved package, then per-tree import updates (providers, server, config/errors, examples, internal), then docs.

Verification

go build ./..., go vet ./..., and the full go test ./... suite all pass on the restructured tree — nothing broke functionally. README, in-repo docs/*.md, doc.go, and badges are updated to the v2 paths (repo/logo URLs kept).

The docs site (cloudemu-docs) is updated in a separate PR.

…ghbors

Resolves the 4 CodeQL go/uncontrolled-allocation-size high-severity alerts
(pre-existing; first surfaced now that CodeQL runs in CI):
- EC2/GCE/Azure-VM RunInstances validated count>0 but had no upper bound, so an
  oversized MaxCount could drive an unbounded slice allocation (OOM). Cap at
  1000 per call, mirroring real provider limits.
- Vertex AI FindNeighbors was already clamped to maxNeighbors (1000); drop the
  sized make() capacity so the (already-safe) allocation isn't flagged.
@NitinKumar004 NitinKumar004 merged commit d411048 into development Jul 12, 2026
10 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