Skip to content

Fix language runtime size measurement correctness (Issue #55)#56

Merged
konard merged 5 commits intomainfrom
issue-55-dc5914da7ab7
Feb 24, 2026
Merged

Fix language runtime size measurement correctness (Issue #55)#56
konard merged 5 commits intomainfrom
issue-55-dc5914da7ab7

Conversation

@konard
Copy link
Member

@konard konard commented Feb 23, 2026

Summary

Fixes #55 — checks correctness of language runtime size measurements and fixes multiple root causes of incorrect/zero values.

Root Causes Found & Fixed

1. Integer Division Truncation → Replaced with Float Precision (Primary Fix)

Before: diff_bytes / 1024 / 1024 — floor division truncated any component under 1 MiB to 0 MB
After: awk "BEGIN {printf \"%.2f\", $diff_bytes / 1000000}" — precise decimal values

Affected components: Essential Tools (741 KB shows as 0.74 MB), GitHub CLI (549 KB shows as 0.55 MB), and improved accuracy across all components (e.g. 504905728 bytes shows as 504.91 MB instead of 505).

2. Unreliable df Delta for Rust and Homebrew

Both rustup and Homebrew use mv/hardlink operations internally that don't change filesystem block counts during installation, causing near-zero df deltas (~96 KB for Rust, ~16 KB for Homebrew) despite actual sizes of 700+ MB and 200+ MB respectively.

Fix: Switched to du -sb measurement of the actual installed directories after installation (instead of df delta).

3. Missing Component

bubblewrap is installed in ubuntu/24.04/full-sandbox/install.sh but was not measured. Added measurement.

4. Data & README Updated

  • data/disk-space-measurements.json updated with corrected size_mb float values (e.g. 0.74 instead of 1)
  • README.md component sizes table updated with precise float values
  • Rust and Homebrew will show corrected sizes after next CI run (current JSON reflects old measurement data for those two)

Case Study

Full root cause analysis documented in docs/case-studies/issue-55/CASE-STUDY.md with timeline, evidence, and proposed solutions.

Changes

  • scripts/measure-disk-space.sh — Use awk-based float division for size_mb, update add_measurement to store float, add bubblewrap, use du-based measurement for Rust and Homebrew
  • data/disk-space-measurements.json — Corrected size_mb float values
  • README.md — Updated component sizes table with precise decimal values
  • docs/case-studies/issue-55/CASE-STUDY.md — New case study

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #55
@konard konard self-assigned this Feb 23, 2026
Root causes identified and fixed:
1. Integer division truncation: `diff_bytes / 1024 / 1024` truncated any
   component under 1 MiB to 0 MB. Fixed to use rounded MB division:
   `(diff_bytes + 500000) / 1000000`. Affected: Essential Tools (741 KB → 1 MB),
   GitHub CLI (549 KB → 1 MB), and improved accuracy across all components.

2. Unreliable df-delta for Rust and Homebrew: Both tools use mv/hardlink
   operations during installation that don't change df block counts. Fixed
   by switching to du-based measurement of installed directories (~/.rustup,
   ~/.cargo, /home/linuxbrew/.linuxbrew) after installation completes.

3. Missing component: Added 'bubblewrap' measurement (installed in full-sandbox
   but not previously measured).

4. Updated data/disk-space-measurements.json with corrected size_mb values
   using the new rounding formula applied to existing size_bytes data.

5. Updated README component sizes table with corrected values.

Adds docs/case-studies/issue-55/CASE-STUDY.md with full timeline, root cause
analysis, evidence, and proposed solutions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Check correctness of language runtimes sizes Fix language runtime size measurement correctness (Issue #55) Feb 23, 2026
@konard konard marked this pull request as ready for review February 23, 2026 00:15
konard and others added 2 commits February 23, 2026 00:15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Feb 23, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.855204
  • Calculated by Anthropic: $2.510274 USD
  • Difference: $-0.344930 (-12.08%)
    📎 Log file uploaded as Gist (2682KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Feb 23, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard
Copy link
Member Author

konard commented Feb 23, 2026

(diff_bytes + 500000) I think that is wrong, we need to have precise calculations, so we will get something like 0.72 MB for 741 KB (note that this is just an example, and calculation may be incorrect).

@konard konard marked this pull request as draft February 23, 2026 08:47
@konard
Copy link
Member Author

konard commented Feb 23, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-02-23T08:47:21.687Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

Replace integer rounding `(diff_bytes + 500000) / 1000000` with awk-based
floating-point division `awk "BEGIN {printf \"%.2f\", bytes / 1000000}"` to
produce precise decimal values instead of rounded integers.

- Essential Tools: 741376 bytes -> 0.74 MB (was 1 MB)
- GitHub CLI: 548864 bytes -> 0.55 MB (was 1 MB)
- .NET SDK: 504905728 bytes -> 504.91 MB (was 505 MB)

Also update add_measurement() to store size_mb as float in JSON (not int),
update finalize_json_output() to store total_size_mb as float, and
regenerate data/disk-space-measurements.json and README.md table with
precise decimal values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review February 23, 2026 09:31
@konard
Copy link
Member Author

konard commented Feb 23, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.135613
  • Calculated by Anthropic: $1.850424 USD
  • Difference: $-0.285189 (-13.35%)
    📎 Log file uploaded as Gist (2044KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Feb 23, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit them.

Uncommitted files:

?? SUMMARY.md
?? issue_comments.txt
?? issue_view.txt
?? pr_conversation_comments.txt
?? pr_diff.txt
?? pr_inline_comments.txt
?? pr_reviews.txt
?? pr_view.txt

Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Member Author

konard commented Feb 23, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.461826
  • Calculated by Anthropic: $0.280741 USD
  • Difference: $-0.181085 (-39.21%)
    📎 Log file uploaded as Gist (2659KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit f274bfa into main Feb 24, 2026
19 checks passed
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.

Check correctness of language runtimes sizes

1 participant