Skip to content

Pin Translation.translate_fields/6 validation order with a regression test - #563

Closed
mdon wants to merge 2 commits into
BeamLabEU:devfrom
mdon:followup-translate-validation-order-test
Closed

Pin Translation.translate_fields/6 validation order with a regression test#563
mdon wants to merge 2 commits into
BeamLabEU:devfrom
mdon:followup-translate-validation-order-test

Conversation

@mdon

@mdonmdon commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to PR #558 — codex flagged that the documented validation
order (endpoint → prompt → non-empty → unique-markers → plugin- available) wasn't pinned by any test. A future refactor that
reorders the with chain would change caller-facing precedence
without any test catching it.

Added a regression test that stacks multiple input violations and
asserts which one wins:

  • empty endpoint vs empty fields → :no_endpoint (endpoint wins)
  • empty prompt vs empty fields → :missing_prompt (prompt wins)
  • valid endpoint+prompt + empty fields → :no_markers
  • valid endpoint+prompt+fields + dup markers → {:duplicate_markers, _}

Plus a comment-only tidy on the existing describe block (the order
list there was stale after #558 inserted validate_non_empty).

These two commits landed on my fork's branch after#558 was
merged, so they didn't make it into upstream/dev. Opening as a
separate small PR.

Test plan

  • 19/0 tests
  • No production-code change — test + comment only

mdon added 2 commits May 22, 2026 04:25
Backstop for the validation chain: `endpoint → prompt → non-empty →
unique-markers → plugin-available`. Stacks multiple input violations
and asserts which rejection wins, so a future refactor that reorders
the `with` chain (e.g. moving `validate_non_empty` before
`validate_uuid`) gets caught immediately.
Codex final review NIT: empty-map (`%{}`) can't also contain
duplicate normalized markers, so the regression-test comments
mentioning "empty fields + dups" were inaccurate. Trim those
mentions so the assertions read straight.
@mdon

mdon commented May 22, 2026

Copy link
Copy Markdown
ContributorAuthor

Superseded by #565 — consolidated translation follow-ups into one PR per module per @mdon convention. The same commits are cherry-picked onto the new branch verbatim.

@mdonmdon closed this May 22, 2026
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.

1 participant

@mdon