Skip to content

fix: correct ResultTestEnum typo and migrate persisted data (issue #20) - #34

Merged
andresTabiTuwien merged 1 commit into
mainfrom
AT/issue-20-fix-the-ResultTestEnum-typo
Aug 28, 2026
Merged

andresTabiTuwien merged 1 commit into
mainfrom
AT/issue-20-fix-the-ResultTestEnum-typo

Conversation

@andresTabiTuwien

Copy link
Copy Markdown
Collaborator

Summary

Fixes the misspelled ResultTestEnum.INDERTERMINATED constant, adding the correctly-spelled INDETERMINATE and migrating existing MongoDB data so the fix is complete rather than just cosmetic.

Related Issue

Closes #20

Changes

  • Added INDETERMINATE to ResultTestEnum; marked INDERTERMINATED @Deprecated rather than deleting it, since Evaluation.result is persisted in MongoDB by enum name with no custom converter — removing the old constant
    outright would break reads of any existing document still storing that value
  • Removed NOT_APPLICABLE from the enum — confirmed zero usages anywhere in the codebase
  • Updated the 5 call sites that produced the misspelled value to use INDETERMINATE: FairChampionResponseUtils, QualityOfActionsEvaluator, ComplianceEvaluator, DCSCompletenessEvaluator
  • Added a one-time, idempotent Mongo migration (migrateIndeterminatedResultTypo) that rewrites any persisted evaluations document with result: "INDERTERMINATED" to "INDETERMINATE", wired into the existing
    PostConstruct patcher runner from issue Improve and unify logging #14 (runs automatically on every startup, no-op once nothing matches)

EvaluationService already does evaluation.result.name.lowercase() to build the FTR-compliant JSON-LD resultValue field, so this wasn't just an internal typo — any evaluation stored with the old spelling was being served
to API consumers as "indeterminated" instead of "indeterminate". The migration fixes that for existing data; the code changes prevent it from happening again.

Testing

  • Seeded a MongoDB document with result: "INDERTERMINATED", started the app, and confirmed the migration log line (Migrated 1 evaluation(s) from 'INDERTERMINATED' to 'INDETERMINATE') appears and the document is rewritten
  • Restarted the app again and confirmed the migration is idempotent — no log line on the second run since nothing matched
  • Confirmed no production code references the deprecated spelling anymore (only the enum declaration itself and the migration's own query string)

Checklist

  • I updated CHANGELOG.md under [Unreleased] if this is a user-facing change
  • CI checks (build, test) pass

Add correctly-spelled INDETERMINATE and mark the misspelled
INDERTERMINATED @deprecated rather than deleting it, since
Evaluation.result is persisted in MongoDB by enum name with no custom
converter -- removing the old constant outright would break reads of
any existing document still storing that value. Remove NOT_APPLICABLE,
confirmed unused anywhere in the codebase.

Add a one-time, idempotent Mongo migration (migrateIndeterminatedResultTypo)
that rewrites any persisted evaluation still storing "INDERTERMINATED" to
"INDETERMINATE", wired into the existing PostConstruct patcher runner.
This also fixes a public API leak: EvaluationService already lowercases
the enum name into the FTR JSON-LD resultValue field, so any affected
evaluation was being served to API consumers as "indeterminated".
@andresTabiTuwien
andresTabiTuwien merged commit faa74c5 into main Aug 28, 2026
1 check passed
@andresTabiTuwien
andresTabiTuwien deleted the AT/issue-20-fix-the-ResultTestEnum-typo branch August 28, 2026 08:36
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.

Fix ResultTestEnum

1 participant