Skip to content

Refactor: Split large files + segregate IFeatureStore interfaces #230

@mikemcdougall

Description

@mikemcdougall

Problem

Large files make changes hard to review and increase merge conflicts; IFeatureStore also mixes unrelated responsibilities (query, tiles, related records, edits), which drives dependency bloat and makes streaming adoption harder.

Evidence

  • Large files:
    • src/Honua.Postgres/Features/FeatureStore/PostgresFeatureStore.cs (3026 LOC)
    • src/Honua.Server/Features/FeatureServer/FeatureServerEndpoints.cs (1843 LOC)
    • src/Honua.Server/Features/OgcFeatures/FeaturesEndpoints.cs (1573 LOC)
    • src/Honua.Server/Features/FeatureServer/FeatureServerHandler.cs (1571 LOC)
    • src/Honua.Server/Features/FeatureServer/Models/FeatureServerModels.cs (1362 LOC)
  • Mixed responsibilities: src/Honua.Core/Features/FeatureStore/Abstractions/IFeatureStore.cs contains query, tile, related, and edit operations.

Direction

  • Split large files into cohesive units (by endpoint group, query/edit, DTOs, or feature store components).
  • Segregate IFeatureStore into smaller interfaces:
    • IFeatureReader / IFeatureWriter
    • IRelationshipStore
    • ITileProvider
    • IStreamingFeatureStore (already exists)
  • Update DI registrations and call sites to depend on the smallest interface needed.

Tasks

  • Split FeatureServerModels.cs into per‑model files.
  • Split FeatureServerEndpoints.cs and FeatureServerHandler.cs into cohesive endpoint/handler units.
  • Split OgcFeatures/FeaturesEndpoints.cs similarly.
  • Decompose PostgresFeatureStore.cs into smaller classes (data access, query, edit, tiles, relationships).
  • Introduce segregated interfaces and update implementations/usages.
  • Update tests and docs/ADR as needed; ensure architecture tests still pass.

Acceptance criteria

  • No files > ~800 LOC in the listed areas.
  • Handler/endpoint dependencies become explicit and cohesive.
  • Call sites depend on narrower interfaces rather than the full IFeatureStore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions