Skip to content

chore(JsonSchemaComparison): automate the weekly COUNTRY_CONTRACT_VERSIONS sync - #1344

Open
gabrielseco wants to merge 16 commits into
mainfrom
chore/sync-country-contract-versions
Open

gabrielseco wants to merge 16 commits into
mainfrom
chore/sync-country-contract-versions

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

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.ts counts each country's versions (snapshot files plus the current one), skips the countries the API rejects, and rewrites COUNTRY_CONTRACT_VERSIONS in schemaVersions.ts. Run it with pnpm run sync:contract-versions --be-repo-path=<path> [--write].
  • The same script builds a gap table for the PR body: latest available version per country against the version pinned in example/src/flows/Onboarding/jsonSchemaVersions.ts.
  • .github/workflows/sync-country-contract-versions.yml runs on Mondays and on demand. It sparse-checks-out only the schema folder with the read-only BE_REPO_GITLAB_READ_TOKEN secret and opens a PR only when the files changed. It skips with a warning when the secret is missing.
  • The same run updates the Remote platform and Up to date columns of the Version Matrix in docs/schema-changes/eor/contract-details/countries/README.md (logic in scripts/contract-versions-matrix.ts). France and Italy read their platform version from the backend's FRA_SAS and ITA_APL schemas, 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.
  • Removes promptTiger.txt, which the script replaces.
  • Not part of the public API.

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.ts and 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.

  • Tested against the example/ app in a browser
  • Feature flag: N/A

Note

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_VERSIONS with pnpm run sync:contract-versions, which counts contract_details schema versions from a backend repo checkout, rewrites schemaVersions.ts, refreshes the docs Version Matrix (Remote platform / Up to date only), and emits a gap report vs example/ onboarding pins.

A new weekly GitHub Actions workflow sparse-clones the BE schema folder (when BE_REPO_GITLAB_READ_TOKEN is set), runs the script with --write, and opens a PR via a GitHub App when files change; promptTiger.txt is 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.

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>
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 238.64 kB 238.63 kB +7 B (+0.0%) 🔴
Total (raw) 660.25 kB 660.09 kB +168 B (+0.0%) 🔴
CSS (gzip) 21.95 kB 21.95 kB 0 B (0%) 🟢
CSS (raw) 114.51 kB 114.51 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 238.64 kB / 350 kB (68.2%)
  • ✅ Total raw: 660.25 kB / 850 kB (77.7%)
  • ✅ CSS gzipped: 21.95 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. internals-cNMrmbaj.js - 6.14 kB (new)
  5. hooks-Dh7bK2m6.js - 5.76 kB (0 B (0%))
View All Files (305 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
internals-cNMrmbaj.js 6.14 kB new
hooks-Dh7bK2m6.js 5.76 kB 0 B (0%)
sdk.gen-D2VndjOJ.js 5.61 kB 0 B (0%)
index.js 5.58 kB 0 B (0%)
flows/Onboarding/hooks.js 4.67 kB 0 B (0%)
utils-Bc1UgCXy.js 4.26 kB 0 B (0%)
FieldSetField-CDST0PPa.js 4.11 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-opzlewy01-remotecom.vercel.app
Latest Commit:5ce6a64

Deployed with vercel-action

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-57f0c8fxj-remotecom.vercel.app
Latest Commit:5ce6a64

Deployed with vercel-action

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚠️ Coverage decreased

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

gabrielseco and others added 4 commits September 21, 2026 10:33
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>
@gabrielseco gabrielseco self-assigned this Sep 21, 2026
gabrielseco and others added 2 commits September 21, 2026 11:01
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>
gabrielseco added a commit that referenced this pull request Sep 23, 2026
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>
gabrielseco added a commit that referenced this pull request Sep 24, 2026
…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>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@gabrielseco gabrielseco changed the title chore(JsonSchemaComparison): automate COUNTRY_CONTRACT_VERSIONS sync from tiger + gap report chore(JsonSchemaComparison): automate the weekly COUNTRY_CONTRACT_VERSIONS sync Oct 30, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Triggered by project rule: Code Review Guidelines

Reviewed by Cursor Bugbot for commit 114cee2. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved: 4a36c03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant