A value passed to a property under CONSTRAINT ... CHECKED BY from a custom component is silently written as NULL when it is outside the filter
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by tracing how a pushed value is resolved against a dialog input's offered value list, including CHECKED BY filters, then follow how the default change action handles a missing value. The issue does not name files or tests, so locate those entry points in the Java platform code. Done when an out-of-list value cancels the change, preserves the previous value, and reports the constraint or a generic error.
Written by the indexing model from the issue text.
Description
Description
A property with a custom-class value is drawn with a custom component, and the component passes a new value through its controller (controller.change(id)). The property is listed in the CHECKED BY block of a constraint:
CLASS PTask 'Task';
CLASS PStatus 'Status';
name 'Name' = DATA STRING[50] (PStatus);
name 'Name' = DATA STRING[50] (PTask);
status 'Status' = DATA PStatus (PTask);
allowed 'Allowed' = DATA BOOLEAN (PTask, PStatus);
statusName 'Status name' (PTask t) = name(status(t));
CONSTRAINT status(PTask t) AND NOT allowed(t, status(t))
CHECKED BY status[PTask]
MESSAGE 'Status not allowed for the task';
FORM probeChecked 'Probe checked form'
OBJECTS t = PTask
PROPERTIES(t) name, status CUSTOM 'probeCustomStatus', statusName
;
Data: statuses New, Done, Blocked; a task with status = New and allowed = TRUE for New and Done only. The render function stores the controller it receives, and the test calls controller.change(<id>) on it (the same call a kanban board makes when a card is dropped into a column).
Actual:
controller.change(<id of Done>)(inside the filter): the status becomesDone, as expected.controller.change(<id of Blocked>)(outside the filter): the status becomesNULL. The previous valueNewis lost, nothing is shown to the user, and the constraint is not violated, so the change can be applied.
Expected: a value outside the CHECKED BY filter is not written: the change is refused (the previous value stays) and the user sees the constraint message, or at least an error. Writing NULL turns a filter that exists to prevent an invalid value into a data loss.
The same happens with any value that reaches the default change action of such a property without the selection dialog. A form-level ON CHANGE handler with INPUT s = PStatus DO { IF allowed(t, s) THEN status(t) <- s; ELSE MESSAGE ...; } is the workaround: it receives the passed id as the object and can refuse it.
Fix
When the value pushed into a dialog input with a value list is not found in the list (the CHECKED BY filters included), cancel the request instead of resolving it to NULL: the change is then not executed, and the constraint message (or a generic "value is not allowed" message) is shown.
Reason
The pushed value is resolved by looking it up in the list of offered values, which already carries the CHECKED BY filters; a value that is not found resolves to NULL, and the default change action writes the resolved value as it is.
- Dominant language
- Java
- Stars
- 214
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lsfusion/platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
All issues in lsfusion/platform
Similar issues
-
account assessment course feature lecture
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
app:learninggoalhub enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyPossibly taken @vaibhavgupta443 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/wicket#1991 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100