SVC Tenders Helper Residue Pass
Scope
Sprint 12 was a safe residue pass on services/svc-tenders/src/repository.ts after the earlier file splits for:
- ICPI
- Butkhuzi
- tender core
- auction core
- declaration/evidence
- output allocations isolation
- settlement bridge isolation
This pass did not make new ownership decisions. It removed only helper residue that was clearly dead or clearly superseded by child-owned repository modules.
VERIFIED residue categories found
1. Active root-owned helpers
These remain in services/svc-tenders/src/repository.ts because they still support live root-owned behavior:
- KES persistence helpers and mappers
- legacy vacancy compatibility mappers
- legacy accommodation compatibility mappers
- low-level normalization helpers still used by KES and legacy compatibility reads
Examples:
appendEventHashChain(...)mapKesOrchestratorPayment(...)decryptPaymentNote(...)toVacancySummary(...)toAccommodationSummary(...)toAccommodationDetail(...)normalizeOptionalUpper(...)normalizeOptionalText(...)normalizeRecord(...)parseOptionalNumber(...)toIsoDateOnly(...)
2. Compatibility wrappers needed for stability
These remain intentionally:
- public delegation methods on
TendersRepositorythat forward to child repositories - root-level wrapper surface preserved for existing route wiring and older call sites
Examples:
- tender wrappers delegating to
services/svc-tenders/src/tender/repository.ts - auction wrappers delegating to
services/svc-tenders/src/auction/repository.ts - declaration wrappers delegating to
services/svc-tenders/src/declaration/repository.ts - ICPI wrappers delegating to
services/svc-tenders/src/icpi/repository.ts - Butkhuzi wrappers delegating to
services/svc-tenders/src/butkhuzi/repository.ts
3. Duplicate helper/query logic now owned elsewhere
These were identified as safe to remove from the root repository because their live implementations already exist in child-owned modules:
- old tender insert/update/event helpers
- old auction public/internal list/count/detail SQL helpers
- old declaration event/upsert helpers
- old tender/auction/declaration row mappers and payload normalizers
- old auction/tender portal ranking helpers duplicated inside child repositories
The child-owned repositories already contain their own active copies:
services/svc-tenders/src/tender/repository.tsservices/svc-tenders/src/auction/repository.tsservices/svc-tenders/src/declaration/repository.ts
4. Dead code / dead imports / stale internal types
These were removed in Sprint 12:
- stale business-code generation helpers no longer used by the root repository
- dead internal row types for tender/auction/declaration/output-allocation blocks already moved out
- stale
PoolClientimport - stale tender declaration normalization imports
- dead auction/tender declaration payload normalization helpers
- dead bid/winner parsing helpers that were only used by removed auction mapping residue
5. Ambiguous helpers that remain for now
These were not touched beyond existing boundary comments because ownership is still unresolved or intentionally transitional:
- output allocation delegation
- settlement bridge delegation
- KES persistence block
- legacy vacancy compatibility residue
- legacy accommodation compatibility residue
What moved
No new runtime ownership moved in Sprint 12.
This sprint was a residue-removal pass, not a new extraction pass.
What changed instead:
- clearly dead private SQL/helper blocks were deleted from
services/svc-tenders/src/repository.ts - dead shared query-ranking helpers that were no longer used in the root file were deleted
- stale types/imports/constants supporting those dead blocks were deleted
What was deleted
Deleted from the root repository:
- dead tender create/update/event private helpers
- dead auction list/count/detail private helpers
- dead declaration upsert/event private helpers
- dead tender/auction/declaration mapping helpers
- dead output-allocation conversion residue already superseded by
services/svc-tenders/src/repository/outputAllocations.ts - dead auction portal ranking helpers after the auction repository split
- stale imports and internal row/type aliases tied to those deleted blocks
What remained and why
Remains by design
output_allocationsdelegation- reason: ownership still unresolved
- settlement bridge delegation
- reason: still cross-domain between auction settlement and tender entitlement state
- KES persistence
- reason: still best described as shared Kvary execution/backbone persistence hosted locally
- vacancy/accommodation legacy residue
- reason: compatibility support still exists for older mixed read paths
- public delegation wrappers
- reason: stability and existing route compatibility
Intentionally unresolved
Still unresolved after Sprint 12:
- final ownership of
output_allocations - final ownership of KES persistence
- whether legacy vacancy/accommodation compatibility residue should later move to explicit compatibility submodules or be retired after route-level call sites disappear
Sprint 12 result
services/svc-tenders/src/repository.ts is now a more truthful shell:
- less dead tender/auction/declaration residue
- fewer stale internal types/imports
- clearer concentration around:
- unresolved cross-domain logic
- KES/shared backbone persistence
- legacy compatibility residue
- public delegation surface