Document public API and integration contract
epic-expense-type-selection-foundation-task-014 — Produce developer documentation for all four foundation components: ExpenseTypeConfig (enum variants, FormulaParameters fields, JSON schema), MutualExclusionRuleEngine (method signatures, return types, error cases), ExpenseTypeAccessibilityService (label contract, announcement politeness levels, debounce behaviour), and ExpenseTypeAnalyticsTracker (event types, PII guarantees, flush strategy). Include a dependency diagram showing how higher-tier components (BLoC, repository) should import these modules. Documentation must be in English.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 5 - 253 tasks
Can start after Tier 4 completes
Implementation Notes
Enable the `public_member_api_docs` analysis option only for the `lib/features/expense/domain/` directory by adding a local `analysis_options.yaml` there, to avoid requiring dartdoc comments across the entire codebase. Use Mermaid syntax for the dependency diagram in the markdown file ā it renders natively on GitHub and can be copy-pasted into Confluence. For WCAG references, cite the specific success criterion (e.g. SC 4.1.3 Status Messages) rather than just 'WCAG 2.2 AA' to give future developers an auditable reference.
Keep the JSON schema example minimal but complete ā one valid example object covering all required fields is sufficient. Write the dartdoc examples in `/// Example:` blocks using triple-slash fenced code so dart doc renders them as formatted snippets.
Testing Requirements
Documentation quality is verified by: (1) running `dart doc` and asserting zero warnings in CI, (2) a documentation linting step (e.g. `dart analyze` with the `public_member_api_docs` lint rule enabled for the foundation layer files). No runtime tests are needed for this task. Reviewer checklist: every public API member has a doc comment, the dependency diagram is accurate relative to the actual import graph, and the PII guarantee statement is present and specific.
The compatibility matrix might be under-specified in source documentation. If a new organisation adds expense types or redefines rules, hardcoded pairwise logic becomes a maintenance liability and can silently allow previously excluded combinations.
Mitigation & Contingency
Mitigation: Model the matrix as a const Map<ExpenseType, Set<ExpenseType>> rather than if-else chains; add a unit test that exhaustively asserts every pair combination so any future matrix change forces explicit test updates.
Contingency: If per-organisation matrix variants are requested before the epic closes, extract matrix loading into expense-type-config with an org-override slot and defer per-org configuration to the repository epic.
VoiceOver (iOS) and TalkBack (Android) handle Semantics widget announcements differently in Flutter. Live-region behaviour for disabled state changes is inconsistent across Flutter versions and may require platform-specific workarounds that are not yet documented.
Mitigation & Contingency
Mitigation: Write accessibility integration tests using Flutter's SemanticsController targeting both iOS and Android simulators from the outset; pin to a Flutter version known to handle Semantics.liveRegion correctly.
Contingency: If platform parity is unachievable before release, ship with a known gap documented in the WCAG audit log and schedule a dedicated accessibility sprint; do not block other epics.