Skip to content

Standardize error handling to three-tuple map details#14

Open
coryodaniel wants to merge 4 commits intomainfrom
refactor/standardize-error-handling
Open

Standardize error handling to three-tuple map details#14
coryodaniel wants to merge 4 commits intomainfrom
refactor/standardize-error-handling

Conversation

@coryodaniel
Copy link
Copy Markdown
Member

Summary

  • Standardize all error returns across Registry, Storage, Auth, and Handler to {:error, atom_code, map()} — eliminates the inconsistent mix of two-tuples, string details, and map details
  • Add ensure_repo_exists/3 and ensure_upload_exists/4 precondition helpers in Registry so it validates state before delegating to storage adapters (fixes unhandled false fall-through from upload_exists? in with blocks)
  • Bump version from 0.1.0 to 0.2.0

Test plan

  • All 13 tests pass (unit + plug + OCI conformance suite)
  • mix compile --warnings-as-errors clean
  • Verify any downstream consumers handle the new map detail format

🤖 Generated with Claude Code

coryodaniel and others added 4 commits April 1, 2026 09:22
User prompts:
- "Expand registry error results to include details from storage adapters"
- "make the registry do most of the error handling, check for repo/upload existence early"
- "come up with a good error struct standard"
- "bump the minor level and open a PR"

Changes:
- Standardize all errors to {:error, atom_code, map()} three-tuple
- Add ensure_repo_exists/3 and ensure_upload_exists/4 precondition helpers to Registry
- Registry now checks repo/upload existence before delegating to storage
- Fix unhandled `false` fall-through in upload_blob_chunk and complete_blob_upload
- Convert all string error details to structured maps across auth, storage, handler
- Remove two-tuple error match from Handler (and the placeholder message)
- Update Storage.Adapter and Auth.Adapter callback specs to enforce map details
- Bump version to 0.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
User prompts:
- "add a credo ignore rule for ABC size on context.ex"

Changes:
- Add credo:disable-for-next-line for Credo.Check.Refactor.ABCSize on Context.call

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
User prompts:
- "we need the raw http body to properly hash, currently we parse and pass on the json object in parse_oci_manifest"
- "store the raw and digest in assigns, pass manifest, manifest_raw, and digest to store_manifest"

Changes:
- Parser stores raw body in conn.assigns[:oci_raw_manifest] alongside digest
- Handler passes parsed manifest, raw bytes, and digest to Registry.store_manifest
- Registry uses parsed map for validation/indexing, raw bytes for storage
- Local storage writes raw bytes to disk instead of re-encoding JSON
- Storage adapter callback type updated from map() to binary()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
User prompts:
- "pass the parsed map to store_manifest so they dont have to reparse"

Changes:
- Storage adapter callback accepts both manifest (map) and raw_manifest (binary)
- Registry passes both through to the adapter
- Local adapter receives parsed map for future use, writes raw bytes to disk

Co-Authored-By: Claude Opus 4.6 (1M context) <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