fix(kyc): declare financial question conditions in the API contract - #4541
Open
joshuakrueger-dfx wants to merge 1 commit into
Open
fix(kyc): declare financial question conditions in the API contract#4541joshuakrueger-dfx wants to merge 1 commit into
joshuakrueger-dfx wants to merge 1 commit into
Conversation
getQuestions has returned conditions since #2071, but KycFinancialQuestion never declared the field. Generated clients therefore do not know about it and cannot evaluate which questions still apply to a given set of answers before submitting the questionnaire. Runtime behaviour is unchanged. The added spec pins the mapping so that the declaration and what the endpoint actually sends cannot drift apart.
joshuakrueger-dfx
requested review from
TaprootFreak and
davidleomay
as code owners
July 31, 2026 13:23
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
GET /kyc/data/financial/:idreturns the questionnaire. Each question can carryconditions, whichsay under what earlier answer the question applies at all —
FinancialService.getQuestionshasmapped the field through since #2071 (2025-04):
KycFinancialQuestionnever declared it. The field is therefore invisible in the Swagger contractand absent from generated clients, so a consumer cannot reproduce which questions are still
outstanding for a given set of answers — it has to submit and find out from the result. That is the
wrong way round: the same completeness logic the backend runs in
FinancialService.isCompletedepends entirely on
conditions.What changed
KycFinancialCondition(question,response) added, matching the shape infinancial-questions.ts.conditions?: KycFinancialCondition[]declared onKycFinancialQuestionas@ApiPropertyOptionalwithisArray, so questions without preconditions keep omitting it.No runtime change. This PR only writes down what the endpoint already sends.
Tests
One new spec, checked in both directions against the production mapping it pins:
conditions: q.conditionsremoved fromgetQuestionsconditions: q.conditions→conditions: []financial.service.tswas restored after each probe and verified clean (git diffempty), so theprobes did not leave the mapping altered.
Full gate on the exact revision
1cbf51e5e:lint(empty output),format:check,type-checkand
buildall exit 0;Test Suites: 340 passed, 340 of 347 total,Tests: 6206 passed, 174 skipped, 6380 total; coverage gate exit 0.The spec derives its expectations from
getFinancialQuestionsinstead of naming questions, so itbreaks when the mapping breaks, not when a question is renamed. It asserts up front that the catalog
contains both questions with and without conditions, so it cannot pass vacuously if that ever stops
being true.
Scope
Only
kyc-financial-out.dto.tsand its spec.financial.service.tsis untouched — the mapping wasalready correct.