fix(adapters/ui): results.lua compares against fixed status literals #154

Open
opened 2026-11-18 11:15:25 +01:00 by michael · 0 comments
Owner

Problem

adapters/ui/results.lua decides what to show with a fixed chain of
comparisons against literal values (status == "listed", "available",
"outdated", "installed", "removed", "decision_required", ...,
about 18 branches, lines 50-155). There must be no fixed comparisons in
code: a program has to be adaptable by data and configuration, without
changing the program.

Goal

The set of result kinds and what is shown for each come from data
(contract, contribution of the module or configuration), not from
literals in the code. A new or changed result kind needs no change in
results.lua.

Questions for the implementation

  • where is the set of result kinds defined today (contract, module
    contribution)? The code must read it from there.
  • what happens with an unknown kind: shown as a problem, never silently

Acceptance criteria

  • tests first: a result kind that is only in the data is shown
    without a code change
  • no literal result kind is left in results.lua
  • fragjan code . and make test (Lua 5.1 and 5.4) pass

DAW/fragjan#153

## Problem `adapters/ui/results.lua` decides what to show with a fixed chain of comparisons against literal values (`status == "listed"`, `"available"`, `"outdated"`, `"installed"`, `"removed"`, `"decision_required"`, ..., about 18 branches, lines 50-155). There must be no fixed comparisons in code: a program has to be adaptable by data and configuration, without changing the program. ## Goal The set of result kinds and what is shown for each come from data (contract, contribution of the module or configuration), not from literals in the code. A new or changed result kind needs no change in `results.lua`. ## Questions for the implementation - where is the set of result kinds defined today (contract, module contribution)? The code must read it from there. - what happens with an unknown kind: shown as a problem, never silently ## Acceptance criteria - [ ] tests first: a result kind that is only in the data is shown without a code change - [ ] no literal result kind is left in `results.lua` - [ ] `fragjan code .` and `make test` (Lua 5.1 and 5.4) pass ## Related DAW/fragjan#153
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#154
No description provided.