Skip to content

Paired indicator validation on Actual/Target page exit#585

Draft
Ramon-Jimenez wants to merge 2 commits intodevelopmentfrom
feature/paired-indicator-validation
Draft

Paired indicator validation on Actual/Target page exit#585
Ramon-Jimenez wants to merge 2 commits intodevelopmentfrom
feature/paired-indicator-validation

Conversation

@Ramon-Jimenez
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new PairedValidator that, on Actual/Target page exit, blocks navigation when one side of a paired benefit ↔ people indicator has values entered but the paired side is empty.
  • Wires the validator into Validator.build, Validator.onSave, and Validator.validate so it is initialised with the current dataset, kept in sync as cells are saved, and consulted on the navigate-away path (same surface that already shows the global/sub validation dialog).
  • Pairing is derived from the existing pairedDataElement data-element attribute (already used elsewhere for spreadsheet import and indicator formulas) — no new metadata required.

Context

Per investigation against development, this rule was never present in the codebase: there is no current code, branch, or commit history implementing a paired benefit/people navigate-block validation. The recently flagged "Sub indicators can exceed global indicators" feature only relaxed GlobalValidator (errors → warnings) and could not have overwritten paired-indicator logic that did not exist. This PR therefore implements the rule from scratch, modelled on the existing validateNonEmptyGlobalsWhenSubsHaveValues flow.

Behaviour

  • Triggers only on page exit (no per-cell error pop-ups), matching the original requirement: "If a user tries to navigate off the screen while breaking this rule, a pop-up error will appear."
  • Both Actual and Target screens are covered (the validator loads the dataset matching dataSetType).
  • "Has values" = any cell of the indicator (across all disaggregations / category-option-combos) holds a non-empty value, since benefit and people indicators have different disaggregation shapes.
  • Reported as error level so the existing exit-confirmation dialog blocks navigation until the user fills the paired side.

Test plan

  • Open an Actual data entry screen with a project that includes a paired benefit/people indicator pair.
  • Enter a value in the benefit indicator only, attempt to navigate away → exit dialog should list the paired-indicator error and block navigation.
  • Fill the paired people indicator → navigation should proceed.
  • Repeat the symmetric scenario (people filled, benefit empty).
  • Repeat both scenarios on the Target screen.
  • Verify the existing global/sub indicator validations still trigger (no regression in Validator.validate).
  • Verify per-cell save validations (Actual/Recurring/Global-on-save/Benefit) are unchanged (no new noise on cell save).

🤖 Generated with Claude Code

Ramon-Jimenez and others added 2 commits May 6, 2026 09:58
Block navigation when a benefit data element has values entered but its
paired people data element is empty (and vice versa), surfacing an error
that the user must resolve before leaving the data entry screen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 6, 2026

BundleMon

No change in files bundle size

Groups updated (1)
Status Path Size Limits
Build Folder
./**/*
5.5MB (+2.99KB +0.05%) +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

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.

1 participant