Skip to content

fix: normalize semaphore capacity as decimal - #44

Merged
flyingrobots merged 3 commits into
mainfrom
fix/decimal-capacity
Oct 2, 2026
Merged

flyingrobots merged 3 commits into
mainfrom
fix/decimal-capacity

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

sem create gpu --capacity 01 previously succeeded while emitting invalid JSON ("capacity":01). Capacity is now normalized as a positive decimal before storage, comparison, and serialization, with bounds of 1 through 9223372036854775807. Reads accept leading-zero metadata from older versions without rewriting it; malformed or out-of-range stored capacity fails with store-read.

Fixes #35.

Validation on published commit 5236944ef836cd50493c9d3042b126dd03bc7884:

  • Observed RED against the original executable: JSON parsing failed on leading-zero capacity before implementation.
  • Normal pre-push gate: 470 base/regression assertions and 760 focused checks passed. The focused corpus uses seed 3507, 39 valid inputs, 31 invalid inputs, canonical storage checks, legacy metadata, unchanged refs after invalid input, and schema checks across lifecycle outputs.
  • Stress: 12 concurrent contenders for capacity 03 produced exactly three winners; final slot state and doctor were checked.
  • Normal pre-commit lint and published GitHub lint-and-test passed.

Earlier full runs encountered host-disk exhaustion and are excluded from validation. The unchanged commit passed its complete gate after space recovered. General stored-record validation remains in #33; partial multi-ref observation remains a separate correctness investigation in #38. This change does not claim a proof over all concurrency schedules.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 578b0302-f27c-4776-8579-bb5e0f7d0ac7

📥 Commits

Reviewing files that changed from the base of the PR and between 2ef6948 and 36e7e0d.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • Makefile
  • README.md
  • bin/git-locks
  • lib/170-semaphores.sh
  • test/capacity.py
  • test/test.sh
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@flyingrobots
flyingrobots marked this pull request as ready for review September 22, 2026 15:59
doctor parsed a stored capacity with is_int and bash arithmetic, so a
legacy 08 printed an arithmetic error, 010 compared as octal eight, and
a value past 2^64 wrapped to a small number. It now uses valid_capacity,
the same rule sem_read applies.

Also: fix the duplicated Unreleased heading in CHANGELOG.md, run
test/capacity.py in make test-docker, and note the doctor finding in
README.

Refs #35
main's record validation (#43) now decodes stored capacity in doctor and
every read, so doctor keeps main's validate_record path, and valid_capacity
delegates to record_uint instead of carrying a second decimal parser.
@flyingrobots
flyingrobots merged commit 41601d9 into main Oct 2, 2026
4 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.

Normalize semaphore capacity as decimal before storing or emitting JSON

1 participant