Skip to content

Add drift check for savings-fund onboarding documents#1555

Closed
stenehrlich-tuleva wants to merge 1 commit into
masterfrom
tkf-document-drift-test
Closed

Add drift check for savings-fund onboarding documents#1555
stenehrlich-tuleva wants to merge 1 commit into
masterfrom
tkf-document-drift-test

Conversation

@stenehrlich-tuleva

@stenehrlich-tuleva stenehrlich-tuleva commented May 25, 2026

Copy link
Copy Markdown
Contributor

What

The Täiendav Kogumisfond onboarding signing step links to the fund's legal documents (terms, prospectus, key information). Those URLs were hardcoded and duplicated across both the individual and company onboarding flows, so they silently go stale whenever the documents are re-issued (they currently point at the 12.01.2026 versions, which have since been superseded).

This PR:

  • Consolidates the three duplicated document arrays into a single SAVINGS_FUND_DOCUMENTS constant (used by both flows and the test).
  • Adds a check (savingsFundDocumentsCheck.ts) that compares the shipped URLs against the documents currently published on the public fund page, read straight from its ACF fields (terms_file / prospectus_file / key_investor_info_file). publishedDocumentsFromAcf fails closed if a field is missing or empty.
  • Adds a gated live comparison test (savingsFundDocumentsCheck.live.test.ts) that runs only when CHECK_PUBLISHED_DOCUMENTS=true, so it can run on a schedule without flaking normal CI.

Note

The shipped URLs are intentionally still the stale versions in this PR — this lands the safety net first. They're brought current via the content-update workflow (separate step), which turns the live check green.

Depends on

Test plan

  • savingsFundDocumentsCheck.test.ts unit tests (extraction, fail-closed, shipped mapping) — green.
  • Full suite green in CI (build / test).
  • Live check runs on demand: CHECK_PUBLISHED_DOCUMENTS=true TZ=UTC npx react-scripts test --testPathPattern=savingsFundDocumentsCheck.live (meaningful once the wordpress-theme change is deployed).

Refs TulevaEE/TKF-VPII2026#63

🤖 Generated with Claude Code

The TKF onboarding signing step links to the fund's legal documents
(terms, prospectus, key information). Those URLs were hardcoded and
duplicated across both the individual and company onboarding flows, so
they silently go stale whenever the documents are re-issued.

Consolidate the three duplicated arrays into a single
SAVINGS_FUND_DOCUMENTS constant, and add a check that compares the
shipped URLs against the documents currently published on the public
fund page via its ACF fields (terms_file / prospectus_file /
key_investor_info_file). publishedDocumentsFromAcf fails closed if a
field is missing or empty. The live comparison is a gated test
(CHECK_PUBLISHED_DOCUMENTS=true) so it can run on a schedule without
flaking normal CI.

The shipped URLs are intentionally still the stale versions here; they
are brought current via the content-update workflow, which turns the
live check green.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.93%. Comparing base (51124e0) to head (7db131f).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...SavingsFundOnboarding/savingsFundDocumentsCheck.ts 76.47% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1555      +/-   ##
==========================================
- Coverage   81.96%   81.93%   -0.03%     
==========================================
  Files         317      319       +2     
  Lines        6570     6605      +35     
  Branches     1437     1443       +6     
==========================================
+ Hits         5385     5412      +27     
- Misses        797      804       +7     
- Partials      388      389       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stenehrlich-tuleva

Copy link
Copy Markdown
Contributor Author

Closing this drift-check approach. For now the stale links are fixed by the interim PR #1558 (bumps both onboarding flows to the in-force Feb 2026 documents), and the broader WordPress-backed solution is parked on branch tkf-onboarding-document-links pending CTO review — tracked in TulevaEE/TKF-VPII2026#63. Leaving the tkf-document-drift-test branch in place.

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.

1 participant