Skip to content

[v0.9.1] Validator decoupled from hatch_metadata.json file I/O#21

Merged
LittleCoinCoin merged 2 commits intomainfrom
dev
Apr 15, 2026
Merged

[v0.9.1] Validator decoupled from hatch_metadata.json file I/O#21
LittleCoinCoin merged 2 commits intomainfrom
dev

Conversation

@LittleCoinCoin
Copy link
Copy Markdown
Member

Overview

Patch release introducing an optional metadata keyword argument to
validate_package(). Allows callers to supply a pre-extracted flat dict and
bypass disk I/O entirely — the groundwork required for Hatch CLI's upcoming
migration from hatch_metadata.json to server.json as the package
descriptor.


Bug Fixes

validate_package() hardcoded dependency on hatch_metadata.json

Root cause: validate_package() unconditionally loads hatch_metadata.json
from package_dir. Once Hatch CLI migrates to server.json, that file no
longer exists and every call fails with "hatch_metadata.json not found"
with no way for the caller to supply already-extracted metadata.

Solution: Added metadata: Optional[Dict[str, Any]] = None between
package_dir and pending_update in the signature of
HatchPackageValidator.validate_package():

# Before
def validate_package(
    self,
    package_dir: Path,
    pending_update: Optional[Tuple[str, Dict]] = None,
) -> Tuple[bool, Dict[str, Any]]:

# After
def validate_package(
    self,
    package_dir: Path,
    metadata: Optional[Dict[str, Any]] = None,
    pending_update: Optional[Tuple[str, Dict]] = None,
) -> Tuple[bool, Dict[str, Any]]:

When metadata is supplied, the file-loading block is skipped entirely. When
absent (the default), the existing hatch_metadata.json path runs unchanged —
all current callers are backward compatible with no modifications required.

New caller pattern (Hatch CLI after server.json migration):

metadata = load_package_metadata(pkg_dir)  # extracts + merges from server.json
is_valid, results = validator.validate_package(pkg_dir, metadata=metadata)

Backward compat — existing callers unchanged:

# Still works exactly as before
is_valid, results = validator.validate_package(package_path)

LittleCoinCoin and others added 2 commits April 16, 2026 04:19
Hatch CLI is migrating from hatch_metadata.json to server.json as the
package descriptor. Once that file is gone, every validate_package call
fails with "file not found". Adding an optional metadata kwarg lets
callers pass a pre-extracted flat dict and skip file I/O — the legacy
path is preserved for existing callers.
## <small>0.9.1-dev.1 (2026-04-15)</small>

* fix(validator): decouple validate_package from hatch_metadata.json ([fdfb0f9](fdfb0f9))
@LittleCoinCoin LittleCoinCoin merged commit fdff30e into main Apr 15, 2026
3 of 4 checks passed
cracking-shells-semantic-release Bot pushed a commit that referenced this pull request Apr 15, 2026
## <small>0.9.1 (2026-04-15)</small>

* Merge pull request #21 from CrackingShells/dev ([fdff30e](fdff30e)), closes [#21](#21)
* chore(release): 0.9.1-dev.1 ([fbd38c6](fbd38c6))
* fix(validator): decouple validate_package from hatch_metadata.json ([fdfb0f9](fdfb0f9))
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.

2 participants