- Add comprehensive 8-phase implementation plan (docs/plan.md) - Add 28 Architecture Decision Records (docs/adr/) covering all phases - Add task tracking system with 283+ task files (docs/stories/) - Add task generator script for automated task file creation - Add reference playbooks and requirements documentation This commit establishes the complete planning foundation for the Go Platform implementation, documenting all architectural decisions and providing detailed task breakdown for Phases 0-8.
1.8 KiB
1.8 KiB
ADR-0019: Permission DSL Format
Status
Accepted
Context
The platform needs a permission system that:
- Is extensible by modules
- Prevents typos and errors (compile-time safety)
- Supports hierarchical permissions
- Is easy to understand and use
Permission formats considered:
- String format:
"module.resource.action"- Simple, flexible - Enum/Constants: Type-safe but less flexible
- Hierarchical tree: Complex but powerful
- Bitmask: Efficient but hard to read
Decision
Use string-based permission format with code-generated constants:
- Format:
"{module}.{resource}.{action}"- Examples:
blog.post.create,user.read,system.health.check
- Examples:
- Code generation: Generate constants from
module.yamlfiles - Type safety:
type Permission stringwith generated constants - Validation: Compile-time constants prevent typos
Rationale:
- Simple and readable
- Easy to extend (modules define in manifest)
- Code generation provides compile-time safety
- Flexible (modules can define any format)
- Hierarchical structure is intuitive
- Easy to parse and match
Consequences
Positive
- Simple and intuitive format
- Compile-time safety via code generation
- Easy to extend by modules
- Human-readable
- Flexible for various permission models
Negative
- String comparisons (minimal performance impact)
- Requires code generation step
- Potential for permission string conflicts (mitigated by module prefix)
Implementation Notes
- Define
type Permission stringinpkg/perm/perm.go - Create code generator:
scripts/generate-permissions.go - Scan
modules/*/module.yamlfor permissions - Generate constants in
pkg/perm/generated.go - Use
//go:generatedirective - Validate format:
^[a-z0-9]+(\.[a-z0-9]+)*$(lowercase, dots)