fix(fieldtype): closed contract lists and kind comparisons are fixed in code #26
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type
docs
type/documentation
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type/refactor
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-modul-berhtjan-core#26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Contract values are fixed in the code of
berhtjan-core. There must beno fixed values or comparisons in code: a program has to be adaptable by
data and configuration, without changing the program.
Found in a review of the DAW ecosystem against its contracts:
fieldtype.lua(lines 44-50) repeats closed lists that stand asallowedin thecontract.jsonofdaw_field_type/v1:ACQUISITION_KINDS,COLLECTION_SOURCES,CARDINALITIES,CONSTRAINT_KEYSfieldtype.lua:91andresponse.lua:126compareentry.kindagainstthe literal
"selection"Goal
The values come from data (the contract), not from literals in the code.
A change of a closed list in the contract needs no change of the code.
Questions for the implementation
How does the module get the contract data?
"selection"decide which mechanism is used(selection). How does this relate to "no fixed comparisons"?
To be decided before the implementation.
Acceptance criteria
without a code change; a value that is not in it is rejected
fieldtype.luaandresponse.luafragjan code .andmake test(Lua 5.1 and 5.4) passRelated
DAW/daw-modul-berhtjan-cli (the same finding in
answer.lua),DAW/daw-contracts (
daw_field_type/v1), DAW/fragjan#154, DAW/fragjan#155,DAW/fragjan#156 (the same rule in fragjan)