Enforce account-copy drift test in CI - #311
Merged
Merged
Conversation
Deploying nemar-website with
|
| 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 |
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.
Summary
The
account-copydrift test (test/account-copy-drift.test.ts) compares this repo'ssrc/lib/account-copy.tsagainst nemar-cli'sshared/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 oneconsole.infoand return, which vitest reports as a pass, so the CItestjob 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
testjob before the Vitest step, and changes the test's behavior around a newNEMAR_CLI_ACCOUNT_COPYenv 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 oldCONTRACT_CANDIDATESsearch, but an absent candidate is now a visibledescribe.skipIfskip instead of a silent pass, so the run summary shows a skipped test rather than nothing at all.stagingpairs with nemar-cli'sdevbranch andmainpairs with nemar-cli'smain, so the sparse checkout'srefis chosen fromgithub.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 nameNEMAR_WEBSITE_ACCOUNT_COPY.Important caveat
nemar-cli's
devbranch does not yet carryshared/contract/account-copy.ts— that lands with epicnemarOrg/nemar-cli#1250. Until that epic merges, this PR's CItestjob is expected to FAIL on the sparse checkout finding no such file (or on the file simply not existing at that path indev), because strict mode never skips on a missing file. Do not merge this PR until nemar-cli#1250 has reached nemar-cli'sdevbranch.Verification
Run locally in a worktree off
origin/staging(bun install --frozen-lockfilefirst):bun run lint— 264 files checked, no issues (lint scope issrconly; the changed test file was also checked manually withbunx biome check test/account-copy-drift.test.tsand is clean).bun run typecheck—astro 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).NEMAR_CLI_ACCOUNT_COPY=/nonexistent bun run test -- test/account-copy-drift.test.tsexits 1, with 1 failed / 9 passed and an error naming both the env var and the resolved path.NEMAR_CLI_ACCOUNT_COPY=<path to a real account-copy.ts contract> bun run test -- test/account-copy-drift.test.tsexits 0, with 10/10 passed and aconsole.infolisting contract-only keys (not a failure).CONTRACT_CANDIDATESentry temporarily pointed at a real contract file — exits 0, 10/10 passed.CONTRACT_CANDIDATESentries temporarily pointed at bogus paths — exits 0, 9 passed / 1 skipped, with theconsole.infoskip 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.tsor*.spec.ts.