⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@kixelated
Copy link
Collaborator

thx Claude

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Walkthrough

Adds a new local development script dev/throttle for macOS that configures PF/dummynet-based network throttling. The script sets fixed bandwidth, delay, and queue size, backs up and injects an anchor into pf.conf, loads the modified PF configuration, and applies a UDP-only dummynet pipe. It runs until interrupted and handles SIGINT/SIGTERM by restoring the original pf.conf, removing the dummynet pipe, and disabling PF if possible. Also adds a throttle target to the justfile that runs dev/throttle.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a 'just throttle' script for Mac, which matches the new throttle target in the justfile and the dev/throttle script.
Description check ✅ Passed While minimal, the description 'thx Claude' is a casual acknowledgment related to the changeset and shows it was created with AI assistance, though it lacks substantive detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@dev/throttle`:
- Around line 33-55: The script currently traps only SIGINT/SIGTERM and modifies
PF state/config without guaranteeing restoration; add a robust cleanup function
(referenced by the existing trap cleanup) that captures PF enabled state before
changes, restores the original PF config by copying PF_BACKUP back to PF_CONF,
reloads that config with pfctl -f, re-enables or disables PF to the prior state,
deletes the dummynet pipe via dnctl pipe PIPE_NUM delete, and removes the anchor
if needed; register cleanup for EXIT and ERR (in addition to SIGINT/SIGTERM) so
failures after the pf modifications always invoke cleanup and ensure any pfctl
-E enabling is conditional based on the captured previous state.
🧹 Nitpick comments (2)
dev/throttle (1)

17-18: Avoid a fixed /tmp backup path.

Line 17 uses a predictable /tmp/pf.conf.backup, which can be clobbered by concurrent runs or pre-existing files. Use a unique mktemp path instead.

♻️ Suggested change
-PF_BACKUP="/tmp/pf.conf.backup"
+PF_BACKUP="$(mktemp -t pf.conf.backup.XXXXXX)"
+chmod 600 "$PF_BACKUP"
justfile (1)

417-419: Guard the target on non‑macOS hosts.

Since this is macOS-only, adding an OS check prevents confusing failures on Linux/Windows.

♻️ Suggested guard
 # Throttle UDP traffic for testing (macOS only, requires sudo)
 throttle:
-	dev/throttle
+	`@if` [ "$(uname)" != "Darwin" ]; then \
+		echo "throttle is macOS-only"; \
+		exit 1; \
+	fi
+	dev/throttle

@kixelated kixelated enabled auto-merge (squash) January 17, 2026 01:24
@kixelated kixelated merged commit 6edf06c into main Jan 17, 2026
1 check passed
@kixelated kixelated deleted the throttle branch January 17, 2026 01:24
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