Skip to content

Merge stable into develop#1046

Merged
ogenstad merged 4 commits into
developfrom
stable
May 29, 2026
Merged

Merge stable into develop#1046
ogenstad merged 4 commits into
developfrom
stable

Conversation

@infrahub-github-bot-app

@infrahub-github-bot-app infrahub-github-bot-app Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Merging stable into develop after merging pull request #1045.


Summary by cubic

Sync develop with stable and add infrahubctl marketplace get to 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-testcontainers 1.9.5 -> 1.9.6 and idna 3.11 -> 3.15.

Written for commit 2882919. Summary will update on new commits.

Review in cubic

)

Bumps [infrahub-testcontainers](https://github.com/opsmill/infrahub) from 1.9.5 to 1.9.6.
- [Release notes](https://github.com/opsmill/infrahub/releases)
- [Changelog](https://github.com/opsmill/infrahub/blob/stable/CHANGELOG.md)
- [Commits](opsmill/infrahub@infrahub-v1.9.5...infrahub-v1.9.6)

---
updated-dependencies:
- dependency-name: infrahub-testcontainers
  dependency-version: 1.9.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@infrahub-github-bot-app infrahub-github-bot-app Bot requested a review from a team as a code owner May 26, 2026 13:43
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 26, 2026

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2882919
Status: ✅  Deploy successful!
Preview URL: https://36c8e0c3.infrahub-sdk-python.pages.dev

View logs

dependabot Bot and others added 2 commits May 26, 2026 07:31
Bumps [idna](https://github.com/kjd/idna) from 3.11 to 3.15.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](kjd/idna@v3.11...v3.15)

---
updated-dependencies:
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* IHS-75: Fix cardinality many error message

* update news fragment
@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.25000% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/ctl/marketplace.py 90.90% 8 Missing and 6 partials ⚠️
@@             Coverage Diff             @@
##           develop    #1046      +/-   ##
===========================================
+ Coverage    81.54%   81.71%   +0.16%     
===========================================
  Files          134      135       +1     
  Lines        11468    11626     +158     
  Branches      1735     1759      +24     
===========================================
+ Hits          9352     9500     +148     
- Misses        1569     1575       +6     
- Partials       547      551       +4     
Flag Coverage Δ
integration-tests 41.58% <31.25%> (-0.13%) ⬇️
python-3.10 55.09% <90.62%> (+0.50%) ⬆️
python-3.11 55.10% <90.62%> (+0.52%) ⬆️
python-3.12 55.09% <90.62%> (+0.50%) ⬆️
python-3.13 55.10% <90.62%> (+0.52%) ⬆️
python-3.14 55.10% <90.62%> (+0.52%) ⬆️
python-filler-3.12 22.38% <1.25%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/config.py 91.19% <100.00%> (+0.05%) ⬆️
infrahub_sdk/ctl/cli_commands.py 72.54% <100.00%> (+0.21%) ⬆️
infrahub_sdk/ctl/config.py 67.85% <100.00%> (+0.58%) ⬆️
infrahub_sdk/node/relationship.py 81.86% <100.00%> (+2.19%) ⬆️
infrahub_sdk/ctl/marketplace.py 90.90% <90.90%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#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>
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label May 29, 2026
@ogenstad ogenstad merged commit 049b197 into develop May 29, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants