Skip to content

feat(keepalive): add Starbucks WiFi captive portal detection for macOS - #436

Merged
shunkakinoki merged 1 commit into
mainfrom
feat/keepalive-starbucks-wifi
Dec 21, 2025
Merged

feat(keepalive): add Starbucks WiFi captive portal detection for macOS#436
shunkakinoki merged 1 commit into
mainfrom
feat/keepalive-starbucks-wifi

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Dec 21, 2025

Copy link
Copy Markdown
Owner

Summary

  • Add macOS-specific Starbucks WiFi detection to neverssl-keepalive service
  • Automatically open captive portal when connectivity is lost on Starbucks networks
  • Include comprehensive test coverage for the new functionality

Changes

  • Enhanced keepalive.sh with OSTYPE detection for macOS
  • Added networksetup command to retrieve current SSID
  • Implemented STARBUCKS SSID pattern matching
  • Added captive.apple.com portal opening when ping fails
  • Extended test suite with 4 new test cases for Starbucks WiFi detection

Technical Details

  • Uses networksetup -getairportnetwork en0 to get SSID on macOS
  • Checks connectivity with ping -c 1 -W 2 1.1.1.1
  • Opens captive portal via open "http://captive.apple.com"
  • Gracefully handles command failures with || true

Summary by cubic

Adds macOS Starbucks WiFi detection to neverssl-keepalive. On Starbucks networks, if connectivity fails, it auto-opens the captive portal to restore access.

  • New Features
    • Detects macOS via OSTYPE and reads SSID using networksetup.
    • Matches STARBUCKS SSIDs and verifies connectivity with a quick ping.
    • Opens the macOS captive portal (captive.apple.com) when offline on Starbucks WiFi.

Written for commit 4304368. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings December 21, 2025 08:24
@mesa-dot-dev

mesa-dot-dev Bot commented Dec 21, 2025

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Dec 21, 2025

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Improved macOS compatibility with automatic captive portal detection and opening for Starbucks networks. When connectivity fails while connected to Starbucks WiFi, the system automatically opens the captive portal interface to assist users in restoring their connection.
  • Tests

    • Added comprehensive test coverage for macOS-specific Starbucks network detection and automatic captive portal functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Adds macOS-specific functionality to detect Starbucks WiFi networks and automatically trigger the captive portal if connectivity fails via ping. Includes corresponding test suite covering OSTYPE detection, SSID identification, and portal-opening behavior.

Changes

Cohort / File(s) Summary
macOS Starbucks WiFi Detection
home-manager/services/neverssl-keepalive/keepalive.sh
Introduces Darwin-specific control flow that checks for "STARBUCKS" in active Wi‑Fi SSID and pings 1.1.1.1; opens captive.apple.com if ping fails
Test Suite
spec/keepalive_spec.sh
Adds new "Starbucks WiFi detection (macOS)" test suite validating OSTYPE detection, networksetup SSID retrieval, STARBUCKS pattern matching, and captive portal invocation on connectivity failure

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • Verify macOS-specific logic only executes on Darwin systems and doesn't affect non-macOS platforms
  • Confirm SSID detection using networksetup is robust and handles edge cases (missing/unavailable SSID)
  • Validate ping failure handling and captive portal URL correctness
  • Review test mocking of system calls (OSTYPE, networksetup, ping) for completeness

Poem

A rabbit hops through Starbucks Wi‑Fi fog,
Pings a path where connections might be vague,
macOS now detects the coffee perch,
Opens portals before the signal search,
Connectivity magic for Darwin's lurch! ☕🐰

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: adding Starbucks WiFi captive portal detection for macOS to the keepalive service, matching the changeset.
Description check ✅ Passed The pull request description is comprehensive and directly related to the changeset, covering the new macOS-specific Starbucks WiFi detection features, implementation details, and test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/keepalive-starbucks-wifi

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.

@shunkakinoki
shunkakinoki enabled auto-merge (squash) December 21, 2025 08:25
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the neverssl-keepalive service by introducing a new feature specifically for macOS users. It aims to improve the user experience on public Wi-Fi networks, particularly Starbucks, by automatically detecting when a captive portal needs to be addressed and opening the relevant page, thus streamlining the process of regaining internet access.

Highlights

  • macOS Starbucks WiFi Detection: The neverssl-keepalive service now includes macOS-specific logic to detect Starbucks WiFi networks.
  • Automatic Captive Portal Opening: If connectivity is lost while on a detected Starbucks network on macOS, the system will automatically attempt to open the Apple captive portal page.
  • Enhanced Test Coverage: Comprehensive test cases have been added to validate the new Starbucks WiFi detection and captive portal opening functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 21, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Added macOS-specific Starbucks WiFi captive portal detection to the neverssl-keepalive service, automatically opening the captive portal when connectivity is lost on Starbucks networks.

