# V1 Block 23 — Export Abstraction Layer **Purpose**: Define Export controller and writer interface. > **Note for Codex**: Follow tasks exactly; avoid exploratory calls when tasks specify names/files/tests. ## Chunk 23.1 — Export controller contract Recommended level: **XHIGH** Status: Complete on 2026-06-26. ### Tasks 1. Add package **`packages/scheduler_export`**. 2. Define abstract class `ExportWriter` with `Future begin(ExportContext)`, `Future writeTask(Task)`, `Future end()`, plus factory registry. 3. Define `ExportController` orchestrating repository queries and writer. 4. Provide context object with `ownerId`, `timezone`, `version`. ### Acceptance criteria 1. JSONWriter and CSVWriter stubs compile and implement interface. 2. Unit test writes small set and verifies output. ### Completed implementation 1. Added package `packages/scheduler_export` with public entry points `export.dart` and `scheduler_export.dart`. 2. Added `ExportContext` carrying `ownerId`, `timezone`, and `version`. 3. Added `ExportWriter`, `ExportWriterFactory`, and `ExportWriterRegistry` with default `json` and `csv` mappings. 4. Added `ExportController` that reads owner-scoped paged tasks through `TaskRepository` and streams them to a writer. 5. Added compiling `JsonExportWriter` and `CsvExportWriter` implementations backed by `StringSink`. 6. Added unit tests for owner-scoped JSON export, CSV output, and custom writer factory registration. 7. Wired export tests into the root test wrapper. ### Verification 1. `dart pub get`: passed. 2. `dart format test/scheduler_core_test.dart packages/scheduler_export`: passed. 3. `cd packages/scheduler_export && dart analyze`: passed, no issues found. 4. `cd packages/scheduler_export && dart test`: passed, 3 tests. 5. `dart analyze`: passed, no issues found. 6. `dart test`: passed, 327 tests. 7. `scripts/test.sh`: not present or not executable. ---