Cover the calculation engine with Vitest and gate deploys on it - #11
Merged
Merged
Conversation
The engine computes developed lengths people cut plate to, and had no automated tests. Add a Vitest suite whose reference values are derived by hand from the closed-form relations, not from the engine's output: - cylinder: neutral diameter from OD and from ID, the exact 2*pi*t ID/OD confusion, K-factor at the range limits, weld gap, bend lines - cone: sector radii and angle, gap on the neutral fibre, agreement with the cylinder in the near-cylindrical limit, blank rectangle - validation: non-positive and non-finite input, K outside (0, 1], gap vs. circumference, wall thicker than the neutral radius - the three tools/verify-*.ts scripts are ported to Vitest with the same checks and tolerances, and removed Tests now run on every pull request (ci.yml) and before the build in deploy.yml, so a failing test stops a release. Refs YurMil/cadautoscript.com#153 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b215c8916d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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
Shell Rolling was the only calculator in the catalog without tests, while its output is a length people cut plate to. This PR adds a Vitest suite for the calculation engine and makes it a gate on both pull requests and deploys.
Closes the code part of YurMil/cadautoscript.com#153; the validation cases are published on the site in a companion PR.
What is covered (87 tests)
math/cylinder.test.ts2πt, independent of K), K-factor limits, weld gap, bend linesmath/cone.test.tsmath/validation.test.ts(0, 1], gap vs. circumference, wall thicker than the neutral radius, mode-specific guardsmath/eccentric-cone.test.tstools/verify-eccentric-cone.tsutils/pattern-dimensions.test.tstools/verify-bend-dimensions.tsshareLink.test.tstools/verify-share-link.tsReference values are derived by hand from the closed-form relations in
docs/calculations.md, never copied from the engine's output. The threetools/verify-*.tsscripts keep their checks and tolerances and are removed together with theverify:*npm scripts.CI
ci.yml:npm ci→npm test→npm run buildon every pull request.deploy.yml:npm testruns between install and build, so a failing test stops the release before anything is published.A typecheck gate is intentionally not added:
tsccurrently reports three pre-existing errors inApp.tsxandScene.tsx, unrelated to this change.Behaviour documented, not changed
K = 0is rejected ("must be positive"),K = 1is accepted.Verification
npm ci,npm test(87 passed),npx eslinton the new files,npm run build— all pass locally.npm testexit with code 1.🤖 Generated with Claude Code