Repository navigation
chore(JsonSchemaComparison): automate the weekly COUNTRY_CONTRACT_VERSIONS sync - #1344
gabrielseco wants to merge 16 commits into
Conversation
Adds scripts/sync-country-contract-versions.ts, which replaces the manual 'run promptTiger.txt against an LLM in tiger, paste the result back' step. Counting versions is fully mechanical (snapshot file count + 1 for the current version), so it's now a deterministic script instead of an AI prompt, and it also prints a per-country gap report against example/src/flows/Onboarding/constants.ts. Regenerated COUNTRY_CONTRACT_VERSIONS against the current tiger checkout; most countries picked up one new version from the extreme-salary- acknowledgement rollout that landed across many countries this week. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (305 total)
✅ Bundle size check passed |
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
📊 Coverage Report
|
| Metric | Current | Previous | Change | Status |
|---|---|---|---|---|
| Lines | 89.98% | 90.02% | -0.03% | 🔴 |
| Statements | 89.86% | 89.89% | -0.03% | 🔴 |
| Functions | 88.84% | 88.84% | 0% | ⚪ |
| Branches | 81.48% | 81.52% | -0.05% | 🔴 |
Detailed Breakdown
Lines Coverage
- Covered: 5615 / 6240
- Coverage: 89.98%
- Change: -0.03% (-2 lines)
Statements Coverage
- Covered: 5682 / 6323
- Coverage: 89.86%
- Change: -0.03% (-2 statements)
Functions Coverage
- Covered: 1481 / 1667
- Coverage: 88.84%
- Change: 0% (0 functions)
Branches Coverage
- Covered: 3453 / 4238
- Coverage: 81.48%
- Change: -0.05% (-2 branches)
✅ Coverage check passed
Adds a weekly GitHub Actions workflow that sparse-checks-out tiger's contract_details schemas via a GitLab read-only token, runs scripts/sync-country-contract-versions.ts --write, and opens a PR (peter-evans/create-pull-request) with the gap report as the PR body when there's drift. Requires the TIGER_GITLAB_READ_TOKEN repo secret; the job warns and skips (not fails) if it's unset. Also adds --report-file to the script for a markdown gap table, used as the PR body. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three-letter codes aren't readable at a glance. Adds scripts/country-names.ts (alpha3 -> common English name, sourced from tiger's vendored ISO-3166 dataset in apps/tiger/deps/countries, with a few overly formal ISO short names swapped for common usage, plus Remote-specific pseudo-codes FRA_SAS/ITA_APL and Kosovo/XKX which aren't in ISO 3166 proper). Falls back to the bare code for anything not in the table, e.g. if tiger adds a new country. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Header comments across the repo's data/constants files are 1-2 line factual notes (see schemaVersions.ts itself), not JSDoc paragraphs. Trimmed country-names.ts and sync-country-contract-versions.ts's headers to match; rationale that isn't needed to use the file stays in the PR description instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…Tiger.txt - Renamed --tiger-path -> --be-repo-path, TIGER_GITLAB_READ_TOKEN -> BE_REPO_GITLAB_READ_TOKEN, and comment/log wording from 'tiger' to 'the BE repo' throughout the sync script and its workflow. Kept concrete tiger references only where they're unavoidable (the actual GitLab clone URL, the apps/tiger/... subpath inside that repo, and one clarifying mention in the script's header comment). - schemaVersions.ts's header comment is also no longer AI-generated (it's mechanically generated by the script now), so it reads 'Generated from the BE repo' instead of 'AI generated from tiger'. Widened the regex that rewrites this header so it matches on structure, not the exact old wording. - Deleted src/components/JsonSchemaComparison/promptTiger.txt: the manual LLM-prompt step it documented is fully replaced by scripts/sync-country-contract-versions.ts. NOTE: needs a new BE_REPO_GITLAB_READ_TOKEN repo secret with the same GitLab token value as the now-unused TIGER_GITLAB_READ_TOKEN (which can be deleted once this is confirmed working). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Prose comments and docstrings no longer name tiger explicitly (usage example, error message, country-names.ts header/JSDoc, workflow comment). Left the literal occurrences that are actual code, not naming choices: the default --be-repo-path fallback, the real apps/tiger/... subpath inside that repo, and the real GitLab clone URL — none of those can be genericized without being wrong. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Previously the gap report only ever lived in /tmp, written out to fill in the weekly sync PR's body and then discarded. Commit it instead as scripts/reports/country-contract-version-gap.json, updated by --write on every run (manual or weekly CI), so it's a durable, structured record an agent or script can read later -- e.g. to correlate the gap against which countries matter most to partners. Includes every country the BE repo has contract_details schemas for (not just ones behind), each with country/countryName/ inUseVersion/latestVersion/gap, so any country can be looked up even when it's already at parity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per PR #1344's gap report, countries absent from jsonSchemaVersionByCountry silently fall back to contract_details v1. Add every country from COUNTRY_CONTRACT_VERSIONS explicitly (67 new entries at v1, matching current behavior), so the map is exhaustive and the v1 pin is visible instead of implicit. FRA_SAS and ITA_APL are excluded — they're BE-internal contract sub-variants of FRA and ITA, not onboarding country codes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n file (#1386) * chore(example): extract onboarding json-schema versioning into its own file jsonSchemaVersion / jsonSchemaVersionByCountry were inlined in Onboarding's constants.ts. Splitting them into jsonSchemaVersions.ts makes the versioning config importable from other example flows without pulling in the rest of the Onboarding options (jsfModify, features, etc). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * chore(example): pin all onboarding countries explicitly, incl. v1 Per PR #1344's gap report, countries absent from jsonSchemaVersionByCountry silently fall back to contract_details v1. Add every country from COUNTRY_CONTRACT_VERSIONS explicitly (67 new entries at v1, matching current behavior), so the map is exhaustive and the v1 pin is visible instead of implicit. FRA_SAS and ITA_APL are excluded — they're BE-internal contract sub-variants of FRA and ITA, not onboarding country codes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…ntract-versions # Conflicts: # package.json
…nned-versions file
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 114cee2. Configure here.
| body-path: /tmp/gap-report.md | ||
| add-paths: | | ||
| src/components/JsonSchemaComparison/schemaVersions.ts | ||
| scripts/reports/country-contract-version-gap.json |
There was a problem hiding this comment.
Auto PRs skip required CI checks
Medium Severity
The sync job opens PRs with the default GITHUB_TOKEN. GitHub does not fire pull_request workflows for that token, so lint, type-check, and tests never run on the weekly update. The canary workflow already mints a GitHub App token for the same create-pull-request action to avoid this. If branch protection requires those checks, the sync PR cannot be merged.
Triggered by project rule: Code Review Guidelines
Reviewed by Cursor Bugbot for commit 114cee2. Configure here.


Summary
The schema comparison tool's list of contract_details versions per country is now refreshed automatically every week, instead of by hand.
Why
The list was regenerated manually by running a prompt through an LLM against the backend repo and pasting the result. Counting versions is mechanical, so a script does it faster and without drift. A weekly PR keeps the version picker from falling behind (it was one version short for KOR and MUS in #1689).
What changed
Toggle details
scripts/sync-country-contract-versions.tscounts each country's versions (snapshot files plus the current one), skips the countries the API rejects, and rewritesCOUNTRY_CONTRACT_VERSIONSinschemaVersions.ts. Run it withpnpm run sync:contract-versions --be-repo-path=<path> [--write].example/src/flows/Onboarding/jsonSchemaVersions.ts..github/workflows/sync-country-contract-versions.ymlruns on Mondays and on demand. It sparse-checks-out only the schema folder with the read-onlyBE_REPO_GITLAB_READ_TOKENsecret and opens a PR only when the files changed. It skips with a warning when the secret is missing.docs/schema-changes/eor/contract-details/countries/README.md(logic inscripts/contract-versions-matrix.ts). France and Italy read their platform version from the backend'sFRA_SASandITA_APLschemas, and France's Up to date keeps its documented exception. A row it can't read is left alone with a warning. The pinned Contract Details versions and Last Updated never move here.promptTiger.txt, which the script replaces.Screenshots
N/A
Related Resources
N/A
Testing
Unit tests cover the matrix update (platform bump, Yes/No flip, skipped countries, unreadable rows); with the Yes/No comparison removed, the flip test fails. Ran the script locally against a backend checkout: it regenerated
schemaVersions.tsand the gap report. The workflow can only be dispatched once it is on the default branch, so the first real run is a manual dispatch after merge.example/app in a browserNote
Low Risk
Changes are tooling, CI, and generated version metadata for the schema comparison UI—not runtime auth or payment logic.
Overview
Replaces the manual LLM + paste workflow for
COUNTRY_CONTRACT_VERSIONSwithpnpm run sync:contract-versions, which counts contract_details schema versions from a backend repo checkout, rewritesschemaVersions.ts, refreshes the docs Version Matrix (Remote platform / Up to date only), and emits a gap report vsexample/onboarding pins.A new weekly GitHub Actions workflow sparse-clones the BE schema folder (when
BE_REPO_GITLAB_READ_TOKENis set), runs the script with--write, and opens a PR via a GitHub App when files change;promptTiger.txtis removed.This run bumps several countries’ available versions (e.g. ALB v5, ARE v7) and marks more matrix rows Up to date: No where
example/pins lag the platform.Reviewed by Cursor Bugbot for commit 5ce6a64. Bugbot is set up for automated code reviews on this repo. Configure here.