test(randomization-engine): add property tests for block invariants - #384
Conversation
…nd ratio invariants Added `fast-check` as a devDependency and implemented a property test in `randomization-algorithm.spec.ts` that asserts the validity of the output sequence length when given an arbitrary valid configuration where all generated block sizes are guaranteed multiples of the total arm ratio. This ensures the engine handles a large amount of generated combinations without throwing unforeseen errors. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
equipose | 5d2e1fd | Commit Preview URL Branch Preview URL |
May 26 2026, 09:46 PM |
…rift The GitHub CI pipeline uses `npm ci`, which strictly validates that `package.json` is perfectly in sync with `package-lock.json`. The addition of `fast-check` using `pnpm` created an inconsistent state in the `npm` lockfile, causing `npm ci` to abort. This commit regenerates the lockfile with `npm install` and commits it to align with `package.json`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit successfully ensures the lockfile is committed and correctly in sync with package.json, which uses `npm ci` strictly inside GitHub Actions. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
@copilot The failing job is the - name: Run Unit Tests
run: npm test -- --watch=falseThe actual failure is a TypeScript compile error during
From the log: return fc.record({and the inferred shape is: {
blockSizes: number[];
stratumCaps: { levels: never[]; cap: number }[];
subjectIdMask: "[SiteID]-[001]";
}SolutionUpdate the test helper/arbitrary at the failing line so it produces a value that matches the current Recommended fixIf the code currently looks like this pattern: return fc.record({
blockSizes: fc.constant([4, 6]),
stratumCaps: fc.constant([{ levels: [], cap: 100 }]),
subjectIdMask: fc.constant('[SiteID]-[001]'),
}) as fc.Arbitrary<RandomizationConfig>;change it to one of these safer options. Option 1: Make the record fully match
|
Co-authored-by: fderuiter <127706008+fderuiter@users.noreply.github.com>
Fixed in commit Three changes were made to
The |
|
@copilot resolve the merge conflicts in this pull request |
Adds
fast-checkand property-based tests to ensure invariants (e.g. sum of ratios dividing block size) produce successful evaluations and generate correct length of values without throwing errors.PR created automatically by Jules for task 16466002334857263570 started by @fderuiter