Skip to content

5758 - Navigation: Data errors - #5776

Draft
yaguzmang wants to merge 149 commits into
developmentfrom
5758-navigation-data-errors
Draft

5758 - Navigation: Data errors#5776
yaguzmang wants to merge 149 commits into
developmentfrom
5758-navigation-data-errors

Conversation

@yaguzmang

@yaguzmang yaguzmang commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Table validations

  • Server-side table node validation

    • Validate table nodes per assessment/cycle/country and cache results in Redis
    • Revalidate edited nodes together with calculated dependents
    • Emit table validation updates to the frontend after node/dependency updates
  • Frontend table validation flow

    • Fetch table validations when initializing table data
    • Remove client-side table validation
    • Remove frontend fetching of validation dependency table data
    • Show table validation errors in cells
  • Validation summary and submission warning

    • Build validation summary for sections/subsections/tables
    • Show validation error indicators in the nav
    • Warn users before submitting to review
  • Test table validations

    • Test cross-cycle validation when editing forest area
    • Test clearing validation errors after fixing data
    • Test updating dependent table validation errors after editing source data
    • Test showing validation errors on initial load
    • Test hiding validation UI on the print route
    • Test revalidating dependent max-area nodes after editing source data

Description validations

  • Validate description text

    • Queue link validation after a user edits description text with links
    • Process edited description links in the verify-links worker
    • Store visited description links and locations in the links table
    • Update Redis description-link validations after single-description validation
    • Update Redis description-link validations after full-country/full-assessment link checks
    • Emit description text validation update events
    • Listen for description text validation events in the frontend
    • Rebuild the validation summary in the client when description text validations change
    • Include description text errors in validation summary
    • Show description text link validation errors in the description UI
  • Validate data sources

    • Required fields

      • Validate data source fields that are required
      • Store fields validation results in Redis
      • Return/update required-field validation results in the frontend after save
      • Include data source errors in validation summary (backend and frontend)
      • Replace client side errors with server-side validation results
      • Show field validation errors in the nav indicators
      • Include field errors in the submit-to-review warning
    • Reference links

      • Queue reference-link validation after a user saves data sources with reference links
      • Validate reference links through the async links worker
      • Store visited reference links and locations in the links table
      • Clear stale reference-link locations/errors when a reference link is removed
      • Store reference-link validation results in Redis after link validation completes
      • Update Redis reference-link validations after single-description/data-source validation
      • Update Redis reference-link validations after full-country/full-assessment link checks
      • Emit reference-link validation update events
      • Fetch data source validations when initializing section descriptions
      • Listen for reference-link validation events in the frontend
      • Rebuild the validation summary when reference-link validations change
      • Show reference-link validation errors in the data sources UI
  • Trigger links validation after approving/disapproving a link that is in a description

  • In the links worker, use section name + description name instead of description ids

  • In validateAll, validate also descriptions

  • To see if we do:

    • Split validation reducer
  • Test description validations

    • Add tests for description text link validation flow
    • Add tests for data source validation flow

ODP validations

  • BE: Validate all ODPs and store them in redis
  • BE: Include ODP validation in validation summary
  • BE: Validate Year on change
  • BE: Validate national class on change
  • BE/FE: Send validation to FE
  • FE: Show validation errors
  • BE: update validation summary on ODP validation update
  • BE: send validation summary update to FE
  • BE: Delete NDP validation on NDP deletion
  • BE/FE: Validate Comments and Reference to data source
  • Update visitCycleLinks so it updates validation cache like the new description and ndp link jobs
  • Fix unreachable columns and variables when validating after toggling "Use national data points"
  • Divide 1a/1b NDP errors, so they affect the relevant section only
  • Make the summary ignore 1b NDP errors if 1b NDP is disabled
  • Make the summary ignore 1a datasources if 1a NDP is enabled and visible
  • Make the summary ignore 1b datasources if 1b NDP is enabled and visible
  • Add a tool to validate links

