Skip to content

Phase 6: Compiler and DSL Integration - #10

Merged
pcharbon70 merged 5 commits into
mainfrom
feature/phase-6-compiler-and-dsl-integration
Mar 19, 2026
Merged

pcharbon70 merged 5 commits into
mainfrom
feature/phase-6-compiler-and-dsl-integration

Conversation

@pcharbon70

Copy link
Copy Markdown
Collaborator

Summary

Integrates the unified-ui compiler with Ash Resource loading to enable database-driven UI definitions.

Section 6.1 - Unified-UI DSL Storage

  • DSL storage format with type, props, children, signals
  • DSL builder helpers (root, row, column, text, button, input, container)
  • Signal binding helpers
  • DSL validation at write time
  • Widget type validation
  • Circular reference detection

Section 6.2 - Compiler Integration

  • Enhanced AshUI.Compiler with unified-ui compilation path
  • compile_screen/2 with caching support
  • compile_from_unified_dsl/2 for direct DSL compilation
  • compile_batch/2 for batch compilation
  • ETS-based compilation caching
  • Cache invalidation and statistics

Section 6.3 - Incremental Compilation

  • Track resource dependencies (element-to-screen, binding-to-element)
  • Dependency graph building for screens
  • Circular dependency detection
  • Selective recompilation on resource change
  • Batch recompilation for multiple changes

Section 6.4 - Compiler Extensions

  • register_widget/2 for custom widget types
  • register_layout/2 for custom layout types
  • get_widget/1 and get_layout/1 for looking up extensions
  • compile_widget/2 and compile_layout/2 for compilation
  • validate_widget_spec/1 and validate_layout_spec/1

Section 6.5 - Integration Tests

  • DSL storage and retrieval scenarios
  • Compilation scenarios (simple, complex, error handling, caching)
  • Incremental compilation scenarios
  • Extension scenarios (custom widgets, custom layouts)

Test plan

  • All DSL builder tests pass
  • All compiler integration tests pass
  • All incremental compilation tests pass
  • All extension tests pass
  • Integration tests validate end-to-end scenarios

Stored unified-ui DSL definitions in Ash Resource attributes:
- DSL storage format with type, props, children, signals
- DSL builder helpers (root, row, column, text, button, input, container)
- Signal binding helpers
- DSL validation at write time
- Widget type validation
- Signal reference validation
- Circular reference detection
- Metadata management
- Tests for DSL storage and builder
Integrated unified-ui compiler with Ash Resource loading:
- Enhanced AshUI.Compiler with unified-ui compilation path
- compile_screen/2 with caching support
- compile_from_unified_dsl/2 for direct DSL compilation
- compile_batch/2 for batch compilation
- ETS-based compilation caching with TTL
- Cache invalidation and statistics
- init_cache/0 for application startup
- Tests for compiler integration
Implemented efficient recompilation when resources change:
- Track resource dependencies (element-to-screen, binding-to-element)
- Dependency graph building for screens
- Circular dependency detection
- Selective recompilation on resource change
- Batch recompilation for multiple changes
- Cache-aware recompilation (only recompile affected screens)
- Tests for incremental compilation
Implemented custom widget and layout registration:
- register_widget/2 for custom widget types
- register_layout/2 for custom layout types
- get_widget/1 and get_layout/1 for looking up extensions
- compile_widget/2 and compile_layout/2 for compilation
- unregister_widget/1 and unregister_layout/1 for cleanup
- validate_widget_spec/1 and validate_layout_spec/1
- available_widget_types/0 and available_layout_types/0
- init/0 for initializing extension registries
- Tests for compiler extensions
Added comprehensive integration tests for Phase 6:
- DSL storage and retrieval scenarios
- Compilation scenarios (simple, complex, error handling, caching)
- Incremental compilation scenarios (dependencies, cache, circular detection)
- Extension scenarios (custom widgets, custom layouts)
- End-to-end compilation flows
- Performance scenarios
@pcharbon70
pcharbon70 merged commit 1ba3ec8 into main Mar 19, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant