Skip to content

refactor: extract business logic from listeners into services#16

Merged
rorybyrne merged 4 commits into
mainfrom
014-refactor-move-business
Jan 4, 2026
Merged

refactor: extract business logic from listeners into services#16
rorybyrne merged 4 commits into
mainfrom
014-refactor-move-business

Conversation

@rorybyrne

Copy link
Copy Markdown
Contributor

Summary

  • Move business logic from EventListeners into dedicated Service classes
  • Listeners now delegate to services (thin adapters)
  • Enables unit testing without event infrastructure
  • Enables reuse from multiple entry points (CLI, API, scheduled jobs)

Changes

Listener Service Lines removed
IngestFromUpstream IngestService ~50
ConvertDepositionToRecord RecordService ~35
ProjectNewRecordToIndexes IndexService ~10

Test plan

  • Unit tests for each new service (10 tests total)
  • Existing ingestor tests still pass
  • Lint and type checks pass

Closes #14

      Move business logic from EventListeners into dedicated Service classes:
      - IngestService (from IngestFromUpstream)
      - RecordService (from ConvertDepositionToRecord)
      - IndexService (from ProjectNewRecordToIndexes)

      Listeners now delegate to services, enabling unit testing without
      event infrastructure and reuse from multiple entry points.

      Closes #14
@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Complexity Health
. 62% 0
application 0% 0
application.api 100% 0
application.api.rest 0% 0
application.api.v1 0% 0
application.api.v1.routes 0% 0
application.event 0% 0
cli 40% 0
cli.commands 19% 0
cli.util 38% 0
domain 100% 0
domain.auth 100% 0
domain.auth.adapter 100% 0
domain.auth.command 100% 0
domain.auth.event 100% 0
domain.auth.model 100% 0
domain.auth.port 100% 0
domain.auth.query 100% 0
domain.auth.service 100% 0
domain.curation 100% 0
domain.curation.adapter 100% 0
domain.curation.command 100% 0
domain.curation.event 0% 0
domain.curation.listener 0% 0
domain.curation.model 100% 0
domain.curation.port 100% 0
domain.curation.query 100% 0
domain.curation.service 100% 0
domain.deposition 100% 0
domain.deposition.adapter 100% 0
domain.deposition.command 0% 0
domain.deposition.event 100% 0
domain.deposition.model 0% 0
domain.deposition.port 0% 0
domain.deposition.query 100% 0
domain.deposition.service 0% 0
domain.export 100% 0
domain.export.adapter 100% 0
domain.export.command 100% 0
domain.export.event 100% 0
domain.export.model 100% 0
domain.export.port 100% 0
domain.export.query 100% 0
domain.export.service 100% 0
domain.index 100% 0
domain.index.listener 0% 0
domain.index.model 74% 0
domain.index.service 100% 0
domain.ingest 100% 0
domain.ingest.event 100% 0
domain.ingest.listener 0% 0
domain.ingest.model 76% 0
domain.ingest.schedule 0% 0
domain.ingest.service 100% 0
domain.record 100% 0
domain.record.adapter 100% 0
domain.record.command 100% 0
domain.record.event 100% 0
domain.record.listener 0% 0
domain.record.model 100% 0
domain.record.port 100% 0
domain.record.query 100% 0
domain.record.service 100% 0
domain.schema 100% 0
domain.schema.adapter 100% 0
domain.schema.command 100% 0
domain.schema.event 100% 0
domain.schema.model 100% 0
domain.schema.port 100% 0
domain.schema.query 100% 0
domain.schema.service 100% 0
domain.search 100% 0
domain.search.adapter 100% 0
domain.search.command 100% 0
domain.search.event 100% 0
domain.search.model 100% 0
domain.search.port 100% 0
domain.search.query 100% 0
domain.search.service 100% 0
domain.shared 44% 0
domain.shared.model 90% 0
domain.shared.port 100% 0
domain.validation 0% 0
domain.validation.adapter 100% 0
domain.validation.command 0% 0
domain.validation.event 0% 0
domain.validation.listener 0% 0
domain.validation.model 0% 0
domain.validation.port 0% 0
domain.validation.query 100% 0
domain.validation.service 0% 0
infrastructure 100% 0
infrastructure.event 0% 0
infrastructure.index 0% 0
infrastructure.index.vector 52% 0
infrastructure.ingest 0% 0
infrastructure.messaging 100% 0
infrastructure.oci 0% 0
infrastructure.persistence 0% 0
infrastructure.persistence.adapter 0% 0
sdk 100% 0
sdk.index 100% 0
sdk.ingest 100% 0
util 100% 0
util.di 0% 0
Summary 28% (766 / 2756) 0

@rorybyrne

Copy link
Copy Markdown
Contributor Author

Closes #17

Add comprehensive CI pipeline with lint, typecheck, and test jobs
using uv for dependency management and pytest for testing with
coverage reporting on pull requests

Closes #17
fix: replace pyright with ty for type checking in lint command
chore: add pre-commit configuration with ruff, type checking, and tests
@rorybyrne rorybyrne force-pushed the 014-refactor-move-business branch from 4c7d97f to 667edb8 Compare January 4, 2026 00:34
@rorybyrne rorybyrne merged commit 013bee0 into main Jan 4, 2026
3 checks passed
@rorybyrne rorybyrne deleted the 014-refactor-move-business branch January 4, 2026 00:35
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.

refactor: move business logic from listeners into services

1 participant