feat(rules): detect direct I/O adapter bypass in core and commands #89

Closed
opened 2026-05-27 06:17:11 +02:00 by michael · 2 comments
Owner

Problem

DAW projects must never access I/O directly in core/ or commands/ --
all output must go through the UI adapter (adapters/ui).
All input/output must be injectable and replaceable without touching core code.

Currently fragjan has a violation in core/commands.lua:
return require("daw.common.sys").new()

This binds fragjan to CLI output. A fragjan-api or fragjan-web would
require core changes instead of just a different adapter.

Goal

Add fragjan rules to detect direct adapter bypass:

  • no-direct-sys-new: daw.common.sys instantiated outside adapters/ and main.lua
  • Possibly: detect direct require of other daw.common.* in core/

Acceptance criteria

  • Rule detects daw.common.sys usage outside allowed paths
  • file_exclude covers lib/, adapters/ui/, main.lua
  • Severity: error
  • Depends on DAW/fragjan#88 (** glob support in file_exclude)

Affected projects

Pattern appears in fragjan/core/commands.lua and merkwerk/core/commands.lua.
Likely present in all DAW host projects -- this rule will find violations
across 20+ repos once deployed.

## Problem DAW projects must never access I/O directly in core/ or commands/ -- all output must go through the UI adapter (adapters/ui). All input/output must be injectable and replaceable without touching core code. Currently fragjan has a violation in core/commands.lua: return require("daw.common.sys").new() This binds fragjan to CLI output. A fragjan-api or fragjan-web would require core changes instead of just a different adapter. ## Goal Add fragjan rules to detect direct adapter bypass: - no-direct-sys-new: daw.common.sys instantiated outside adapters/ and main.lua - Possibly: detect direct require of other daw.common.* in core/ ## Acceptance criteria - [ ] Rule detects daw.common.sys usage outside allowed paths - [ ] file_exclude covers lib/, adapters/ui/, main.lua - [ ] Severity: error - [ ] Depends on DAW/fragjan#88 (** glob support in file_exclude) ## Affected projects Pattern appears in fragjan/core/commands.lua and merkwerk/core/commands.lua. Likely present in all DAW host projects -- this rule will find violations across 20+ repos once deployed.
michael added this to the Basic Version milestone 2026-05-30 16:08:42 +02:00
Author
Owner

Blocked by DAW/fragjan#102 (feat(runner): flexible scan targets --
file_include, glob patterns, single file, auto-root detection).

Blocked by DAW/fragjan#102 (feat(runner): flexible scan targets -- file_include, glob patterns, single file, auto-root detection).
Author
Owner

Completed

  • no-direct-sys-new rule added to daw-architecture pack
  • Detects daw.common.sys usage outside adapters/ and main.lua
  • file_exclude: lib/, adapters/, main.lua
  • Severity: error
  • Unblocked by DAW/fragjan#102
  • Known violation: core/commands.lua:11 (fragjan and likely all DAW host projects)
## Completed - no-direct-sys-new rule added to daw-architecture pack - Detects daw.common.sys usage outside adapters/ and main.lua - file_exclude: lib/**, adapters/**, main.lua - Severity: error - Unblocked by DAW/fragjan#102 - Known violation: core/commands.lua:11 (fragjan and likely all DAW host projects)
michael 2026-05-31 15:22:36 +02:00
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#89
No description provided.