Skip to content

Build the two calculators that were never built, and test all three - #85

Merged
fosterwei merged 1 commit into
mainfrom
feat/calculators
Sep 30, 2026
Merged

fosterwei merged 1 commit into
mainfrom
feat/calculators

Conversation

@fosterwei

Copy link
Copy Markdown
Owner

Reported as "the calculator page is not working". Two of the three tool pages had no calculator on them at all.

Page Before After
Unit converter 58 words, 0 forms, 0 inputs working converter, 478 words
Vial planner 53 words, 0 forms, 0 inputs working planner, 396 words
Reconstitution calculator worked correctly gains syringe scale and two warnings

The reconstitution calculator did work and its arithmetic was correct. The other two rendered a name, a one-line "computes", a one-line "refuses", and stopped.

Nothing in the build could see this. A page with no form still builds, still validates, still passes the link check and still enters the sitemap.

What the two now do

Unit converter handles mg, mcg and ng as fixed ratios, and millilitres to units on U-100, U-50 or U-40. It explains at length why it will not convert international units: an IU is defined per substance by a reference preparation, so there is no general mass equivalent, and a converter that offers one has invented it. That refusal is the tool's stated purpose in the registry, so it is now argued rather than just asserted.

Vial planner reports whole draws (rounding down, because a partial draw is not a draw), the volume of each, how long a vial lasts at a stated frequency, and the remainder that cannot be drawn.

Reconstitution gains the syringe scale as an input instead of assuming U-100, and warns when a draw falls below the smallest graduation on the chosen barrel or exceeds a 1 mL syringe.

All three are wired by one script that picks whichever calculator is present. Astro hoists a component's script into every page that renders it, so three separate scripts would have loaded on all three pages and thrown on the missing elements.

A test that would have caught it

scripts/test_calculators.mjs runs in CI after the build. It extracts the inline module from each built page, runs it against a stub DOM, and asserts on what lands in the output element. It fails when a page has no <form> or no <output>, which is the exact defect that shipped here. 17 assertions.

Writing those tests found an error in my own prose. The worked example said 0.1 mL is "20 units on a U-40 syringe". It is 4. The code was right and the sentence under it was wrong, which is the more dangerous way round, and it is now covered by a test.

They are indexable for the first time

The three tools now have records, so they leave noindex and enter the sitemap. This matters more than the page count suggests:

Query Clickstream KD
peptide calculator 114,884 6
peptide dosage calculator 7,530 4
peptide reconstitution calculator 7,479 4
reconstitution calculator 2,798 0

Roughly 130,000 monthly searches at difficulty 0 to 6, which the site was answering with three noindex pages, two of them empty. The directory page is rewritten and indexable too, and titles now name what people actually search for.

Also fixed: CI built with SITE_URL on the apex host, which 308-redirects to www.

Gates

Content validation (59 records), registry check, 36 drafter tests, 17 calculator tests, loop gate 47/47, all five link rules.

🤖 Generated with Claude Code

Reported as "the calculator page is not working". Two of the three tool
pages had no calculator on them at all: the unit converter and the vial
planner rendered a name, a one-line "computes" and a one-line "refuses",
and stopped. 58 words and 53 words, no form, no input, no output
element. The reconstitution calculator did work, and its arithmetic was
correct.

Nothing in the build could see this. A page with no form still builds,
still validates, still passes the link check and still enters the
sitemap.

Both are now implemented. The unit converter does mg, mcg and ng as
fixed ratios and millilitres to units on a U-100, U-50 or U-40 scale,
and explains at length why it will not convert international units: an
IU is defined per substance by a reference preparation, so there is no
general mass equivalent and a converter offering one has invented it.
The vial planner reports whole draws, rounding down because a partial
draw is not a draw, the volume of each, how long a vial lasts at a
stated frequency, and the remainder that cannot be drawn.

The reconstitution calculator gains the syringe scale as an input
instead of assuming U-100, and warns when a draw falls below the
smallest graduation on the chosen barrel or exceeds a 1 mL syringe.

All three scripts are one script that wires up whichever calculator is
on the page. Astro hoists a component's script into every page that
renders it, so three separate scripts would have loaded on all three
pages and thrown on the missing elements.

scripts/test_calculators.mjs runs in CI after the build. It extracts the
inline module from each built page and runs it against a stub DOM, and
it fails when a page has no form or no output element, which is the
specific defect that shipped here. 17 assertions.

Writing those tests found an error in my own prose: the worked example
said 0.1 mL is 20 units on a U-40 syringe. It is 4. The code was right
and the sentence under it was wrong, which is the more dangerous way
round.

The three tools now have records, so they are indexable for the first
time and enter the sitemap. This matters more than it looks: "peptide
calculator" measures 114,884 clickstream searches at KD 6 and
"peptide reconstitution calculator" 7,479 at KD 4, and the site was
answering none of it. The directory page is rewritten and indexable too.

CI also had SITE_URL on the apex host, which 308-redirects to www.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
research-reference Ready Ready Preview Sep 30, 2026 6:25am UTC

@fosterwei
fosterwei merged commit 6732282 into main Sep 30, 2026
5 checks passed
@fosterwei
fosterwei deleted the feat/calculators branch September 30, 2026 06:27

This branch was successfully deployed

1 active deployment
Preview — bd9e5299 Deployed Sep 30, 2026 by vercel[bot]
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