Skip to content

Enforce account-copy drift test in CI - #311

Merged
neuromechanist merged 3 commits into
stagingfrom
feature/drift-test-ci-checkout
Sep 7, 2026
Merged

Enforce account-copy drift test in CI#311
neuromechanist merged 3 commits into
stagingfrom
feature/drift-test-ci-checkout

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

The account-copy drift test (test/account-copy-drift.test.ts) compares this repo's src/lib/account-copy.ts against nemar-cli's shared/contract/account-copy.ts, but CI clones only this repo, so the sibling checkout it searches for (CONTRACT_CANDIDATES) never exists in CI. Absence used to log one console.info and return, which vitest reports as a pass, so the CI test job enforced no parity at all between the two repos' account copy.

This PR adds a sparse checkout of nemar-cli's contract file to the test job before the Vitest step, and changes the test's behavior around a new NEMAR_CLI_ACCOUNT_COPY env var: when it is set (as CI now sets it), that path is authoritative and a missing file there is a hard test failure, not a skip. When it is unset (a maintainer's machine, most likely), the test falls back to the old CONTRACT_CANDIDATES search, but an absent candidate is now a visible describe.skipIf skip instead of a silent pass, so the run summary shows a skipped test rather than nothing at all.

staging pairs with nemar-cli's dev branch and main pairs with nemar-cli's main, so the sparse checkout's ref is chosen from github.base_ref/github.ref_name. nemar-cli is getting the mirror-image change in its own CI at the same time, using the corresponding env var name NEMAR_WEBSITE_ACCOUNT_COPY.

Important caveat

nemar-cli's dev branch does not yet carry shared/contract/account-copy.ts — that lands with epic nemarOrg/nemar-cli#1250. Until that epic merges, this PR's CI test job is expected to FAIL on the sparse checkout finding no such file (or on the file simply not existing at that path in dev), because strict mode never skips on a missing file. Do not merge this PR until nemar-cli#1250 has reached nemar-cli's dev branch.

Verification

Run locally in a worktree off origin/staging (bun install --frozen-lockfile first):

  • bun run lint — 264 files checked, no issues (lint scope is src only; the changed test file was also checked manually with bunx biome check test/account-copy-drift.test.ts and is clean).
  • bun run typecheckastro check, 282 files, 0 errors, 0 warnings, 5 pre-existing hints unrelated to this change.
  • bun run test — 84 test files, 2023 passed, 1 skipped (the drift test itself, since no sibling nemar-cli checkout with the contract file exists on this machine yet).
  • Strict-mode failure proof: NEMAR_CLI_ACCOUNT_COPY=/nonexistent bun run test -- test/account-copy-drift.test.ts exits 1, with 1 failed / 9 passed and an error naming both the env var and the resolved path.
  • Strict-mode pass proof: NEMAR_CLI_ACCOUNT_COPY=<path to a real account-copy.ts contract> bun run test -- test/account-copy-drift.test.ts exits 0, with 10/10 passed and a console.info listing contract-only keys (not a failure).
  • Soft-mode pass proof: env var unset with a CONTRACT_CANDIDATES entry temporarily pointed at a real contract file — exits 0, 10/10 passed.
  • Soft-mode skip proof: env var unset with both CONTRACT_CANDIDATES entries temporarily pointed at bogus paths — exits 0, 9 passed / 1 skipped, with the console.info skip message logged and the run summary showing the skip explicitly rather than a silent pass. All temporary edits used for these last two proofs were reverted before committing.

Also confirmed nemar-cli-contract/ (the sparse-checkout destination, now in .gitignore) cannot be picked up by vitest's default test include pattern, since the checked-out file is not named *.test.ts or *.spec.ts.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 6, 2026

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: b2fe69c
Status: ✅  Deploy successful!
Preview URL: https://d65fab5a.nemar-website.pages.dev
Branch Preview URL: https://feature-drift-test-ci-checko.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit 7c30e14 into staging Sep 7, 2026
5 checks passed
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