Skip to content
This repository was archived by the owner on Jan 24, 2026. It is now read-only.

refactor!: move internal interfaces to internal/contracts - #29

Merged
jmgilman merged 2 commits into
masterfrom
codex/define-minimal-unexported-interfaces-in-root
Jan 10, 2026
Merged

jmgilman merged 2 commits into
masterfrom
codex/define-minimal-unexported-interfaces-in-root

Conversation

@jmgilman

@jmgilman jmgilman commented Jan 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Move implementation interfaces from core/types.go (public API) to internal/contracts/contracts.go to avoid exposing internal contracts to external consumers
  • Remove adapter pattern - implementations now satisfy internal contracts directly
  • Reduce public API surface by making internal-only constructors unexported

Changes

  • Create internal/contracts package containing:

    • Registry - OCI registry operations
    • ArchiveBuilder / ArchiveReader - eStargz blob building and reading
    • BlobHandle / BlobSource - cached blob access
    • PathValidator - path security validation
    • Extractor - archive extraction
  • Remove adapter wrappers from internal packages:

    • internal/archive/adapter.go (deleted)
    • internal/registry/adapter.go (deleted)
    • internal/safepath/adapter.go (deleted)
  • Clean up root package:

    • Remove contracts.go (unexported interface aliases)
    • Remove unused BlobHandle / BlobSource type aliases from cache.go
    • Make NewImageFromBlob / NewImageFromHandle unexported
  • Simplify core/types.go:

    • Remove interface definitions (now in internal/contracts)
    • Keep only public data types and errors
  • Update documentation to reflect new architecture

Test plan

  • Run just ci (lint, test, build) - all checks pass
  • Manual review of public API surface

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 10, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
blobber 74f558f Commit Preview URL

Branch Preview URL
Jan 10 2026, 07:03 PM

@jmgilman jmgilman changed the title Introduce private client interfaces and internal adapters refactor: move internal interfaces to internal/contracts Jan 10, 2026
Move implementation interfaces from core/types.go (public API) to
internal/contracts/contracts.go to avoid exposing internal contracts
to external consumers.

Changes:
- Create internal/contracts package with Registry, ArchiveBuilder,
  ArchiveReader, BlobHandle, BlobSource, PathValidator, and Extractor
- Remove adapter pattern from internal packages (archive, registry,
  safepath) - implementations now satisfy contracts directly
- Remove contracts.go from root package (unexported interface aliases)
- Remove unused BlobHandle/BlobSource type aliases from cache.go
- Make NewImageFromBlob/NewImageFromHandle unexported (internal only)
- Update image_test.go to package blobber for internal function access
- Clean up core/types.go to contain only public data types

BREAKING CHANGE: Remove public interfaces (Registry, ArchiveBuilder,
ArchiveReader, PathValidator, BlobHandle, BlobSource, Extractor) from
core/types.go and type aliases from root package. Remove exported
functions NewImageFromBlob and NewImageFromHandle.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jmgilman
jmgilman force-pushed the codex/define-minimal-unexported-interfaces-in-root branch from 41f9353 to 74f558f Compare January 10, 2026 19:02
@jmgilman jmgilman changed the title refactor: move internal interfaces to internal/contracts refactor!: move internal interfaces to internal/contracts Jan 10, 2026
@jmgilman
jmgilman merged commit 5b9d3dc into master Jan 10, 2026
8 checks passed
@jmgilman
jmgilman deleted the codex/define-minimal-unexported-interfaces-in-root branch January 10, 2026 19:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant