Skip to content

feat(data ingest): expected image size + local min-size floor preview (#183) - #206

Merged
LukasWodka merged 4 commits into
developfrom
feat/183-image-size-check
Jul 10, 2026
Merged

feat(data ingest): expected image size + local min-size floor preview (#183)#206
LukasWodka merged 4 commits into
developfrom
feat/183-image-size-check

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Two image-preflight improvements for tracebloc data ingest, so a customer finds out about size problems before the ingest, not after (their data never leaves the box either way):

  • Expected image size--target-size is reframed as a check, not a resize. tracebloc validates every image is exactly that size and rejects any that differ; the CLI previews the same reject locally. Default: read from your first image.
  • Min-size floor preview--min-size WxH previews data-ingestors' minimum-image-size floor (ci: bump GitHub Actions (bundles #342–#346, matches artifact majors) #348) locally. It mirrors the ingestor's _meets_min_size exactly: too small when either side is below the floor, boundary inclusive, [W, H] order, no swap. The override travels as spec.file_options.min_size.

Closes#183.

What changed

  • internal/cli/data.go--target-size / --min-size flags + help; plumb --min-size to spec.file_options.min_size.
  • internal/push/spec.goSpecArgs.MinSize, MinImageSize constant (the mirror of the upstream default), emit under file_options.
  • internal/push/preflight.goValidateImages previews the floor (floor-first, then the resolution mismatch, matching the ingestor's error order); PreflightDataset wiring.
  • internal/schema/ingest.v1.json — re-synced to the pinned ref efaeb07, which learned about min_size.
  • Parity harness (parity_golden_test.go, scripts/gen-validator-goldens.py, testdata/parity/) — min_size is now representable on both sides, with a new end-to-end case.

Review follow-ups folded in (last commit)

  • Deployment parity. The floor exists in data-ingestors only on develop (di#348/fix(doctor): requests-proxy check — result-egress framing + honest ✔ (cli#351 Part 1) #356); the deployed ingestor (v0.5.7/v0.6.0) has no floor and ingests small images fine. So the preview no longer applies the 32x32 default on its own — that would exit-3 an ingest the live cluster accepts, the inverse of the tabular-BOM block (whose reject mirrors a real deployed rejection). The floor is previewed only when the customer sets --min-size (their own declared requirement). imgc-too-small is now a flagged deliberate divergence.
  • Message. The too-small reject no longer claims "the cluster rejects images below this size" — false for the deployed cluster. It speaks to the floor the customer set.
  • Flag help.--min-size no longer calls 32x32 "the smallest tracebloc will ingest" (which contradicted both the reject's "lower the floor with --min-size" and the feature — 16x16 is accepted end-to-end). Reworded to raise-or-lower, honest "no local size check" default.
  • Parity gap.min_size was representable on neither side of the harness, so the headline override was cross-checked by neither. Added imgc-min-size-override: 24x40 images with an explicit [16,32] floor that the default 32x32 would reject — pinning that the override is actually read (not silently the default) and its [W, H] orientation is honored, on both the CLI and the real ingestor.

Test plan

Local, all green:

  • go build ./...
  • go test -race -cover ./... (incl. TestValidatorParity, TestValidateImagesMinSize, TestBuild_WithMinSize_PassesSchema)
  • gofmt -l . / gofmt -s -l . → empty
  • go vet ./...
  • ./scripts/sync-schema.sh --check → no drift (pinned ref efaeb07)
  • ./scripts/coverage-floor.sh → floors met
  • Goldens regenerated from the pinned ref: only imgc-min-size-override added; every existing golden byte-stable (incl. imgc-too-small → reject).

Decisions to ratify

  1. Floor value mirrors di#348 exactlyMinImageSize = {32, 32}, either-side / boundary-inclusive / [W, H]. It is the CLI's mirror of ImageResolutionValidator.MIN_IMAGE_SIZE; do not invent a different floor here (Principle 6).
  2. Floor is opt-in until di#348 reaches prod. Today the preview enforces the floor only via explicit --min-size; the default 32x32 is not previewed, because the deployed ingestor has none. When di#348 ships to prod, default PreflightDataset to MinImageSize and flip imgc-too-small back to reject (both flagged inline + in cases.json).
  3. Schema re-sync.internal/schema/ingest.v1.json is pinned to efaeb07 (via scripts/.data-ingestors-ref), the ref that added min_size. Adopting further upstream changes stays a deliberate SHA bump + re-sync.

🤖 Generated with Claude Code


Note

Medium Risk
Touches image preflight and ingest spec emission with deployment-parity caveats; behavior is heavily tested via parity goldens but wrong floor defaults could block or allow bad ingests until prod catches up with #348.

Overview
Adds --min-size WxH for image ingest tasks so customers can set a minimum resolution floor locally and in the emitted spec (spec.file_options.min_size), aligned with data-ingestors #348. --target-size help and interactive copy now stress that tracebloc validates size and never resizes.

Local preflight extends ValidateImages with an optional min-size check (either dimension below the floor fails; floor errors beat target-size mismatches). The preview applies that floor only when --min-size is set, not the upstream 32×32 default, so the CLI does not reject ingests that today’s deployed ingestor still accepts without a floor.

data ingest rejects --target-size / --min-size on non-image tasks at exit 2 instead of silently ignoring them. ParseMinSize shares WxH parsing with target size; SpecArgs.MinSize and schema re-sync (min_size on file_options, pinned ingestors ref) wire through Build. Parity fixtures and goldens were updated (including deliberate CLI vs pinned-ingestor divergences for default floor and tabular BOM).

Reviewed by Cursor Bugbot for commit fd4688e. Bugbot is set up for automated code reviews on this repo. Configure here.

LukasWodkaand others added 4 commits July 9, 2026 18:13
…t-size as a check (#183)
RFC-0002 §12.9. Mirror data-ingestors #348 in the CLI: image size is a
CHECK, never a resize, and there is now a minimum-image-size floor the
CLI previews locally so a below-floor dataset fails before the ingest,
not after the upload in-cluster.
- Schema re-sync: bump scripts/.data-ingestors-ref to the develop SHA
that includes #348 and re-vendor internal/schema/ingest.v1.json, which
now documents spec.file_options.min_size. Schema-drift check passes on
the new ref.
- Local floor preview: ValidateImages gains minW/minH and rejects any
image with either side below the floor, naming the file, its
dimensions, and the floor. PreflightDataset resolves the effective
floor (spec.MinSize override, else push.MinImageSize = 32x32 — the
exact mirror of ImageResolutionValidator.MIN_IMAGE_SIZE) exactly as the
ingestor's __init__ defaults it. The floor takes precedence over a
target_size mismatch, matching #348.
- --min-size WxH flag plumbs to spec.file_options.min_size (mirrors how
--target-size plumbs); the preview uses the effective value.
- --target-size copy reframed (flag + interactive prompt): it is the
size images must ALREADY be — tracebloc never resizes — and names the
min-size floor.
- Parity harness: fixtures resized above the 32px floor so each case
still tests its intended rule (not the new floor), a dedicated
imgc-too-small case added, and goldens regenerated against the pinned
ref with the REAL validators. The re-sync also pulled in #338 (the
in-cluster BOM-probe fix, which merges below #348), so tabular-bom is
now a documented divergence: the pinned ingestor accepts, but the CLI
keeps previewing the rejection because the deployed ingestor (v0.5.7)
predates #338.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…+ close the min-size parity gap (#183)
Review follow-ups on the #183 min-image-size work:
- Deployment parity (was the inverse of the tabular-BOM handling): the
32x32 floor lives in data-ingestors only on develop (di#348/#356); the
DEPLOYED ingestor (v0.5.7/v0.6.0) has no floor and ingests small images
fine. The preview no longer applies the default floor on its own — a
default block would exit-3 an ingest the live cluster accepts. It now
previews the floor ONLY when the customer set --min-size (their own
declared requirement). Flip imgc-too-small to a flagged deliberate
divergence; restore default-on once di#348 reaches prod.
- Message: the too-small reject no longer asserts "the cluster rejects
images below this size" (false for the deployed cluster) — it speaks to
the floor the customer set with --min-size.
- Flag help: --min-size no longer calls 32x32 "the smallest tracebloc will
ingest" (only-raise), which contradicted the reject's "lower the floor
with --min-size" and the feature (16x16 is accepted end-to-end). Reworded
to raise-or-lower with an honest "no local size check" default.
- Parity harness: min_size was representable on neither side, so the
headline override was cross-checked by neither. Plumb it through the Go
parityCase + SpecArgs and gen-validator-goldens.py, and add
imgc-min-size-override — 24x40 images with an explicit [16,32] floor that
the DEFAULT 32x32 would reject, pinning the override is read (not the
default) and its [W,H] orientation is honored, on both sides.
Goldens regenerated against the pinned ref (efaeb07); only the new case
is added, imgc-too-small's golden is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e --min-size (#206 review)
Follow-ups from the #206 code review:
- --target-size / --min-size are image-only, but were parsed only inside
the image branch, so on a tabular/text task the flag value (even a
malformed one) was silently dropped. Reject them explicitly at the
category gate with an actionable exit-2 message. Adds a table-driven
test.
- renderReview now echoes a set --min-size in the interactive confirm
summary, so a mistyped floor is caught before touching data.
- Drop dangling citations in the MinImageSize doc-comment ("RFC-0002
§12.9" / "Principle 6" — neither exists; RFC-0002 has 5 principles and
§12 stops at §12.8). Keep the real source (data-ingestors #348).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The test used LocalPath "./x"; on the branch tip the guard fired
before any path check, but CI runs the PR merged into develop, which
added an earlier dataset-path stat (#181) that rejects a nonexistent
path with exit 3 before the guard's exit 2. Point LocalPath at a
t.TempDir() so the stat passes and the image-only guard is what fires.
Verified against a local merge with origin/develop.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka
LukasWodka merged commit 2db12f9 into developJul 10, 2026
16 checks passed
@LukasWodka
LukasWodka deleted the feat/183-image-size-check branch July 10, 2026 07:41
Sign up for freeto 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

@LukasWodka@saadqbal