Slice 9 (Deferred): Consolidate SyncRunResult / OrchestratorResult #45

Closed
opened 2026-06-05 18:11:53 +02:00 by AlexKucera · 1 comment
AlexKucera commented 2026-06-05 18:11:53 +02:00 (Migrated from github.com)

Parent

#36 — PRD-003: Deepen Codebase Architecture

What to build

Eliminate the structural duplication between SyncRunResult and OrchestratorResult. They share 6 of 8 fields (downloaded_count, skipped_count, failed_count, failed_books, skipped_books, interrupted). SyncRunResult adds only fatal_error. Two nearly-identical frozen dataclasses will drift out of sync if anyone adds a field to one and forgets the other.

Options to explore:

  • Composition: SyncRunResult holds an orchestrator_result: OrchestratorResult field plus fatal_error
  • Inheritance: SyncRunResult extends OrchestratorResult
  • Accept and document: Both types serve different layers; duplication is stable and intentional

Acceptance criteria

  • A single source of truth for download-count fields exists
  • No copy-paste drift risk between the two result types
  • All call sites updated (cli.py reads SyncRunResult; orchestrator.py returns OrchestratorResult; sync_run.py assembles both)
  • Full test suite passes

Blocked by

None technically, but deferred per PRD-003 Decision — low priority, no current drift. Do this when either type needs modification for other reasons.

Deferred per PRD-003 Decision: Low-friction duplication; both types serve different layers. Deferring until either type needs modification for other reasons.

## Parent #36 — PRD-003: Deepen Codebase Architecture ## What to build Eliminate the structural duplication between `SyncRunResult` and `OrchestratorResult`. They share 6 of 8 fields (downloaded_count, skipped_count, failed_count, failed_books, skipped_books, interrupted). SyncRunResult adds only `fatal_error`. Two nearly-identical frozen dataclasses will drift out of sync if anyone adds a field to one and forgets the other. Options to explore: - **Composition:** SyncRunResult holds an `orchestrator_result: OrchestratorResult` field plus `fatal_error` - **Inheritance:** SyncRunResult extends OrchestratorResult - **Accept and document:** Both types serve different layers; duplication is stable and intentional ## Acceptance criteria - [ ] A single source of truth for download-count fields exists - [ ] No copy-paste drift risk between the two result types - [ ] All call sites updated (cli.py reads SyncRunResult; orchestrator.py returns OrchestratorResult; sync_run.py assembles both) - [ ] Full test suite passes ## Blocked by None technically, but **deferred per PRD-003 Decision** — low priority, no current drift. Do this when either type needs modification for other reasons. > **Deferred per PRD-003 Decision:** Low-friction duplication; both types serve different layers. Deferring until either type needs modification for other reasons.
AlexKucera commented 2026-06-06 08:15:05 +02:00 (Migrated from github.com)

Composed SyncRunResult around OrchestratorResult — 6 delegating properties, bridge copy code eliminated, all 4 AC met. 172/172 tests pass.

Composed `SyncRunResult` around `OrchestratorResult` — 6 delegating properties, bridge copy code eliminated, all 4 AC met. 172/172 tests pass.
Sign in to join this conversation.