Repository navigation
Reporting misconfigured handlers #312
Description
Description
Some handlers require configuration depending on elements. While they cannot be saved with incorrect configuration the elements referenced may be subject to modification (or removal) resulting in misconfigured handlers and failing jobs.
Steps to reproduce
We use the Digital Post-handler as an example:
- Create webform
- Add NemId CPR-element with key/id
recipientintended for CPR/CVR - Add other elements
- Add and configure OS2Forms Attachment-element
- Add and configure the Digital Post-handler correctly with above elements
New digital post handler jobs would now correctly send digital post
- Modify the element intended for recipient to have the key
cpr_number.
New jobs will now refer to the old element id, recipient, rather than cpr_number resulting in failed jobs. Furthermore, if users checks the Digital Post-handler configuration by clicking 'edit' on the handler it will look like it is configured correctly resulting in users just cancelling rather than re-saving the handler.
This is not limited to the Digital Post-handler. The following handlers have the same issue or variations of it:
More may exist
Proposal
An OS2FormsHandler-interface involving a validateConfiguration(...) method alongside a OS2Forms Handlers module that when visiting a webform loops over added handlers invoking the validateConfiguration(...)-method for each of them.
Any configurations that do not validate should then result in some sort of indication explaining which handlers are misconfigured and how.
Validation could include checking
- Elements existing
- Paths to files being correct
- Other references existing
For handlers we do not control we could consider wrapping them with the only change being the addition of the above validation method.
Furthermore, handler configurations that include selects should have an 'empty'-option to indicate that it is not configured.
Footnotes
-
Involves a reference to a flow by id which is probably unlikely to change. ↩
Activity
OS2Forms#312: Test code-analysis
jekuaitk commentedon Jul 16, 2026
As per #340 and more specifically #340 (comment) the approach to this has been revised.
Insight
A handler's configuration form already is the definition of valid configuration.
buildConfigurationForm()builds its select options from the webform's current elements (filtered to supported types), marks mandatory settings#requiredandvalidateConfigurationForm()holds the handler's custom validations.Idea
Programatically run the logic from the handlers without submitting them in a wrapper. The wrapper reuses the handler's build and validate steps but has an empty
submitForm(), so validation runs without no actual submit.gBarlach commentedon Oct 12, 2026
@ds-bellcom vil I lave code review af denne?
ds-bellcom commentedon Oct 13, 2026
@gBarlach vi estimerer at skulle bruge ca. 3,5 timer på at lave review. Giv besked hvis vi skal planlægge det.
gBarlach commentedon Oct 13, 2026
@ds-bellcom Det er hermed godkendt at I laver review på 3,5 timer.
ds-bellcom commentedon Oct 14, 2026
@gBarlach Stan har lavet review i dag og har et par kommentarer til ITK.
gBarlach commentedon Oct 15, 2026
@MadNicGit vil I kigge på Bellcoms kommentarer ?
gBarlach commentedon Oct 21, 2026
Hermed godkendt til efterårsrelease 2, 2026