feat(categories): categoryMappingService 4-pass algo (#119) #128
No reviewers
Labels
No labels
source:analyste
source:defenseur
source:human
source:medic
status:approved
status:blocked
status:in-progress
status:needs-fix
status:ready
status:review
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: maximus/Simpl-Resultat#128
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-119-category-mapping-service"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #119
Summary
Pure function
computeMigrationPlan(profileData): MigrationPlanthat computes a v2 → v1 category migration plan using a 4-pass algorithm.Algorithm
keywordsupplierdefaultreviewplan.preserved[].splits[]when Pass 3 triggers.Files
src/services/categoryMappingService.ts— service + types.src/services/categoryMappingService.test.ts— 20 unit tests (one per pass, custom, splits, stats, pass priority).Checklist
MigrationPlan,MappingRow,ConfidenceBadgemapping-old-to-new.mdnpx tsc --noEmitcleannpm testclean (168/168, +20 new)npm run buildcleanTest plan
Self-review — categoryMappingService
Note: Forgejo blocks formal self-approval; posting as a comment.
Security
normalizeForMatchmirrors the provennormalizeDescriptionincategorizationService. No ReDoS surface.Correctness
confidence: none, reason: review.Pass 1 wins over Pass 3 on split categories).plan.preserved[].Quality
MigrationPlan,MappingRow,ConfidenceBadge,MappingReason,ProfileData,V1Target.__resetMappingServiceCachesForTestsfollows the double-underscore convention.toV1Targetthrows loudly if DEFAULT_MAPPINGS drifts away fromcategoryTaxonomyV1.json— prevents silent corruption.Data integrity
.spikes/archived/seed-standard/code/mapping-old-to-new.md:Tests
npx tsc --noEmitclean;npm run buildclean.Scope compliance
Verdict: APPROVE