feat(ENG-4364): opt-in tier3 drop_shape_only_fields for whole-result reviews

Merged
HI
1d ago
+356-9

What

Port of StackOneHQ/defender#157: the opt-in Tier 3 option drop_shape_only_fields (also accepted as dropShapeOnlyFields), default False, for whole-result reviews.

With it on, the whole-result serializer leaves a path: value line out of the reviewer input when:

  • the key is a plain field path of short field names: each segment at most 32 characters and 3 words;
  • the whole value, trimmed, is null, a boolean, a number, a UUID or hex ID, an ISO date or a hex colour.

Multi-line values, text-like keys, empty values and top-level values always stay. Left-out strings count as covered, so filtering alone never flags oversize. Only the reviewer's input changes.

Regexes are ASCII-only and lengths are UTF-16, as in TS.

Tests

  • Conformance synced to the defender#157 branch: five new tier3-serialize cases.
  • Tests for the snake_case option, off by default, and UTF-16 accounting next to astral text.
  • uv run pytest: 795 passed. uv run ruff check: clean.

🤖 Generated with Claude Code


Summary by cubic

Adds an opt-in drop_shape_only_fields (dropShapeOnlyFields) option, default False, that trims whole-result reviewer input by leaving out path: value lines whose key is a plain path of short field names and whose whole value is null, a boolean, a number, a UUID or hex ID, an ISO date, or a hex colour. This reduces per-review input size for the Tier 3 judge, supporting the load-reduction work in ENG-4364. Only the reviewer's input changes; the returned result and Tier 1/2 behavior are unaffected.

  • Left-out lines count as covered, so filtering alone never flags oversize or degraded coverage.
  • Text-like keys, multi-line and empty values, top-level values, and array elements without an object key on their path always stay.
  • Matching is ASCII-only, including case folding (values like "falÅ¿e" are kept), key segments are capped at 32 characters and 3 words, and lengths are measured in UTF-16 to match the TypeScript reference.
  • Synced conformance suite with six new tier3-serialize cases, plus unit tests for the snake_case option, default-off behavior, UTF-16 accounting next to astral text, and ASCII-only case folding.