medium priority low complexity documentation pending documentor Tier 9

Acceptance Criteria

Adapter interface contract document exists with complete Dart abstract class definition including all required method signatures, return types, and thrown exception types
Step-by-step guide for adding a new external system adapter (e.g., a hypothetical new ERP) covers: creating the adapter class, registering it in the integration type registry, defining credential schema, and writing field mappings
Integration Config Service public API document lists every public method with its full Dart signature, parameter descriptions, return type, and all possible error/exception types (including network, auth, and validation failures)
FieldMappingResolver transformation pipeline is documented with a diagram or pseudocode showing input → transform chain → output, with at least two worked examples using real integration targets (e.g., Xledger, Dynamics)
Validator rule extension pattern is documented showing how to register a new validation rule without modifying existing validator code (open/closed principle)
All code samples in documentation compile without errors in the current Dart/Flutter version
Documentation reviewed by at least one developer not involved in the original implementation who confirms they could add a new adapter using only this guide
Document is stored in the repository under docs/ or equivalent and linked from the project README

Technical Requirements

frameworks
Flutter
Dart
apis
Xledger REST API
Microsoft Dynamics REST API
Cornerstone API
Consio API
Bufdir reporting API
data models
IntegrationAdapter
IntegrationConfig
FieldMapping
CredentialSchema
ValidationRule
performance requirements
Documentation must include latency expectations for each adapter operation (connect, fetch, push)
Batch size limits per integration system must be documented
security requirements
Documentation must explicitly state that credential fields must never be passed through FieldMappingResolver
Vault secret ID handling must be documented as opaque — no raw credential access in adapter layer
All adapter implementations must document their authentication mechanism and token refresh strategy

Execution Context

Execution Tier
Tier 9

Tier 9 - 22 tasks

Can start after Tier 8 completes

Integration Task

Handles integration between different epics or system components. Requires coordination across multiple development streams.

Implementation Notes

Write documentation as Markdown files co-located with the source code (e.g., docs/integrations/adapter-extension-guide.md). Use real integration names (Xledger, Dynamics, Cornerstone, Consio, Bufdir) in all examples — avoid generic 'MyAdapter' placeholders wherever possible to maximize relevance. Structure the adapter guide as: (1) Prerequisites, (2) Interface contract with annotated Dart abstract class, (3) Step-by-step implementation walkthrough, (4) Registration in the type registry, (5) Testing your adapter. For the FieldMappingResolver pipeline, a linear flow diagram (even ASCII art) aids comprehension significantly.

Ensure the Validator section demonstrates the extension pattern using a concrete example such as a Norwegian organization number (organisasjonsnummer) validator. Cross-reference all sections to actual source file paths to reduce context-switching for future developers.

Testing Requirements

No automated tests required for documentation itself. However, include a documentation validation checklist: (1) Code samples must be copy-pasteable and compile in isolation.

(2) At minimum one 'new adapter walkthrough' must be validated by a developer following the guide from scratch on a feature branch. (3) All referenced method names must be verified against the actual codebase to prevent doc drift. Suggest a CI lint step that checks for broken internal doc references.

Component
REST API Adapter Registry
service high
Epic Risks (3)
medium impact high prob technical

Each of the five external systems (Xledger, Dynamics, Cornerstone, Consio, Bufdir) has a different authentication flow, field schema, and error format. Forcing them into a uniform adapter interface may require compromises that result in leaky abstractions or make the adapter contract too complex to maintain.

Mitigation & Contingency

Mitigation: Design the IntegrationAdapter interface with a loose invoke() payload rather than a typed one, allowing each adapter to declare its own input/output schema. Use integration type metadata in the registry to document per-adapter quirks. Build Xledger first as the most documented API, then adapt the interface based on learnings.

Contingency: If the uniform interface cannot accommodate all five systems, split into two interface tiers: a simple polling/export adapter and a richer bidirectional adapter, with the registry declaring which tier each system implements.

medium impact high prob dependency

Development and testing of the Cornerstone and Consio adapters depends on NHF providing sandbox API access. If credentials or documentation are delayed, these adapters cannot be validated, blocking the epic's acceptance criteria.

Mitigation & Contingency

Mitigation: Implement Xledger and Dynamics adapters first (better-documented, sandbox available). Create a mock adapter for Cornerstone/Consio using recorded API responses for CI testing. Proactively request sandbox access from NHF at project kickoff.

Contingency: Ship the epic with Cornerstone/Consio adapters in a 'stub' state (connectivity test returns a simulated success, invoke() is not production-wired) and gate the NHF integration behind a feature flag until real API access is obtained.

medium impact medium prob scope

Real-world field mappings may include nested transformations, conditional logic, and data type coercions (e.g., Norwegian date formats, currency rounding rules) that the Field Mapping Resolver's initial design does not accommodate, requiring scope expansion mid-epic.

Mitigation & Contingency

Mitigation: Gather actual field mapping examples from Blindeforbundet (Xledger) and HLF (Dynamics) before designing the resolver. Identify the most complex transformation required and ensure the resolver design handles it. Limit Phase 1 to direct field renaming and format conversion only.

Contingency: If complex transformations are required, implement a simple expression evaluator (e.g., JSONata or a custom mini-DSL) as an extension point in the resolver, delivering basic mappings first and complex ones in a follow-up task.