What changed?

  • home-manager/services/neverssl-keepalive/keepalive.sh: Introduced macOS-specific logic to detect Starbucks Wi-Fi, check internet connectivity by pinging 1.1.1.1, and automatically open http://captive.apple.com if connectivity is lost.
  • spec/keepalive_spec.sh: Added a new test suite to verify macOS detection, SSID retrieval using networksetup, 'STARBUCKS' SSID detection, and the initiation of a captive portal check by opening captive.apple.com.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a helpful feature for handling Starbucks captive portals on macOS. The overall approach is good, but I've found a few issues in the implementation. There's a critical bug in the ping command due to platform differences in timeout flags, which would cause it to fail incorrectly. Additionally, the script uses a hardcoded network interface en0, which isn't guaranteed to be the Wi-Fi interface, and the SSID matching pattern is incorrect. I've also left a comment on the new tests, suggesting a more robust approach using mocks to align with the existing test patterns in the project. My suggestions aim to fix these issues and improve the robustness of the new functionality.


# Check for Starbucks networks (e.g., at_STARBUCKS_Wi2)
if [[ $SSID == *"STARBUCKS"* ]]; then
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The ping command's -W flag behaves differently on macOS compared to Linux. On macOS, it specifies the timeout in milliseconds, not seconds. A timeout of 2 milliseconds is far too short and will likely cause the ping to fail even with a good connection, leading to the captive portal opening unnecessarily on every script execution.

You should use the -t flag for a timeout in seconds on macOS, or increase the value for -W to 2000 for a 2-second timeout.

Suggested change
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
if ! ping -c 1 -t 2 1.1.1.1 >/dev/null 2>&1; then


# macOS-specific: Open captive portal for Starbucks WiFi if connectivity is lost
if [[ $OSTYPE == "darwin"* ]]; then
SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The Wi-Fi network interface is hardcoded as en0. While this is common on many Macs, it's not guaranteed. Other interfaces like en1 could be used, especially on older hardware or systems with multiple network adapters. To make this script more robust, you should dynamically determine the Wi-Fi interface device name.

The suggestion below also refactors the awk command to use -v FS=... which is a bit cleaner and avoids potential shell quoting issues.

Suggested change
SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")
SSID=$(networksetup -getairportnetwork "$(networksetup -listallhardwareports | awk '/Hardware Port: (Wi-Fi|AirPort)/{getline; print $2}')" 2>/dev/null | awk -v FS=": " '{print $2}' || echo "")

SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")