From Miró e Cosimo

  • ValidateCountry[XXX] (e.g. Descriptions) to be moved under tools (purpose: keep controller clean).

  • Split Validation reducer -> tableValidationReducer, descriptionValidationReducer ...

  • DescriptionValidation:

    • Only call the related method to validate correct description.
    • E.g. when editing description, dont call datasourcevalidation (because we are not editing data sources)
    • src/server/controller/cycleData/validations/descriptions/updateDescriptionValidations.ts:22
  • src/server/controller/cycleData/validations/descriptions/updateDescriptionValidations.ts:

    • Move to DataValidationService.validateDescriptions.
    • Remove redundant updateDescriptionLinkValidations.ts line 21 (inline the code).
    • Call updateDataSourceFieldValidations only if needed, which is renamed to validateDataSources.
  • visitDescriptionLinks:

    • Move it to LinkService.validateLinks.
    • Why do we call visitDescriptionLinks, and what is the difference with triggerVerifyLinksWorker?
  • Revisit DescriptionIdentifier type — maybe use Pick and revisit name.

  • context factory for validations:

    • why do we run two iterations in #initQueue
  • src/server/controller/cycleData/validations/tables/updateTableValidations.ts

    • Move to DataValidationService.validateNodes()
  • _removeValidationTableValidations.remove(props)

  • move src/server/controller/cycleData/validations/descriptions/notifyDescriptionValidationUpdate.ts
    under src/server/service/dataValidation and expose it DataValidationService.notifyDescriptionValidationUpdate

  • remove src/server/controller/cycleData/validations/nationalDataPoint and expose methods in DataValidationService

    • DataValidationService.validateNDPYear
    • DataValidationService.validateNDPNationalClasses
  • in src/server/controller/cycleData/nationalDataPoint/remove.ts
    line 83-89 must be grouped in DataValidationService.removeNDPValidation

  • remove completely ValidationsController. all exposed methods should be exposed from DataValidationService

  • src/tools/validations/nationalDataPoint/validateCountryNationalDataPoints.ts

    • Why do we get current validations if the object here is to validate completely all NDP?
      here we should remove all existing validations and validate from scratch all NDP
  • src/tools/validations/tables/validateCountryTables.ts
    line 15: expose the method in DataValidationService.removeTableValidations and rename repos method TableValidationRedisRepository.removeValidations

  • Validation repositories should only be used in DataValidationService.

    • Places where they are not:
      • src/server/worker/tasks/verifyLinks/visitDescriptionLinks/utils/refreshDescriptionValidations.ts what is this?
      • src/server/worker/tasks/verifyLinks/visitNationalDataPointLinks/utils/refreshNationalDataPointValidations.ts what is this?
  • NDP Validation methods:
    each validation should validate, set and notify client (not get validation first, but return the validation from the repo)

    e.g for national classes:

    1. const validation = NationalDataPointValidator.validateNationalClasses({..})
    2. const validations = NationalDataPointValidationRedisRepository.setNationalClassValidations({...,validation})
    3. notifyNationalDataPointValidationUpdate({...validation})
  • To see if we do:

    • Lazy load data and validations slices in country page?
    • Update NDP table data with ODP UUID?

* 5758 - Validations type & api definitions

* 5758 - Fix api order

* 5758 - Rename files

* 5758 - Rename to summary.ts

* 5758 - Rename to table.ts
@yaguzmang yaguzmang linked an issue Mar 17, 2026 that may be closed by this pull request
8 tasks
yaguzmang and others added 28 commits March 17, 2026 07:17
* 5758 - Mirror updateDependencies Context

* 5758 - Remove collect

* 5758 - Remove context result
* 5758 - Add validateNodeUpdates

* 5758 - Update cache once

* 5758 - Add missing Objects.isEmpty

* 5758 - Fix build

* 5758 - Remove redis calls from validation function

* 5758 - Remove async

* 5758 - Add promise.all & add types

* 5758 - Remove empty checks

* 5758 - Remove incosistent cache check

* 5758 - Update touchedTableNames.add placement based on new conditions

* 5758 - Fail on missing row/col target

* 5758 - Store empty object for valid tables
* 5758 - Update validations

* 5758 - Update validations for nodes without calculation dependants

* 5758 - Update function structure
* 5758 - Implement partial summary

* 5758 - Add redis getSummary

* 5758 - Add redis setSummary

* 5758 - Remove summary cache changes

* 5758 - Add getSummary

* 5758 - Fix export names

* 5758 - Use section redis

* 5758 - Iterate over sections
* 5758 - getSummary redux

