Skip to content

docs: fix the README "Result Object Shape" example to match real engine output#27

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-t0lr81
Open

docs: fix the README "Result Object Shape" example to match real engine output#27
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-t0lr81

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Problem

The "Result Object Shape" example in README.md (the npm landing page for this package) is fabricated, internally inconsistent, and missing real fields. For a calculator whose entire value proposition is the numbers it produces, a self-contradictory sample output on the front page is a credibility problem.

The example is implicitly the canonical default input — storage_gb: 70 only occurs for 1000 hosts / medium / weekly / hailbytes_asm / 8h window — yet almost none of the documented numbers match what calculate() actually returns for that input:

Field README (old) Real output
cpu_cores 8 6
ram_gb 16 11
ram_recommended 24 17
network_bandwidth_mbps 14 10
optimized_scan_time_minutes 19 250
parallel_hosts 800 600
scan_window_utilization 3.9 52.1
infrastructure_monthly_aws 374 194
infrastructure_monthly_azure 352 184
total_monthly_aws 824 644
total_monthly_azure 802 634
roi.self_managed_monthly 824 644
roi.monthly_savings 525 345
roi.annual_savings 6300 4140
roi.roi_percentage 176.3 115.4

The old numbers don't even agree with each other: parallel_hosts: 800 implies cpu_cores: 8 (consistent), but then optimized_scan_time_minutes should be ceil(1500 / (800/100)) = 188, not the documented 19. And scan_window_utilization: 3.9% is impossible alongside those values for any 1–24h window.

The example also omitted real fields that the engine and index.d.ts define: vm_resources.scaling_info, roi_analysis.self_managed_annual, roi_analysis.managed_annual, and roi_analysis.setup_cost.

Fix

  • Replace the example with the verified output of calculate() for the input it already implied, and state that input explicitly above the block.
  • Include the previously-missing fields so the documented shape matches the actual runtime/index.d.ts shape.
  • Add a regression test (test/calculate.test.mjsdescribe('Documentation')) that asserts the documented numbers stay in sync with calculate(), so the example can't silently drift again.

Verification

All numbers were produced by running calculate() against the documented input. npm test passes (66 tests, +1 new).

This is independent of the other open PRs/issues, which focus on calculate() input handling, the time_pressure type, DOM-free import, the test glob, CDN pinning, a11y, and traditional storage sizing — none touch the README result example.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GszLaxg5to1DvSn8cvFiBD


Generated by Claude Code

… output

The documented sample result was fabricated and internally inconsistent
(e.g. parallel_hosts: 800 implies 8 CPU cores, yet optimized_scan_time:
19 != ceil(1500/8), and none of the cost/ROI figures matched the engine).
It also omitted real fields: scaling_info, self_managed_annual,
managed_annual and setup_cost.

Replace it with the verified output for the input the example already
implied (1000 hosts / medium / weekly / hailbytes_asm, 8h window) and
state that input explicitly. Add a regression test that asserts the
documented numbers stay in sync with calculate(), so the example can't
drift again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GszLaxg5to1DvSn8cvFiBD
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.

2 participants