feat(architecture): route output through berhtjan instead of direct sys calls #90
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/architecture
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
research
type
security
type/task
type/tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/fragjan#90
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
fragjan currently outputs directly via daw.common.sys instead of routing
through berhtjan. This bypasses the UI adapter layer and binds fragjan
to CLI output.
The correct output chain is:
fragjan core -> fragjan_result/v1 -> berhtjan-cli -> Terminal
-> berhtjan-api -> HTTP
-> berhtjan-web -> Browser
Current violation
core/commands.lua:
return require("daw.common.sys").new()
reporter.lua writes directly to a sys instance instead of handing
fragjan_result/v1 tables to a berhtjan renderer.
Goal
Dependencies
(adapter bypass detection) for validation
Notes
This is a larger architectural change. Current sys-based output is a
known temporary shortcut -- tracked here for intentional resolution.
Correction: output must route through adapters/ui (the existing UI adapter), not directly to berhtjan. adapters/ui decides which berhtjan module handles output. core/ never touches modules directly.
Correct chain:
fragjan core -> adapters/ui -> berhtjan-cli -> Terminal
-> berhtjan-api -> HTTP
-> berhtjan-web -> Browser
adapters/ui needs to be extended with output operations in addition to the existing dispatch.
Concept clarification
What fragjan_result/v1 looks like
Defined in fragjan-konzept.md:
reporter.lua already uses r.status and r.message.text -- the fields
are there, only the output path is wrong.
Correct chain (confirmed)
berhtjan receives fields to display. Business logic stays in reporter.lua.
Concrete changes required
reporter.lua
outparameter from M.report()adapters/ui (DAW/fragjan)
renderoperation to _contracts and required_ops()berhtjan-cli
core/commands/init.lua
Dependencies
(log output also routes through adapters/ui, not sys directly)
Open question
render() operation name vs. report() -- to be decided when
adapters/ui output operations are defined.
Concept clarification (revised)
What fragjan_result/v1 looks like
Defined in fragjan-konzept.md:
Correct chain (confirmed)
reporter.lua knows nothing about berhtjan. adapters/ui is the
translation layer -- it knows what fragjan delivers and what
berhtjan expects. berhtjan-cli renders generic fields.
Concrete changes required
reporter.lua
outparameter from M.report()adapters/ui (DAW/fragjan)
renderoperation to _contracts and required_ops()berhtjan-cli
core/commands/init.lua
Dependencies
(log output also routes through adapters/ui, not sys directly)
Concept clarification (revised)
What fragjan_result/v1 looks like
Defined in fragjan-konzept.md:
Correct chain (confirmed)
reporter.lua knows nothing about berhtjan. adapters/ui is the
translation layer -- it knows what fragjan delivers and what
berhtjan expects. berhtjan-cli renders generic fields.
Concrete changes required
reporter.lua
outparameter from M.report()adapters/ui (DAW/fragjan)
renderoperation to _contracts and required_ops()berhtjan-cli
core/commands/init.lua
Dependencies
(log output also routes through adapters/ui, not sys directly)
Next step: extend adapters/ui with render()
adapters/ui/init.lua changes
Add _contracts table:
Add render() function:
Notes
Next step: extend adapters/ui with render()
Design decision: generic render() with schema-versioned types
render() dispatches by schema string -- same pattern as fragjan_result/v1.
Unknown type returns nil, err. New types add a dispatcher entry, no contract change.
Known types (Phase 1):
fragjan_result/v1 -- fragjan check results, summary, suppressions
daw_log/v1 -- log message (level, module, text)
daw_log/v1 is the shared format for adapters/ui (display) and
adapters/log (persistence) -- same type, two possible sinks.
adapters/ui/init.lua changes
Notes
Next step: extend adapters/ui with render() [current decision]
Translation chain
adapters/ui is the translation layer. It knows fragjan schemas and
converts them to ui_types/v1 (berhtjan-core primitives: text, textarea,
number, boolean, select, date). berhtjan never sees fragjan-specific
structures.
adapters/ui/init.lua changes
Add _contracts:
Add schema dispatcher and render():
required_ops extension
render() must be added to required_ops() so check() validates
all UI providers implement it:
Notes
Completed in v0.3.0
Full output chain implemented and deployed.
Final chain
reporter.lua -> fragjan_result/v1 -> adapters/ui -> ui_types/v1 -> berhtjan-cli
What changed
Follow-up