Skip to content

Wave 6 Track B: Boundary cleanup + documentation#1389

Merged
breznknecht merged 4 commits intomainfrom
wave6-track-b
Apr 1, 2026
Merged

Wave 6 Track B: Boundary cleanup + documentation#1389
breznknecht merged 4 commits intomainfrom
wave6-track-b

Conversation

@breznknecht
Copy link
Copy Markdown
Collaborator

What

Resolves the 9 pre-existing Layer 1→2 violations tracked in #1368, plus updates documentation to reflect the runtime-first architecture.

PR B-6.1: Resolve Layer violations

6 modules moved to correct layer (Layer 0):

  • MingaEditor.UI.DeviconMinga.Language.Devicon
  • MingaEditor.UI.Highlight.GrammarMinga.Language.Grammar
  • MingaEditor.UI.Highlight.SpanMinga.Language.Highlight.Span
  • MingaEditor.UI.Highlight.InjectionRangeMinga.Language.Highlight.InjectionRange
  • MingaEditor.UI.Popup.RuleMinga.Popup.Rule
  • MingaEditor.UI.Popup.RegistryMinga.Popup.Registry

Parser protocol extracted to Layer 0:

  • Created Minga.Parser.Protocol with all tree-sitter encode/decode functions
  • MingaEditor.Frontend.Protocol delegates parser functions to it
  • Minga.Parser.Manager uses Minga.Parser.Protocol directly (no Layer 2 dep)

Cross-layer calls replaced with events:

  • Config.Loader theme loading → :load_user_themes event broadcast
  • Parser.Manager log_to_messages → :log_message event broadcast

Bonus fixes: Minga.LSP.SemanticTokens and Minga.Editing.Comment had undiscovered violations (fully qualified struct references the credo check doesn't catch).

Thin delegate modules at old paths preserve backward compatibility for existing MingaEditor callers.

PR B-6.2: Documentation pass

  • Added three sections to docs/ARCHITECTURE.md: Three-Namespace Architecture, Headless Runtime, API Gateway
  • Updated AGENTS.md module grouping table for three-namespace layout
  • Updated docs/PLAN-runtime-first.md progress log and discoveries

Verification

  • make lint passes (format + credo + compile + dialyzer)
  • mix test.llm: 7,418 tests, 0 failures
  • @allowed_references contains only structural dispatch entries (Protocol → Protocol.GUI)
  • Zero alias MingaEditor/import MingaEditor in lib/minga/ or lib/minga_agent/

Closes #1368

Move misclassified modules to their correct architectural layers:

- MingaEditor.UI.Devicon → Minga.Language.Devicon (pure filetype-to-icon mapping)
- MingaEditor.UI.Highlight.Grammar → Minga.Language.Grammar (filetype-to-treesitter ETS registry)
- MingaEditor.UI.Highlight.Span → Minga.Language.Highlight.Span (pure data struct)
- MingaEditor.UI.Highlight.InjectionRange → Minga.Language.Highlight.InjectionRange (pure data struct)
- MingaEditor.UI.Popup.Rule → Minga.Popup.Rule (pure data struct with validation)
- MingaEditor.UI.Popup.Registry → Minga.Popup.Registry (ETS registry)

Extract parser protocol into Layer 0:

- Create Minga.Parser.Protocol with all tree-sitter encode/decode functions
- MingaEditor.Frontend.Protocol delegates parser functions to it
- Parser.Manager now uses Minga.Parser.Protocol (no Layer 2 dependency)

Replace direct cross-layer calls with events:

- Config.Loader theme loading → :load_user_themes event (Editor subscribes)
- Parser.Manager log_to_messages → :log_message event broadcast

Also fixes bonus violations found during audit:
- Minga.LSP.SemanticTokens → was using MingaEditor.UI.Highlight.Span
- Minga.Editing.Comment → was using MingaEditor.UI.Highlight.InjectionRange

Thin delegate modules at old paths preserve backward compatibility for
MingaEditor callers. The @allowed_references list in the credo check
now contains only structural dispatch entries (Protocol → Protocol.GUI).

35 files changed. All 7,418 tests pass. make lint clean.
…e sections

Update docs/ARCHITECTURE.md with three new sections:
- Three-Namespace Architecture: explains Minga/MingaAgent/MingaEditor
  layer structure and the credo check that enforces it
- Headless Runtime: Minga.Runtime.start/1 and what it boots
- API Gateway: WebSocket + JSON-RPC, method names, event streaming

Update AGENTS.md module grouping table to reflect the three-namespace
layout with Layer 0/1/2 sections replacing the old single flat table.

Update docs/PLAN-runtime-first.md progress log and discoveries with
Wave 6 Track B findings.
File tree integration tests were intermittently flaky (~1-2 out of 20
runs) because the file tree scanned Project.root() (the real project
directory) instead of each test's tmp_dir. Concurrent async tests
creating/deleting files shifted the entry list between operations.

The fix adds a project_root field to FileTreeState. When set,
Commands.FileTree.open/1 uses it instead of Project.root(). Tests
pass project_root: dir through start_editor opts so each test's
file tree scans only its own fixture directory.

Also tightened expand/collapse assertions to check for specific file
content (gamma.txt visible/hidden) instead of comparing row counts,
which were a weak signal even without the concurrency issue.

Changes:
- lib/minga_editor/state/file_tree.ex: add project_root field
- lib/minga_editor/commands/file_tree.ex: use project_root in open/1
- lib/minga_editor/startup.ex: thread project_root from editor opts
- lib/minga_editor/state.ex: preserve project_root in tab context snapshots
- test/support/editor_case.ex: thread project_root to editor_opts
- test/minga_editor/integration/file_tree_test.exs: pass project_root,
  tighten assertions
- test/minga_editor/commands/file_tree_editing_test.exs: pass project_root
- test/minga_editor/commands/file_tree_reveal_test.exs: pass project_root
- test/minga_editor/file_tree_integration_test.exs: pass project_root
@breznknecht breznknecht merged commit f829ed5 into main Apr 1, 2026
6 of 7 checks passed
@breznknecht breznknecht deleted the wave6-track-b branch April 1, 2026 20:40
jsmestad pushed a commit that referenced this pull request Apr 1, 2026
All gate criteria met:
- Buffer.Fork routing works (Track A, #1390)
- Boundary violations resolved to zero (Track B #1389, cleanup #1391)
- Documentation updated (Track B, #1389)

Added progress log entries and discoveries for Track A and cleanup.
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.

Fix 9 pre-existing Layer 1 → Layer 2 dependency violations exposed by namespace split

1 participant