feat(rules): adapter-has-contracts rule for daw-architecture pack #33

Closed
opened 2026-05-25 10:55:47 +02:00 by michael · 2 comments
Owner

Problem

Adapters in DAW projects define contracts via _contracts table for hailjan
runtime observation. fragjan can statically verify that adapters declare
their contracts -- without _contracts, hailjan cannot observe the adapter.

Solution

New rule: adapter-has-contracts

Check that every file matching adapters/*.lua contains a _contracts table
declaration.

primitive: daw.fragjan.check.pattern
pattern: "_contracts ="
file_pattern: "adapters/*.lua"
match_type: contains
skip_comments: true
severity: warn

Pack: daw-architecture (adapter contract enforcement fits there)

Notes

This closes the static analysis side of the fragjan/hailjan learning loop:

hailjan log    --> anomaly detected at runtime
               --> human recognizes pattern
               --> new YAML rule in fragjan pack
               --> fragjan catches it statically next run
               --> anomaly no longer occurs

fragjan checks if the cell has DNA (_contracts declared).
hailjan checks if the cell lives by its DNA (contracts honored at runtime).

The nil,nil bug in adapters/primitive/init.lua is the first concrete
example: hailjan would have logged it, fragjan gets a rule.

Dispatch adapters (adapters/ui) are a special case -- they may not need
_contracts in Phase 1. Revisit when hailjan Phase 3 is active.

## Problem Adapters in DAW projects define contracts via _contracts table for hailjan runtime observation. fragjan can statically verify that adapters declare their contracts -- without _contracts, hailjan cannot observe the adapter. ## Solution New rule: adapter-has-contracts Check that every file matching adapters/*.lua contains a _contracts table declaration. primitive: daw.fragjan.check.pattern pattern: "_contracts =" file_pattern: "adapters/*.lua" match_type: contains skip_comments: true severity: warn Pack: daw-architecture (adapter contract enforcement fits there) ## Notes This closes the static analysis side of the fragjan/hailjan learning loop: hailjan log --> anomaly detected at runtime --> human recognizes pattern --> new YAML rule in fragjan pack --> fragjan catches it statically next run --> anomaly no longer occurs fragjan checks if the cell has DNA (_contracts declared). hailjan checks if the cell lives by its DNA (contracts honored at runtime). The nil,nil bug in adapters/primitive/init.lua is the first concrete example: hailjan would have logged it, fragjan gets a rule. Dispatch adapters (adapters/ui) are a special case -- they may not need _contracts in Phase 1. Revisit when hailjan Phase 3 is active. ## Related - DAW/fragjan#28 (daw-architecture pack) - docs/projects/hailjan/hailjan-konzept.md - DAW/daw-docs#13
michael added this to the Basic Version milestone 2026-05-30 16:08:41 +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

  • adapter-has-contracts rule added to daw-architecture pack
  • Checks all adapters/*.lua for _contracts table declaration
  • Uses file_path: adapters/ with expected: true
  • Unblocked by DAW/fragjan#102
## Completed - adapter-has-contracts rule added to daw-architecture pack - Checks all adapters/*.lua for _contracts table declaration - Uses file_path: adapters/ with expected: true - Unblocked by DAW/fragjan#102
michael 2026-05-31 15:13:44 +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#33
No description provided.