Repository navigation
Embed each compound's calculator on its record, and link both ways - #92
Merged
Merged
Conversation
Every compound that has a calculator page now carries the calculator on its own record too, directly under the dosage chart, with a link to the full page and a card in Related records. The calculator page already linked back, so the pair is now joined in both directions and neither is an orphan. Placement is deliberate. The outline on all 19 qualifying records puts the calculator immediately after "dosage chart: studies versus what circulates", so a reader who has just seen which figures were studied and which merely circulate is one scroll from working out what a vial yields, rather than finding the tool in a different section. The block renders only for a record that qualifies for a calculator page, by the same rule that decides whether that page exists: finished, reviewed, and carrying at least two distinct published dose figures. Fifteen compounds get neither, which is the point. Calculators.astro gains id, heading and headingLevel props so the one component can sit inside a compound page under that page's own H2 with its tool heading demoted to H3, instead of producing two H2s or a copy of the markup. The arithmetic still has exactly one implementation and one test suite. The tests now check every compound that has a calculator page: a link to it, a calculator section, an output element, and the embedded script computing the known case. 55 assertions, up from 36. Verified by removing the link, cutting the section, and breaking the script on a built page; each exits 1. The first attempt at the section cut used a regex that never matched, so that fault was not exercised until the cut was done by index. Worth recording because a test that passed only because the injection failed would have looked identical to a test that works. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch was successfully deployed
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.
Every compound that has a calculator page now carries the calculator on its own record, with a link to the full page and a card in Related records. The calculator page already linked back, so the pair is joined in both directions.
Where it sits
Directly under "dosage chart: studies versus what circulates" on all 19 qualifying records. A reader who has just seen which figures were studied and which merely circulate is one scroll from working out what a vial yields.
The block renders only for a record that qualifies for a calculator page, by the same rule that decides whether that page exists. Fifteen compounds get neither.
One component, not two copies
Calculators.astrogainsid,headingandheadingLevelprops so the same component sits inside a compound page under that page's H2 with its tool heading demoted to H3. No duplicate H2, no second copy of the markup, and the arithmetic keeps exactly one implementation and one test suite.Tests
Now cover every compound that has a calculator page: the link, the section, the output element, and the embedded script computing the known case. 55 assertions, up from 36.
Worth recording: my first attempt at the section-cut fault used a regex that never matched, so the test passed because the injection had failed, not because the test worked. Redone by index. A test that passes for the wrong reason looks identical to one that works.
Gates
Content validation (59 records), registry check, 36 drafter tests, 55 calculator tests, loop gate 47/47, all eight link rules including no duplicate H2.
🤖 Generated with Claude Code