feat(ir): implement core IR document and closed domain sums #14

Merged
yorunikakeru merged 22 commits from feat/core-ir into main 2026-06-06 16:39:16 +02:00
Owner

Summary

  • Add Cabal library stanza with aeson and text dependencies
  • Implement domain modules: IR.Domain.{Process,Service,Power,Network} with newtypes and closed sum types
  • Add root closed sums: IR.Condition, IR.Action, IR.Policy wrapping domain types
  • Add IR.Types: IRDocument, IRVersion, ProfileSection, ServiceSection
  • Add IR.Validated with opaque ValidatedIR constructor (only validate produces it)
  • Add IR.Serialization with ToJSON/FromJSON for the intent.json schema
  • Add tasty-golden test suite: 23 tests including golden JSON fixtures and round-trip tests

Closes #7

## Summary - Add Cabal library stanza with `aeson` and `text` dependencies - Implement domain modules: `IR.Domain.{Process,Service,Power,Network}` with newtypes and closed sum types - Add root closed sums: `IR.Condition`, `IR.Action`, `IR.Policy` wrapping domain types - Add `IR.Types`: `IRDocument`, `IRVersion`, `ProfileSection`, `ServiceSection` - Add `IR.Validated` with opaque `ValidatedIR` constructor (only `validate` produces it) - Add `IR.Serialization` with `ToJSON`/`FromJSON` for the intent.json schema - Add `tasty-golden` test suite: 23 tests including golden JSON fixtures and round-trip tests Closes #7
ports :: [Word16] -> [Port] converts a list of raw port numbers to
[Port], reducing boilerplate at call sites.
Each domain gets its own serialization module:
IR.Serialization.{Process,Service,Power,Network,Document}
IR.Serialization remains an aggregator that imports all instances.
ToJSON/FromJSON instances moved into domain modules and IR.{Condition,Action,Policy,Types}.
IR.Serialization.* deleted — no longer needed as a side-effect-import facade.
Orphan warnings eliminated without suppression pragmas.
ProfileSection switches to genericToJSON; policies field now always emitted.
Enable StrictData globally via default-extensions to prevent space leaks.
Replace length-based prefix stripping with Data.List.stripPrefix (STAN-0103).
Rename wildcard _ to _unknownType in all FromJSON catch-all branches (STAN-0213).
Document all three rules in AGENTS.md.
Silent fallthrough masked misconfigured field options — wrong JSON
field names with no warning. Now errors with descriptive message.
merge: Merge branch 'main' into feat/core-ir
All checks were successful
CI / linux (pull_request) Successful in 7m34s
9084eca414
docs: add changelog rule to AGENTS and fill unreleased section
Some checks failed
CI / linux (pull_request) Has been cancelled
ea251ac942
Sign in to join this conversation.
No reviewers
No labels
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
FrogOS/DSL!14
No description provided.