Skip to content

fix(commands): answer an empty scan the same way everywhere, and build nothing (#164) - #199

Merged
radra23 merged 1 commit into
mainfrom
fix/zero-services-guard
Oct 3, 2026
Merged

radra23 merged 1 commit into
mainfrom
fix/zero-services-guard

Conversation

@radra23

@radra23 radra23 commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

Only /otel-init handled a repo whose scan returns no services; the other commands dead-ended or built output for a placeholder service. Closes #164.

What changed

  • /otel-init Step 2 defines the "Empty scan" rule once: print the existing message, write nothing (not the cache either), exit 0. It also covers a cache that already holds services: [] and overrides the other commands' "write what it returns" step
  • /otel-evaluate (before its vacuous "no OTel" check), /otel-instrument, /otel-collector and /otel-backend (before the --yes-skippable prompt) reference the rule right after loading context
  • terraform-gen refuses to emit a module with no real service identity and forbids both the <SERVICE_NAME> placeholder and an invented unknown-service, as a backstop
  • New fixtures/infra-only-repo (the issue's repro shape) and tests/hooks/zero-services-guard.test.sh. Bumps to 0.8.18

Test plan

  • All hook, snapshot, drift and e2e unit tests pass locally; claude plugin validate . --strict passes

  • Teeth: 13 of the 16 zero-services-guard checks fail against the previous text

  • Not verified: whether the scanner returns services: [] for the new fixture is a model judgement and is not exercised here; the fixture pins the shape and the test pins the commands' response

  • Vendor, SDK and semantic-convention facts were verified against the source, not recalled — linked where it isn't obvious.

  • Nothing hardcoded that has a single source of truth (SEMCONV_VERSION, backends.txt, hooks/otel-paths.sh).

…d nothing (#164)

Only /otel-init handled a repo whose scan returns no services. The others failed differently:
- /otel-evaluate: "every service reports no OTel" is vacuously true over an empty list, so it
  said "No existing OTel instrumentation detected. Use /otel-instrument", pointing at a command
  that cannot help.
- /otel-instrument: the "No candidates" branch printed its header and an empty list, no reason.
- /otel-collector: generated a repo-root config for a repo with nothing to collect from.
- /otel-backend: terraform-gen kept the template's <SERVICE_NAME> default, or invented an
  identity (unknown-service, 0.0.0), and built selectors, folder and rule-group names from it.
  The alerts use no_data_state = "OK", so a selector that matches nothing reports healthy. With
  --yes the command got past the unconfirmed-attributes prompt, which is how an orchestrated
  caller reaches it.
- /otel-evaluate also wrote .claude/otel-context.json, but the .gitignore update lives in
  /otel-init Step 4, which an empty scan never reaches, so the cache was left untracked.

/otel-init Step 2 now defines the rule once ("Empty scan"): print its message, write nothing
(not the cache either), exit 0. It also covers a cache that already holds services: [] and
overrides the other commands' "write what it returns" step. evaluate, instrument, collector
and backend reference it right after loading context (evaluate before its vacuous check,
backend before the --yes-skippable prompt). terraform-gen refuses to emit a module with no
real service identity, and forbids both the placeholder and an invented one, as a backstop for
a stale cache or a direct call.

Adds fixtures/infra-only-repo (the issue's repro shape) and tests/hooks/zero-services-guard.test.sh,
wired into lint-hooks; 13 of its 16 checks fail against the previous text. Bumps to 0.8.18.

Not verified end to end: whether the scanner actually returns services: [] for that fixture
is LLM-judged and not exercised here; the fixture pins the shape and the test pins the
commands' response to an empty result.
@radra23
radra23 merged commit 266a63e into main Oct 3, 2026
11 checks passed
@radra23
radra23 deleted the fix/zero-services-guard branch October 3, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant