Cover: One line, wrong result. Code review of three small public repos: cabe-ios, shake-testing and web-commit-generator
Short answer

Three small public repos, three quiet bugs: cabe-ios fires its every-2-days, every-3-days and weekly reminders at the time the schedule was created instead of the time you picked, shake-testing never removes its motion listener, so each restart counts every reading one more time, and web-commit-generator types "add undo button" as a revert because of substring matching. None of them throws an error. Test the second run, compare exact times and outputs, and try words that contain your keywords.

Small repos rarely get a second reader. They work on the day they are written, the README gets a screenshot, and nobody runs them again with a different input. This post reviews three small public repos from my GitHub account and walks through the bug that matters most in each one, plus the smaller problems around it, with a fix you can copy.

The three repos are cabe-ios, an iOS app that reminds you to water chili plants; shake-testing, a web page for testing shake detection on a phone; and web-commit-generator, an offline tool that turns a plain sentence into a Conventional Commits message. They have nothing in common on the surface. Each one has a bug that fits on one line and gives a wrong result without any error message.

How I checked them: I read all the source files. The two JavaScript projects ran unchanged in Node with a small fake DOM, and the outputs quoted below are copied from those runs. The Swift app itself was not built. The Swift fix at the end of that section was later compiled on a Mac against stand-in types, as described there. Everything said about Apple and browser APIs comes from Apple's documentation and MDN, linked in the Sources section.

1. cabe-ios: the reminder that ignores the time you picked

cabe-ios (the app is called Cabe Care) lets you add a watering schedule for a plant: a name, a time, an interval and an optional note. The intervals are every day, twice a day, every 2 days, every 3 days and once a week. The app stores schedules in UserDefaults and uses local notifications for the reminders. The last commit is from January 2026, and the code is split into VIPER modules (View, Interactor, Presenter, Entity, Router) with a CB prefix.

The bug

All reminders go through CBNotificationManager.scheduleWateringNotification(for:). For the daily interval it builds a calendar trigger from the hour and minute you picked, which is correct. For every 2 days, every 3 days and weekly, it does this instead:

let interval = schedule.repeatInterval.timeInterval   // e.g. 2 * 24 * 60 * 60
trigger = UNTimeIntervalNotificationTrigger(timeInterval: interval, repeats: true)

The hour and minute are computed a few lines earlier and then never used on this path. Apple's documentation for UNTimeIntervalNotificationTrigger(timeInterval:repeats:) says the interval is "the time (in seconds) that must elapse from the current time before the trigger fires." The clock starts when the request is added, so the reminder time depends on when you tapped Save.

Here is what that looks like for a user. At 15:42 on a Monday they create a schedule for a plant, pick 07:00 and choose "every 2 days". The first reminder arrives on Wednesday at 15:42, then Friday at 15:42, and so on. The 07:00 they picked appears in the list cell and nowhere else. If they edit the schedule on Thursday evening to fix a typo in the plant name, the app cancels and re-adds the request, and the cycle restarts from that evening.

The daily and twice-daily paths don't have this problem, which is probably why it slipped through. Those are the intervals you test first, and a 2-day reminder takes 2 days to show you it's wrong.

Why the obvious fix doesn't exist

A calendar trigger can only repeat on a pattern that date components can express, such as "every day at 07:00" or "every Tuesday at 07:00". Apple's own example for UNCalendarNotificationTrigger sets only hour and minute and passes repeats: true to get a daily reminder. There is no component for "every second day". Weekly works with a weekday component, but every 2 or 3 days needs a different approach.

The usual approach is to schedule the next few dates yourself as one-shot calendar triggers and top them up when the app comes back to the foreground. An Apple engineer confirmed on the developer forums that an app can have at most 64 pending notification requests at a time, so you need a budget. With 4 reminders per schedule, 16 schedules fit, which is plenty for a plant app.

A fix, checked against stand-in types

// Written against the repo's types. Compiled for this post against stand-ins, not inside the repo.
private let upcomingCount = 4

func scheduleWateringNotification(for schedule: CBWateringSchedule) {
    guard schedule.isEnabled else { return }
    let calendar = Calendar.current
    let time = calendar.dateComponents([.hour, .minute], from: schedule.wateringTime)

    switch schedule.repeatInterval {
    case .daily:
        add(id: "watering-\(schedule.id.uuidString)", schedule: schedule,
            trigger: UNCalendarNotificationTrigger(dateMatching: time, repeats: true))
    case .weekly:
        var weekly = time
        weekly.weekday = calendar.component(.weekday, from: schedule.wateringTime)
        add(id: "watering-\(schedule.id.uuidString)", schedule: schedule,
            trigger: UNCalendarNotificationTrigger(dateMatching: weekly, repeats: true))
    case .everyTwoDays, .everyThreeDays:
        let step = schedule.repeatInterval == .everyTwoDays ? 2 : 3
        // First occurrence: today at the chosen time, or tomorrow if that time has passed.
        guard var next = calendar.nextDate(after: Date(), matching: time,
                                           matchingPolicy: .nextTime) else { return }
        for index in 0..<upcomingCount {
            let parts = calendar.dateComponents([.year, .month, .day, .hour, .minute], from: next)
            add(id: "watering-\(schedule.id.uuidString)-\(index)", schedule: schedule,
                trigger: UNCalendarNotificationTrigger(dateMatching: parts, repeats: false))
            next = calendar.date(byAdding: .day, value: step, to: next) ?? next
        }
    case .twiceDaily:
        // keep the existing two daily calendar triggers
        break
    }
}

Here add(id:schedule:trigger:) is a small helper that builds the same notification content the repo builds today and passes the request to UNUserNotificationCenter.add. Three more changes go with it. cancelWateringNotification(for:) has to remove the numbered identifiers too, so build the list with the same loop. The schedule needs a stored anchor date (when the cycle started) so that a top-up on Friday continues the same every-2-days rhythm instead of starting a new one from Friday. And the app should refill the queue on launch and when it returns to the foreground, after checking getPendingNotificationRequests to see what is still waiting.

Smaller problems in the same repo

What the fix does on a Mac

The fix was compiled with Xcode 26.2 against small stand-ins for the repo's types: a CBWateringSchedule with an id, an enabled flag, a time and an interval, the interval enum, and an add(id:schedule:trigger:) that records each trigger instead of scheduling it. It built with no warnings in the Swift 5 and Swift 6 language modes, for macOS and for the iOS 15 Simulator SDK. It needs import UserNotifications at the top of its file, which the repo's notification manager would already have.

The harness then asked each recorded trigger for its nextTriggerDate(). It ran on Monday, 16 November 2026, at 21:31, with a schedule set for 07:00:

  • Every 2 days: Tuesday 17 at 07:00, Thursday 19 at 07:00, Saturday 21 at 07:00 and Monday 23 at 07:00.
  • Weekly: Monday 23 at 07:00, the next Monday after the chosen time had passed that day.
  • Daily: Tuesday 17 at 07:00.

For comparison, the repo's current trigger, UNTimeIntervalNotificationTrigger(timeInterval: 2 * 24 * 60 * 60, repeats: true), reported its first fire as Wednesday 18 at 21:31: two days after the moment it was created, with the 07:00 nowhere in sight. That is the bug from the top of this section, confirmed by Apple's own API rather than by waiting two days.

That also points to the cheapest test for any time-based feature. nextTriggerDate() works on a trigger you never schedule, so a unit test can build the trigger, ask for its next date and compare it with the exact date you expect, in milliseconds. Four dates cover eight days for the every-2-days case, so the top-up when the app returns to the foreground, described above, is not optional.

The badge never goes away. Every request sets content.badge = 1, and the foreground handler in AppDelegate asks for .badge too, but nothing in the project resets it. Once the first reminder fires, the red 1 stays on the icon until the app is deleted. UNUserNotificationCenter.setBadgeCount(_:) clears it, but it needs iOS 16 and the project's deployment target is iOS 15.0, so you need an availability check with the older applicationIconBadgeNumber as the fallback for iOS 15.

The interval label ignores the language setting. The app has a Settings screen that switches between English and Indonesian, and most strings go through a .localized helper. The interval label in CBScheduleCell shows schedule.repeatInterval.rawValue directly, and the raw values are Indonesian strings such as "2 Hari Sekali". An English user sees Indonesian on every schedule row. Those raw values are also what Codable writes to UserDefaults, so if someone later "fixes" the label by changing the raw value to English, every saved schedule fails to decode. Keep stable keys like "everyTwoDays" as raw values (with a migration for existing data) and localize the label separately.

The README describes a different app. It says the architecture is MVC, lists folders such as Models/, Managers/ and ViewControllers/ and files like MainViewController.swift, and says iOS 14.0+. The repo has VIPER modules under Modules/, a separate VIPER_ARCHITECTURE.md, and a deployment target of 15.0. Anyone (or any coding agent) who opens the README first will look for files that aren't there. 4 App Repos, 4 Architectures: What VIPER, MVVM and GetX Really Cost looks at what those architectures cost in practice.

2. shake-testing: the listener that never stops

shake-testing is a single page with a Start Testing button, a shake counter, a sensitivity slider with three levels and a small panel showing the platform and whether motion events are supported. It's hosted on GitHub Pages and its last commit is from September 2025. The detector listens to devicemotion, sums how much accelerationIncludingGravity changed on each axis since the last reading, averages the last 10 values and counts a shake when the average crosses a threshold (25, 15 or 8 depending on sensitivity), with a 500 ms gap between shakes.

The permission handling is right. On browsers that expose DeviceMotionEvent.requestPermission(), the page calls it from the button's click handler, and MDN notes that the method needs transient activation, so it has to run inside a user gesture like that. The problems are in starting and stopping.

The bug

startDetection() {
    ...
    window.addEventListener('devicemotion', this.handleDeviceMotion.bind(this));
}

stopDetection() {
    ...
    window.removeEventListener('devicemotion', this.handleDeviceMotion.bind(this));
}

Each call to bind returns a new function. removeEventListener identifies a listener by the event type, the function and the capture flag, and MDN says a call that doesn't match a registered listener "has no effect". So Stop Testing changes the button label and the status text while the original listener keeps running in the background.

Nothing looks wrong after one stop, because handleDeviceMotion returns early while isActive is false. The trouble starts on the second Start. Now two listeners are attached, both process every motion event, and both push into the same smoothing buffer. This is the output from running the repo's own class in Node with a fake window:

listeners after stop: 1
listeners after second start: 2
buffer entries after ONE motion event: 2

The buffer fills twice as fast and each reading counts twice, so the detector after a restart behaves differently from the detector on first load. For a page whose whole job is to test detection, that makes the results depend on how many times you pressed the button.

The first reading is a shake on High

lastAcceleration starts at { x: 0, y: 0, z: 0 }. The first real reading includes gravity, about 9.81 on whichever axis points down, so the first delta is close to 9.81. With one value in the buffer, the average is that value. On High sensitivity the threshold is 8, so a phone lying still on a table counts one shake as soon as you press Start:

High sensitivity, phone still, first reading -> shakes: 1

On Medium (15) and Low (25) it stays under the threshold, which is why it's easy to miss.

The fix (tested in Node)

constructor() {
    this.onMotion = this.handleDeviceMotion.bind(this);  // bind once, keep the reference
    ...
}

startDetection() {
    ...
    this.lastAcceleration = null;   // no fake baseline
    this.shakeBuffer = [];
    window.addEventListener('devicemotion', this.onMotion);
}

stopDetection() {
    ...
    window.removeEventListener('devicemotion', this.onMotion);
}

handleDeviceMotion(event) {
    if (!this.isActive || !event.accelerationIncludingGravity) return;
    const a = event.accelerationIncludingGravity;
    if (!this.lastAcceleration) {               // first reading only sets the baseline
        this.lastAcceleration = { x: a.x || 0, y: a.y || 0, z: a.z || 0 };
        return;
    }
    ...
}

With those four changes applied to the repo's file, the same Node run gives 0 shakes for a still phone on High, 0 listeners after Stop, 1 listener after a restart, and a shake still registers when the fake readings swing hard between axes.

Smaller problems

The visibility handler only logs. A comment says "Pause detection when tab is not visible to save battery", but the code prints "pausing" and "resuming" to the console and changes nothing. Either call stopDetection() and remember the state, or delete the comment so the next reader doesn't trust it.

iPads may show up as macOS. The platform label comes from the user agent string, checked for "iphone|ipad|ipod" before "mac". Developers in Apple's forum report that Safari on iPadOS sends a Mac-style user agent by default, and when I fed that string to the detector it printed "macOS". Since the page's audience is phone and tablet testers, check touch support as well (for example navigator.maxTouchPoints > 1 together with a Mac user agent) before labeling the device.

The spacebar shortcut, which counts a fake shake while testing is active, works, but the page never mentions it. A one-line hint under the button would help anyone testing from a laptop.

3. web-commit-generator: a commit typed wrong

web-commit-generator is the newest of the three (last commit June 2026). You type a sentence such as "fix bug when user logout and app crash" and it returns a Conventional Commits header, a length meter against 50 and 72 characters, a quality score out of 100 and three alternatives. It's plain HTML, CSS and JavaScript with no network calls, and the README is clear that the engine is rule based, so messy sentences come out less fluent than an LLM would make them. That is a fair trade for an offline tool. The type detection is where it goes wrong.

The bug

function detectType(text) {
    const t = " " + text + " ";
    for (const sig of TYPE_SIGNALS) {
        for (const w of sig.words) {
            if (t.includes(" " + w + " ") || t.includes(" " + w)) return sig.type;
        }
    }
    return null;
}

The first check looks for a whole word. The second check, t.includes(" " + w), matches any word that starts with the keyword, which makes the first check pointless. The signal list is ordered with revert first, then perf, test, docs, ci and build, and fix and feat near the end, so a prefix hit on an early type beats the real verb. These are real outputs from the repo's engine:

You typeGenerator returnsWhy
add undo button to editorrevert: add undo button to editor"undo" is a revert keyword
add citation list to about pageci: add citation list to about page"citation" starts with "ci"
update docker image tagdocs: update docker image tag"docker" starts with "doc"
add new mockup screen for onboardingtest: add new mockup screen for onboarding"mockup" starts with "mock"
fix crash in testflight buildtest: fix crash in testflight build"testflight" starts with "test"
fix cache invalidation bugperf: fix cache invalidation bug"cache" is a perf keyword
added commenting featuredocs: add commenting feature"comment" is a docs keyword

The fix ... testflight row matters for iOS developers in particular, since TestFlight comes up in a lot of iOS commit messages. Release tools that read Conventional Commits treat fix and feat differently from other types; the spec maps fix to a patch release and feat to a minor release. A test: label on a crash fix can drop it from a generated changelog.

The type sticks to the next message

When auto-detection finds a type, generate() calls selectTypeSilently(detected), which stores it in state.type. When the next description contains no keyword at all, detection returns null and the stored type from the previous message is used. Running the engine with the same state handling:

add undo button to editor      -> revert: add undo button to editor
dark mode for settings screen  -> revert: revert dark mode for settings screen

The second line gets "revert" twice because buildSubject adds the type's default verb when the sentence doesn't start with one.

The README example doesn't match the engine

The README's example says the input "fix bug when user logout and app crash" produces fix: prevent app crash during logout. The engine returns fix: prevent user logout and app crash, which reads as if the commit prevents users from logging out. The README sentence describes what the author wanted, and the engine output is what users get.

The scope suggestion has the same substring problem, and it's more than a suggestion. A code comment says the inferred scope is "shown as a suggestion, never forced", but when the scope toggle is on and the field is empty, generate() puts the inferred scope into the header. "add feedback form" becomes feat(db): add feedback form because "feedback" contains "db", and "fix discard changes dialog" gets (payment) because "discard" contains "card".

The fix (tested in Node)

function hasTerm(text, term) {
    const esc = term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    return new RegExp(`(^|[^a-z0-9])${esc}([^a-z0-9]|$)`).test(text);
}

function detectType(text) {
    const first = text.split(" ")[0];
    const lead = IMPERATIVE[first] || first;          // "fixed" -> "fix"
    if (lead === "fix") return "fix";                 // the writer's own verb wins
    for (const sig of TYPE_SIGNALS) {
        if (sig.words.some((w) => hasTerm(text, w))) return sig.type;
    }
    return null;
}

Use the same hasTerm in detectScope, and remove the weakest keywords from the lists ("undo", "comment", "cache", "speed"), since they show up in feature and bug descriptions all the time. In generate(), fall back to a fixed default type when detection returns null instead of reusing the previous one, and show a small "type not detected" hint so the user picks a chip. With the whole-word matcher, "add undo button", "add citation list" and "add new mockup screen" come back as feat, "fix crash in testflight build" and "fix cache invalidation bug" as fix, and "add unit test for parser" still comes back as test.

Then add the README example as a test. The engine functions are pure, so a ten-line Node script that feeds in the four example sentences from the page and compares the output with the README would have caught the mismatch the day it appeared.

What the three bugs have in common

None of these bugs throws an error or shows a warning. The Swift compiler accepts a time interval trigger, the browser accepts a removeEventListener call that matches nothing, and String.includes happily returns true for "testflight". They only show up when you compare the output with what a person expected. A few checks catch most of this kind of bug in a small repo, and they take minutes:

  1. Write the expected output next to each example input in the README, then run the inputs and compare. If the tool is pure functions, do it in a script.
  2. Test the second run of everything that starts and stops: Start, Stop, Start again; schedule, edit, schedule again.
  3. For anything time based, write down the exact time you expect the event and check it against the time the code computes. Don't settle for "it fired".
  4. For keyword matching, try words that contain the keyword: "testflight" for "test", "docker" for "doc", "discard" for "card".
  5. Read the README as if you were a new contributor, and open every file it names.
  6. Search for comments that describe behavior ("pause detection", "never forced") and confirm the code below them does it.

Coding agents are good at this kind of review when you give them a narrow brief and a definition of done. If you want ready-made briefs for that, The Coding Agent Lab: Free, Max & Ultra Coding Agents is a free pack of 25 agent briefs for Claude Code, Cursor, ChatGPT or your own agent files, including iOS, SwiftUI, testing and security agents. Each brief has a mission, operating rules, an output format and quality gates, and it comes as a PDF guide with a TXT companion you can copy from. Larger Max and Ultra editions are listed on the same page.

All three repos are public, so you can check the findings yourself, and the fixes above apply to them as they stand today. 5 Small Open-Source Apple Projects That Each Teach One Hard Lesson has more small repos that reward a second reader.

Sources