Skip to content

fix: normalize semaphore capacity as decimal - #44

Open
flyingrobots wants to merge 1 commit into
mainfrom
fix/decimal-capacity
Open

flyingrobots wants to merge 1 commit 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

Next included review available in 53 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9d7c412f-655f-49ad-b195-ab5a4648b51c

📥 Commits

Reviewing files that changed from the base of the PR and between 01e39c3 and 5236944.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • Makefile
  • README.md
  • bin/git-locks
  • lib/170-semaphores.sh
  • test/capacity.py
  • test/test.sh

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.

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