#952)
* Marketplace
* Auto-detect marketplace items; drop --load from download
- Probe schema and collection endpoints in parallel so
`infrahubctl marketplace download <ns>/<name>` no longer requires
the user to pass `--collection` up front. Collision between the two
resolves to schema with a warning (pass `--collection` to force the
other path). `_detect_item_type` returns the winning 200 response so
the download helper reuses it instead of re-fetching.
- Remove the `--load` convenience flag; `download` is write-only.
Users who want to push into Infrahub chain with `infrahubctl schema
load`.
- Introduce a four-class error taxonomy (invalid-input, not-found,
network) with exit codes 1 vs 2, distinguishing "version not found"
from "schema not found" when `--version` is passed.
- Surface filesystem failures (unwritable `--output-dir`) cleanly
rather than as a traceback.
- Regenerate `infrahubctl-marketplace.mdx`; no longer advertises
`--load`.
- Add spec, plan, research, contract, quickstart, tasks, and
checklist artifacts under `specs/001-marketplace-api-update/`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Fix vale style errors in marketplace CLI help text
Spell out 'semver' and replace 'config/env' with the full words so
vale's spelling and word-swap rules pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Pad research.md table separator rows
CI runs markdownlint v0.40.0 which flags MD060 (table-column-style)
when the separator row uses compact pipes while the data rows are
padded. Match the repo's existing style (docs/python-sdk/introduction.mdx)
by padding the separator rows too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Rename marketplace command to `get` and add `--stdout`
- Rename `infrahubctl marketplace download` to `infrahubctl marketplace get` to match the convention used by similar tools (kubectl, gh, etc.) and stay consistent with future `marketplace list` / `marketplace search` commands.
- Add `--stdout/-s` flag that streams content to stdout (status, warnings, and errors routed to stderr) so output can be piped into commands like `infrahubctl schema check` once stdin support lands. Skips disk writes entirely. For collections, schemas are concatenated as multi-doc YAML, only injecting `---` separators when missing.
- Route `_fail` errors through stderr unconditionally so failures don't pollute stdout when piping.
- Regenerate `infrahubctl-marketplace.mdx` and add `stdout`/`stderr` to the vale spelling exceptions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address cubic review: classify partial probe failures and download errors as network
- `_detect_item_type`: a transport failure on either probe (when no 200 winner exists) now raises `network`, not `not-found`. Mixing a 404 on one endpoint with a 5xx or transport failure on the other previously fell through to `not-found`, which masked real connectivity problems. Identified by cubic.
- `get`: wrap the post-detect download calls so `httpx.HTTPError` (transport failures and 5xx via `raise_for_status`) raises `_fail("network", ...)` (exit 2) instead of being swallowed by the default `@catch_exception` exit 1. Identified by cubic.
- Update quickstart success example to match the actual `Downloaded schema …` output.
- Add three tests: partial probe failure -> network, versioned download network error, and `--collection` flag network error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add changelog fragment for marketplace command
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address ogenstad review: enum error class, type narrowing, SDK proxy config, marketplace_url
- Replace ErrorClass Literal + _ERROR_EXIT_CODES dict with _ErrorClass(Enum)
so the exit code mapping is co-located with the error definition
- Remove type: ignore[return-value] by using inline isinstance guards so the
type checker narrows httpx.Response naturally in each branch
- Build httpx.AsyncClient via _make_http_client() using the SDK's proxy and
TLS config (ConfigBase.proxy, proxy_mounts, tls_context) and follow_redirects=True
- Move marketplace_url from infrahubctl Settings to SDK ConfigBase
(INFRAHUB_MARKETPLACE_URL); regenerate config.mdx
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Address code review: NoReturn _fail, _status_console rename, SETTINGS config, helper extraction
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Address minor review issues: module-level helper, consistent error messages, collection=False test, spec renames
- Move is_transport_failure to module level as _is_transport_failure
- Replace f"Error: {detail}" 404 messages with consistent "No schema/collection named..." format
- Remove now-unused contextlib.suppress import
- Add test_collection_false_downloads_schema covering the defensive bool|None path
- Update spec.md, plan.md, tasks.md: rename command references from download to get
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix `infrahubctl marketplace get --collection`
* Address ogenstad review comments on marketplace command
- Add MarketplaceIdentifier dataclass; _parse_identifier now returns it
instead of a bare tuple, removing positional ordering assumptions
- collection: bool | None = None → bool = False with is_flag=True;
the if/elif/else block becomes if collection: ... else: auto-detect
- Reverse prefetched condition to lead with truthy (if prefetched:)
- if version is not None → if version
- Add MarketplaceItemType annotation on the collection branch
- Use keyword arguments throughout _download_schema / _download_collection calls
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Fix CI: use NamedTuple for MarketplaceIdentifier, format long _fail line
@DataClass + from __future__ import annotations triggers a Python 3.12
bug in dataclasses._is_type during docs generation. NamedTuple avoids
this entirely while providing the same immutable named-field semantics.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Fix ty false positive on CliRunner(mix_stderr=False)
typer 0.25.1 (used in CI via the stable lockfile) removed explicit
mix_stderr from CliRunner.__init__, causing ty to flag the call as
unknown-argument even though it still works at runtime via **kwargs.
Silence with type: ignore[call-arg].
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Show exception type when httpx error has empty message
ReadTimeout and similar httpx exceptions can have an empty str()
representation, producing "Marketplace request failed: " with nothing
after the colon. Fall back to the exception class name so the output
is always informative (e.g. "Marketplace request failed: ReadTimeout").
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Remove mix_stderr=False from CliRunner, update stdout tests
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Use result.output instead of result.stdout in marketplace tests
In typer 0.25.1 result.stdout only captures stdout; error messages
written to err_console (stderr) only appear in result.output. Switching
all assertions to result.output works across both typer versions.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Wim Van Deun <7521270+wvandeun@users.noreply.github.com>
Merging stable into develop after merging pull request #1045.
Summary by cubic
Sync develop with stable and add
infrahubctl marketplace getto fetch schemas or collections via REST with auto-detection,--version,--stdout, and configurable URL (--marketplace-url/INFRAHUB_MARKETPLACE_URL).Also addresses IHS-75 with a clearer cardinality-many error and tests, and bumps
infrahub-testcontainers1.9.5 -> 1.9.6 andidna3.11 -> 3.15.Written for commit 2882919. Summary will update on new commits.
Review in cubic