# Check for Starbucks networks (e.g., at_STARBUCKS_Wi2)
if [[ $SSID == *"STARBUCKS"* ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The pattern *"STARBUCKS"* includes literal double quotes, so it would only match an SSID that contains "STARBUCKS" including the quotes, which is unlikely. The quotes should be removed from the pattern.

Additionally, the comparison is case-sensitive. A case-insensitive match would be more robust and catch variations like Starbucks or starbucks.

The suggested change addresses both issues.

Suggested change
if [[ $SSID == *"STARBUCKS"* ]]; then
if [[ ${SSID,,} == *starbucks* ]]; then

Comment thread spec/keepalive_spec.sh
Comment on lines +86 to +107
Describe 'Starbucks WiFi detection (macOS)'
It 'checks for macOS via OSTYPE'
When run bash -c "cat '$SCRIPT'"
The output should include 'OSTYPE'
The output should include 'darwin'
End

It 'uses networksetup to get SSID'
When run bash -c "cat '$SCRIPT'"
The output should include 'networksetup -getairportnetwork'
End

It 'checks for STARBUCKS SSID pattern'
When run bash -c "cat '$SCRIPT'"
The output should include '*"STARBUCKS"*'
End

It 'opens captive portal when connectivity fails'
When run bash -c "cat '$SCRIPT'"
The output should include 'captive.apple.com'
End
End

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The new tests for Starbucks WiFi detection only check the script's source code for specific strings. This makes them brittle and tightly coupled to implementation details. For example, if the string matching for "STARBUCKS" is improved (e.g., to be case-insensitive as I suggested elsewhere), these tests would fail.

The existing tests in this file for curl behavior use mocking (mock_bin_setup) to test the script's actual behavior under different conditions. It would be better to follow that pattern for the new tests as well.

For example, you could:

  1. Mock networksetup to return a Starbucks SSID.
  2. Mock ping to fail.
  3. Assert that open "http://captive.apple.com" is called.

And another test where ping succeeds, and assert that open is not called. This would provide much more confidence in the correctness of the logic.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="home-manager/services/neverssl-keepalive/keepalive.sh">

<violation number="1" location="home-manager/services/neverssl-keepalive/keepalive.sh:16">
P1: On macOS, `ping -W` expects time in **milliseconds**, not seconds. `-W 2` sets a 2ms timeout, which is too short for any realistic network response and will almost always fail, causing the captive portal to open unnecessarily even when connectivity is working.

Use `-W 2000` for a 2-second timeout, or use `-t 2` which specifies timeout in seconds.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR


# Check for Starbucks networks (e.g., at_STARBUCKS_Wi2)
if [[ $SSID == *"STARBUCKS"* ]]; then
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then

@cubic-dev-ai cubic-dev-ai Bot Dec 21, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: On macOS, ping -W expects time in milliseconds, not seconds. -W 2 sets a 2ms timeout, which is too short for any realistic network response and will almost always fail, causing the captive portal to open unnecessarily even when connectivity is working.

Use -W 2000 for a 2-second timeout, or use -t 2 which specifies timeout in seconds.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/services/neverssl-keepalive/keepalive.sh, line 16:

<comment>On macOS, `ping -W` expects time in **milliseconds**, not seconds. `-W 2` sets a 2ms timeout, which is too short for any realistic network response and will almost always fail, causing the captive portal to open unnecessarily even when connectivity is working.

Use `-W 2000` for a 2-second timeout, or use `-t 2` which specifies timeout in seconds.</comment>

<file context>
@@ -6,3 +6,15 @@ set -euo pipefail
+
+  # Check for Starbucks networks (e.g., at_STARBUCKS_Wi2)
+  if [[ $SSID == *&quot;STARBUCKS&quot;* ]]; then
+    if ! ping -c 1 -W 2 1.1.1.1 &gt;/dev/null 2&gt;&amp;1; then
+      open &quot;http://captive.apple.com&quot; 2&gt;/dev/null || true
+    fi
</file context>
Suggested change
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
if ! ping -c 1 -W 2000 1.1.1.1 >/dev/null 2>&1; then
Fix with Cubic

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
home-manager/services/neverssl-keepalive/keepalive.sh (1)

15-15: Quote the SSID variable for safety.

The $SSID variable should be quoted to handle empty values safely. While the current code works due to the [[...]] construct, quoting is a shell scripting best practice that prevents potential issues.

🔎 Proposed fix
-  if [[ $SSID == *"STARBUCKS"* ]]; then
+  if [[ "$SSID" == *"STARBUCKS"* ]]; then
spec/keepalive_spec.sh (1)

86-107: Improve test coverage with behavioral tests.

The current tests only verify that certain strings exist in the script file. They don't test actual behavior or execution paths, and would pass even if the logic were completely broken or commented out.

Consider adding behavioral tests that:

  • Mock the macOS environment (OSTYPE, networksetup, ping, open)
  • Test the actual control flow (e.g., captive portal opens only on Starbucks WiFi when connectivity fails)
  • Verify commands are called with correct arguments in different scenarios
Example behavioral test structure
Describe 'Starbucks WiFi detection behavior (macOS)'
  setup() {
    MOCK_BIN=$(mktemp -d)
    export PATH="$MOCK_BIN:$PATH"
    export OSTYPE="darwin22.0"
    
    # Mock networksetup to return Starbucks SSID
    cat >"$MOCK_BIN/networksetup" <<'EOF'
#!/usr/bin/env bash
echo "Current Wi-Fi Network: at_STARBUCKS_Wi2"
EOF
    chmod +x "$MOCK_BIN/networksetup"
    
    # Mock ping to fail (no connectivity)
    cat >"$MOCK_BIN/ping" <<'EOF'
#!/usr/bin/env bash
exit 1
EOF
    chmod +x "$MOCK_BIN/ping"
    
    # Mock open command to log calls
    cat >"$MOCK_BIN/open" <<'EOF'
#!/usr/bin/env bash
echo "open $@" >> /tmp/open_log
EOF
    chmod +x "$MOCK_BIN/open"
  }
  
  cleanup() {
    rm -rf "$MOCK_BIN"
    rm -f /tmp/open_log
  }
  
  Before 'setup'
  After 'cleanup'
  
  It 'opens captive portal on Starbucks WiFi when connectivity fails'
    When run bash "$SCRIPT"
    The contents of file /tmp/open_log should include 'captive.apple.com'
    The status should be success
  End
End
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cc635b5 and 4304368.

📒 Files selected for processing (2)
  • home-manager/services/neverssl-keepalive/keepalive.sh (1 hunks)
  • spec/keepalive_spec.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{sh,bash}

📄 CodeRabbit inference engine (CLAUDE.md)

Use shfmt with 2-space indentation for shell scripts

**/*.{sh,bash}: Use 2 spaces for indentation in shell scripts
Add proper shebang lines to shell scripts
Follow shellcheck recommendations in shell scripts
Document complex commands in shell scripts
Use consistent variable naming in shell scripts

Files:

  • home-manager/services/neverssl-keepalive/keepalive.sh
  • spec/keepalive_spec.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Agent
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: shellcheck
  • GitHub Check: nix-linux
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: shellspec
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: nix-darwin
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: nix-nixos
  • GitHub Check: lua-hammerspoon
  • GitHub Check: lua-neovim
  • GitHub Check: lua-neovim-test


# macOS-specific: Open captive portal for Starbucks WiFi if connectivity is lost
if [[ $OSTYPE == "darwin"* ]]; then
SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Hardcode the WiFi interface name or detect it dynamically.

The hardcoded en0 interface may not work on all macOS systems; the device name could be airport, en0, en1, etc, depending on the Mac hardware and the version of OS X. Consider detecting the WiFi interface dynamically using networksetup -listallhardwareports or making it configurable.

🤖 Prompt for AI Agents
In home-manager/services/neverssl-keepalive/keepalive.sh around line 12 the WiFi
interface is hardcoded as en0 which fails on machines where the WiFi device uses
a different name; change the script to determine the active WiFi interface
dynamically or make it configurable: run networksetup -listallhardwareports and
parse the "Wi-Fi"/"AirPort"/"WiFi" Hardware Port entry to get the Device value
(fall back to common names like en0/en1), assign that to a variable (e.g.
WIFI_IFACE) and use it instead of en0, and allow overriding via an environment
variable or config option so the script works across macOS variants.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds macOS-specific functionality to automatically detect and handle Starbucks WiFi captive portals by checking the network SSID and opening Apple's captive portal page when connectivity is lost.

Key Changes:

  • Added macOS detection using OSTYPE environment variable
  • Implemented SSID retrieval via networksetup command to identify Starbucks networks
  • Integrated connectivity checking with fallback to open captive portal on Starbucks WiFi

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
home-manager/services/neverssl-keepalive/keepalive.sh Added macOS-specific logic to detect Starbucks WiFi networks and automatically open captive portal when connectivity fails
spec/keepalive_spec.sh Added four test cases to verify the presence of Starbucks WiFi detection code in the script

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# macOS-specific: Open captive portal for Starbucks WiFi if connectivity is lost
if [[ $OSTYPE == "darwin"* ]]; then
SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")

Copilot AI Dec 21, 2025

Copy link

Choose a reason for hiding this comment

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

The network interface name is hardcoded to en0, but macOS systems may have different primary WiFi interface names (e.g., en1, en2) depending on hardware configuration. Consider making this more robust by detecting the active WiFi interface dynamically, or document this assumption if en0 is guaranteed to be the WiFi interface in your target environment.

Suggested change
SSID=$(networksetup -getairportnetwork en0 2>/dev/null | awk -F": " '{print $2}' || echo "")
WIFI_DEVICE=$(networksetup -listallhardwareports 2>/dev/null | awk '/Wi-Fi/{getline; if ($1=="Device:") {print $2; exit}}')
: "${WIFI_DEVICE:=en0}"
SSID=$(networksetup -getairportnetwork "$WIFI_DEVICE" 2>/dev/null | awk -F": " '{print $2}' || echo "")

Copilot uses AI. Check for mistakes.
Comment thread spec/keepalive_spec.sh
Comment on lines +87 to +106
It 'checks for macOS via OSTYPE'
When run bash -c "cat '$SCRIPT'"
The output should include 'OSTYPE'
The output should include 'darwin'
End

It 'uses networksetup to get SSID'
When run bash -c "cat '$SCRIPT'"
The output should include 'networksetup -getairportnetwork'
End

It 'checks for STARBUCKS SSID pattern'
When run bash -c "cat '$SCRIPT'"
The output should include '*"STARBUCKS"*'
End

It 'opens captive portal when connectivity fails'
When run bash -c "cat '$SCRIPT'"
The output should include 'captive.apple.com'
End

Copilot AI Dec 21, 2025

Copy link

Choose a reason for hiding this comment

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

These tests only verify that certain strings exist in the script source code, but they don't validate the actual behavior or logic flow. Consider adding behavioral tests that mock the commands (networksetup, ping, open) and verify the script executes correctly under different conditions, similar to the existing "curl behavior" and "error handling" test suites. For example, test scenarios where: (1) SSID contains "STARBUCKS" and ping fails, (2) SSID doesn't contain "STARBUCKS", (3) SSID contains "STARBUCKS" but ping succeeds, and (4) networksetup command fails.

Copilot uses AI. Check for mistakes.
@shunkakinoki
shunkakinoki merged commit b9b22c3 into main Dec 21, 2025
38 checks passed
@shunkakinoki
shunkakinoki deleted the feat/keepalive-starbucks-wifi branch December 21, 2025 09:17
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