Skip to content

fix(hm): discovery prefers Python + empty registry for pipeline-less repos#34

Merged
markovejnovic merged 1 commit into
mainfrom
fix/discovery-python-first-and-empty-registry
Jun 2, 2026
Merged

fix(hm): discovery prefers Python + empty registry for pipeline-less repos#34
markovejnovic merged 1 commit into
mainfrom
fix/discovery-python-first-and-empty-registry

Conversation

@markovejnovic
Copy link
Copy Markdown
Contributor

What

Two fixes to the machine-facing hm pipelines / hm render commands, found when the Harmont backend started driving its render sandbox via hm in prod:

  1. Empty registry for pipeline-less repos. A repo with no .harmont/ (or no .py/.ts files) now prints the empty envelope {"schema_version":"1","pipelines":[]} instead of erroring. The backend fans pipeline discovery across every repo in a GitHub App installation — most declare no pipelines — so those must be a no-op, not a render_failed retry loop. (detect::has_pipeline_files + EMPTY_ENVELOPE short-circuit.)

  2. Prefer Python when both DSLs are present. hm pipelines/hm render now resolve to Python when a repo carries both .py and .ts (detect::detect_language_python_first). The discovery envelope is Python-only today, so a repo with a redundant .ts (e.g. this repo's own .harmont/ci.ts) was resolving to the unsupported TS registry and bailing. hm run keeps the TypeScript-preferring detect_languagethe local-run default is unchanged.

Why

In prod, after switching the render sandbox to hm, discovery surfaced:

Tests

  • detect.rs: detect_language_python_first (mixed→Python, ts-only→TS, no-dir→error) + has_pipeline_files (true for py/ts, false for missing/empty).
  • cmd_pipelines.rs: new pipelines_emits_empty_envelope_when_no_harmont_dir (runs without python3 — short-circuits before the engine).
  • detect_language (TS-preferring, used by hm run) and its tests are untouched.

cargo clippy --all-targets -- -D warnings clean.

Note

Pre-existing on main (not this PR): bundled_sources::tests::{harmont_py_contains_pipeline,extract_harmont_py_creates_files} reference pipeline.py, removed by #32. Untouched here.

…-less repos

Two fixes for backend pipeline discovery, surfaced running the hm-based
render sandbox in prod:

1. A repo with no .harmont/ (or no .py/.ts files) now yields the empty
   discovery envelope {"pipelines":[]} instead of erroring. The backend
   fans discovery across every repo in an installation, most of which
   declare no pipelines; those must be a no-op, not a render_failed retry
   loop. New detect::has_pipeline_files + EMPTY_ENVELOPE short-circuit.

2. hm pipelines / hm render now prefer Python when a repo carries BOTH
   .py and .ts (new detect::detect_language_python_first). The discovery
   envelope is Python-only today, so a repo with a redundant .ts (e.g.
   harmont-cli's own ci.ts) resolved to the unsupported TS registry and
   bailed. hm run keeps the TypeScript-preferring detect_language, so the
   local-run default is unchanged.
@markovejnovic markovejnovic merged commit 0d08a16 into main Jun 2, 2026
24 checks passed
@markovejnovic markovejnovic deleted the fix/discovery-python-first-and-empty-registry branch June 2, 2026 22:32
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