Skip to content

feat: skip non-workload documents instead of aborting the stream - #54

Merged
MPV merged 1 commit into
masterfrom
claude/skip-non-workloads
Aug 9, 2026
Merged

feat: skip non-workload documents instead of aborting the stream#54
MPV merged 1 commit into
masterfrom
claude/skip-non-workloads

Conversation

@MPV

@MPV MPV commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Skip non-workload documents (Service, ConfigMap, CRDs, …) instead of erroring out the whole file.

Before → After

$ kir deployment-and-service.yaml

# before
error: error processing document: unsupported kind Service
# exit 0, and the Deployment's image is lost

# after
nginx:1.27
# the Service is skipped; surrounding workloads survive

Why

Any document whose kind has no PodSpec made ProcessData return an error that aborted the file and discarded images already collected. Non-workload kinds — and kinds not registered in the scheme (CRDs) — are now skippable: no images, no error.

Golden suite: the former TestError becomes TestSkipsNonWorkloads (Service → empty stderr, exit 0), and TestMixed covers a workload + Service + workload file.

Docs

Records the resulting document-classification contract so the stderr/exit behaviour is explicit rather than implied — docs/adr/0007-document-classification.md (added to the ADR log from #76): the three tiers (workload → images, known image-less → skipped silently, unprocessable → stderr + non-zero), plus the planned warning: on stderr / exit 0 ("seen but not detected") for unrecognized CRDs (#75). The root README carries a short user-facing table, the docs/adr/README.md index gains its 0007 row, and the yamlparser.go comments point back to the ADR.

The key decision: a valid-but-image-less document is not an error and not a warning — it's expected input with nothing to report, so stdout stays images-only and the exit code stays trustworthy (also what keeps a directory full of Services from tripping the non-zero exit in #55).

Stack / Release

Based on master (rebased onto the #76 ADR backfill). feat: → minor — tolerating mixed manifests is a new capability.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC

@MPV
MPV force-pushed the claude/skip-non-workloads branch from e896ac0 to 82b2362 Compare July 23, 2026 07:09
@MPV
MPV force-pushed the claude/skip-non-workloads branch from 82b2362 to aad8d56 Compare July 23, 2026 08:17
@MPV
MPV force-pushed the claude/skip-non-workloads branch from aad8d56 to aebe427 Compare July 23, 2026 08:52
@MPV
MPV force-pushed the claude/skip-non-workloads branch from aebe427 to ab391dc Compare July 24, 2026 06:45
@MPV
MPV force-pushed the claude/skip-non-workloads branch from ab391dc to 050d1ab Compare August 2, 2026 08:00
@MPV
MPV force-pushed the claude/skip-non-workloads branch 2 times, most recently from 5388024 to 8d48f52 Compare August 6, 2026 21:05
@MPV MPV changed the title Skip non-workload documents instead of aborting the stream fix: skip non-workload documents instead of aborting the stream Aug 6, 2026
@MPV
MPV force-pushed the claude/skip-non-workloads branch from 8d48f52 to d0e8ec8 Compare August 6, 2026 21:52
@MPV MPV changed the title fix: skip non-workload documents instead of aborting the stream feat: skip non-workload documents instead of aborting the stream Aug 6, 2026
@MPV
MPV force-pushed the claude/skip-non-workloads branch from d0e8ec8 to 6e73d90 Compare August 8, 2026 21:47
@MPV
MPV force-pushed the claude/skip-non-workloads branch from 6e73d90 to cbd53a5 Compare August 8, 2026 22:05
@MPV
MPV force-pushed the claude/skip-non-workloads branch from cbd53a5 to 9521980 Compare August 8, 2026 22:19
Base automatically changed from claude/stdin-multidoc to master August 8, 2026 22:21
@MPV
MPV force-pushed the claude/skip-non-workloads branch from 9521980 to b24a7da Compare August 8, 2026 22:21
@MPV
MPV force-pushed the claude/skip-non-workloads branch 2 times, most recently from 1d6517e to 73b485b Compare August 9, 2026 06:23
@MPV
MPV force-pushed the claude/skip-non-workloads branch 2 times, most recently from 4d73640 to f4c722f Compare August 9, 2026 06:39
Any document whose kind has no PodSpec (a Service, ConfigMap, etc.) made
ProcessData return an error, which aborted the whole file and discarded
images already collected from earlier documents.

Before:
  $ kir deployment-and-service.yaml
  error: error processing document: unsupported kind Service
  # exit 0, and the Deployment's image is lost

After:
  $ kir deployment-and-service.yaml
  nginx:1.27
  # the Service is skipped; surrounding workloads are preserved

Treat non-workload kinds — and kinds not registered in the scheme (CRDs
and other custom resources) — as skippable: no images, no error. In the
golden suite the former TestError becomes TestSkipsNonWorkloads (Service
now yields empty stderr) and TestMixed covers a workload + Service +
workload file.

Document the decision so the stderr/exit contract is explicit: a new
docs/adr/0007-document-classification.md records the three-tier policy
(workload / known image-less / unprocessable) and the planned "seen but
not detected" warning for unrecognized CRDs (#75); the README summarizes
it for users; and the yamlparser comments point back to the ADR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
@MPV
MPV force-pushed the claude/skip-non-workloads branch from f4c722f to 05b1e64 Compare August 9, 2026 06:47
@MPV
MPV merged commit 3ebab6c into master Aug 9, 2026
1 check passed
@MPV
MPV deleted the claude/skip-non-workloads branch August 9, 2026 12:56
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