* 5758 - Remove table event
…update (#5827)

* 5758 - Update summary on table validations update

* 5758 - Subscribe only editors

* 5758 - Rename reducer to updateSummaryReducer

* 5758 - Rename event to getTableValidationsUpdateEvent

* 5758 - Remove validations on return

* 5758 - Rename file

* 5758 - Combine hooks

* 5758 - Fix tests
… - 1 (#5833)

* 5758 - Remove t Function param

* 5758 - Add validatorName param to messages

* 5758 - Remove getValidationMessage util

* 5758 - Remove unused labels from calculateCategoriesSum

* 5758 - Add ValidatorName enum
… - 2 (#5837)

* 5758 - Translate validation messages

* 5758 - Add MessageParser
* 5758 - Support row validation

* 5758 - Remove cross assessment support from data context

* 5758 - Undo changes to ContextFactory

* 5758 - Add new ValidationDependencyCache type

* 5758 - Fix build

* 5758 - Remove ValidationTargetCache

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* 5758 - Add useSummaryHasErrors

* 5758 - Add validation warning

* 5758 - Reduce icon size

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
)

* 5758 - Remove external node validations

* 5758 - Remove external node validations from context

* 5758 - Fix tests
…5852)

* 5758 - Show ValidationErrorIndicator

* 5758 - Add inline-flex to Flex

* 5758 - Fix RTL

* 5758 - Remove inline-flex

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* 5758 - Build validation dependants by source cell

* 5758 - Context - get dependant with colName

* 5758 - Update metacache getters

* 5758 - Refactor Member

Co-authored-by: Alejandro Guzman <alejandroguzman.dev@gmail.com>

* 5758 - Refactor Member (restore variable)

Co-authored-by: Alejandro Guzman <alejandroguzman.dev@gmail.com>

* 5758 - Fix deepscan

Co-authored-by: Alejandro Guzman <alejandroguzman.dev@gmail.com>

---------

Co-authored-by: Mino Togna <mino.togna@gmail.com>
* 5758 - Fix validateFns precedence

* 5758 - Prevent adding dependant from other assessment/cycles
* 5758 - use shouldSkipValidationFormula in evaluateTableValidations

* 5758 - Add computeTableValidations

* 5758 - Add initial backfillTableValidations

* 5758 - Remove evaluateTableValidations

* 5758 - Remove TODO

* 5758 - Remove computeValidations

* 5758 - Replace backfillTableValidations

* 5758 - Fix deepscan

* 5758 - Centralize context building and cache setting

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* 5758 - Add validateAll tool

* 5758 - Add migration step

* 5758 - Only use generateMetaCache
* 5758 - Add getTableValidations

* 5758 - Fetch init table validations

* 5758 - Add useGetTableValidations

* 5758 - Remove return after dispatch

* 5758 - Revert changes to useGetTableData

* 5758 - Remove change to useGetTableData

* 5758 - Use tableSections instead of dependencies

* 5758 - Finish clean up
* 5758 - Add E2E tests for validations

* 5758 - Change target country

* 5758 - Add missing param

* 5758 - Fix tableNames param

* 5758 - Improve cell locator & fill cell

* 5758 - Unlock editing

* 5758 - Add prev cycle validation test

* 5758 - Split tests

* 5758 - Change atlantis country

* 5758 - Add numbers to folder files
yaguzmang and others added 30 commits July 9, 2026 07:07
…n validations from worker (#6130)

* 57585 - Add redis decriptions deleteValidations & remove updateDescriptionLinkValidations

* 5758 - Add common refreshDescriptionValidations

* 5758 - Call refreshDescriptionValidations from worker

* 5758 - Fix single description edit clearing other description validations
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…sections (#6133)

* 5758 - Calculate NDP validation summary per section

* 5758 - Use redis repos
…ons/data sources from summary (#6135)

* 5758 - Exclude hidden descriptions from summary

* 5758 - Refactor and move descriptions utility

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…itLinksVerificationEvent & insertLinksCheckActivityLog (#6137)

* 5758 - Extract common emitLinksVerificationEvent & insertLinksCheckActivityLog

* 5758 - Add meta/socket/event/links.ts

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…verifyLinks (#6140)

* 5758 - Remove activity log & add db client arg to verifyAllLinks

* 5758 - Add LinksService
)

* 5758 - Display failing countryIso

* 5758 - Add validateLinks tool

* 5758 - Remove irrelevant TODO
…oller (#6145)

* 5758 - Add common folder

* 5758 - Move validateCountryTables

* 5758 - Move validateCountryNationalDataPoints
* 5758 - Move validations reducer outside tableData

* 5758 - Split summary validations reducer

* 5758 - Split table validations reducer

* 5758 - Split national data point validations reducer

* 5758 - Split description validations reducer

* 5758 - Combine validation reducers

* 5758 - Add renames in description validations

* 5758 - Add renames in ndp validations

* 5758 - Add renames in table validations

* 5758 - Add renames in summary validations

* 5758 - Add validation summary listener

* 5758 - Rename selectors

* 5758 - Add useValidationSummaryListener

* 5758 - Add ValidationSummaries.compute utility

* 5758 - Reuse new utility in the backend

* 5758 - Move useValidationSummaryListener

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…domly (#6134)

* 5758 - Fix tests passing and failing randomly

* 5758 - Fix flaky NDP E2E navigation and national class editing

* 5758 - Add ensureEditingUnlocked

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
… validation only for affected description or data source (#6146)

* 5758 - Add DataValidationService & trigger validation only for affected description or data source

* 5758 - Skip data source field validation for FRA 2020 text descriptions

* 5758 - Remove redundant calls to canValidateDataSources

* 5758 - Validate data source fields only for sections with data source tables

* 5758 - Rename tool to validateDataSources

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…NationalDataPointLinks (#6163)

* 5758 - Remove visitDescriptionLinks and add enqueueDescriptionLinksValidation

* 5758 - Remove visitNationalDataPointLinks and add enqueueNationalDataPointLinksValidation

* 5758 - Rename addVerifyLinksJob to enqueueVerifyLinksJob
…dation (#6167)

* 5758 - Add LinksService.enqueueAllLinksValidation

* 5758 - Rename scheduleVerifyAllLinks to enqueueAllLinksValidation

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…merge-dev-newest-2

5758 - Navigation: Data errors - Merge dev newest
…6170)

* 5758 - Add TableValidations.remove

* 5758 - Add DataValidationService.validateNodes

* 5758 - Add comments to initQueue

* 5758 - Move table validations logic to service

* 5758 - Unify validation ContextFactory initQueue into a single loop

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…6176)

* 5758 - Add DataValidationService.notifyDescriptionValidationUpdate

* 5758 - Add DataValidationService.validateNDPYear and validateNDPNationalClasses

* 5758 - Add DataValidationService.removeNDPValidation
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.

Navigation: Data errors

2 participants