From 95d2542887b089c0caae8763e013cde7ac11a2f3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 19 Oct 2026 04:52:05 -0700 Subject: [PATCH] ci: move macOS validation to Xcode 27 Preserve the macOS 14 deployment target and selected release toolchain, verify Intel execution through Rosetta, and retain the CodeQL Swift exception. Include the reproduced numeric reminder ID prefix fix while preserving valid index precedence and unmatched numeric errors. Co-authored-by: goutamadwant --- .github/actionlint.yaml | 3 ++ .github/workflows/ci.yml | 10 +++-- .github/workflows/codeql.yml | 1 + .github/workflows/release.yml | 4 +- CHANGELOG.md | 2 + README.md | 2 +- Sources/RemindCore/IDResolver.swift | 9 ++-- Tests/RemindCoreTests/IDResolverTests.swift | 49 +++++++++++++++++++++ docs/RELEASING.md | 2 +- docs/commands.md | 4 +- scripts/build-release.sh | 4 +- scripts/test-release-caller.py | 11 +++-- 12 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 .github/actionlint.yaml diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000..2179770 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,3 @@ +self-hosted-runner: + labels: + - xcode-27 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59df6bd..bcb60bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,10 @@ jobs: run: make docs-site build: - runs-on: macos-26 + runs-on: xcode-27 timeout-minutes: 20 env: - DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer + MACOSX_DEPLOYMENT_TARGET: '14.0' steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Swift version @@ -51,12 +51,16 @@ jobs: run: scripts/test-release.sh - name: Credential-free universal candidate run: make macos-artifact - - name: Run the universal candidate natively + - name: Run both universal candidate architectures run: | + arch -x86_64 /usr/bin/true || softwareupdate --install-rosetta --agree-to-license + arch -x86_64 /usr/bin/true unzip -q dist/remindctl-macos-local.zip -d "$RUNNER_TEMP/remindctl-smoke" binary="$RUNNER_TEMP/remindctl-smoke/remindctl" source version.env test "$(env -u REMINDCTL_VERSION "$binary" --version)" = "$MARKETING_VERSION" "$binary" --help + test "$(env -u REMINDCTL_VERSION arch -x86_64 "$binary" --version)" = "$MARKETING_VERSION" + arch -x86_64 "$binary" --help "$binary" completion bash | bash -n "$binary" completion zsh | zsh -n diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 389843e..059cf79 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,6 +17,7 @@ concurrency: jobs: analyze: name: Analyze (${{ matrix.language }}) + # CodeQL Swift tracing does not support macOS 27 yet: https://github.com/github/codeql/issues/22742 runs-on: ${{ matrix.runner }} timeout-minutes: 30 permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9daccc9..3a4def9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,8 +57,8 @@ jobs: helper-identifier: '' linux-archive-name: '' linux-build-script: '' - macos-runner: macos-26 - verify-arm64-runner: macos-26 + macos-runner: xcode-27 + verify-arm64-runner: xcode-27 minimum-macos-version: 14 macos-build-script: scripts/build-release.sh prepare-script: '' diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8200c..9fd93a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Resolve all-digit reminder ID prefixes when the number is outside the current index range, while preserving valid index precedence. Thanks @goutamadwant. + - Use the shared Swift CLI release workflow for macOS-only signed releases and no-publish rehearsals, replacing the duplicated release pipeline. - Resolve repeated reminder indexes, IDs, and prefixes once for delete and complete, preserving input order and accurate preview/confirmation counts. Thanks @SebTardif. diff --git a/README.md b/README.md index 4d96048..815a0b3 100644 --- a/README.md +++ b/README.md @@ -304,7 +304,7 @@ Supporting those would require Apple to expose new public APIs or a separate non ## Development The package manager is pinned in `package.json`, and `.node-version` selects the docs runtime. -CI uses Xcode 26.6 on macOS 26, builds both release architectures, and runs the universal CLI natively. +CI uses the Xcode 27 toolchain on `xcode-27`, builds both release architectures with a macOS 14 deployment target, and runs the universal CLI natively and under Rosetta. Swift CodeQL remains on macOS 26 until its tracer supports macOS 27. `make check` runs the Swift tests once with coverage and retains the 90% RemindCore gate. CodeQL scans Swift with an explicit package build after dependency resolution, plus JavaScript/TypeScript and Actions. diff --git a/Sources/RemindCore/IDResolver.swift b/Sources/RemindCore/IDResolver.swift index f8c7fd2..11a8c40 100644 --- a/Sources/RemindCore/IDResolver.swift +++ b/Sources/RemindCore/IDResolver.swift @@ -19,10 +19,8 @@ public enum IDResolver { } for input in inputs { let trimmed = input.trimmingCharacters(in: .whitespacesAndNewlines) - if let index = Int(trimmed) { - guard index > 0 && index <= numericSorted.count else { - throw RemindCoreError.invalidIdentifier(trimmed) - } + let numericIndex = Int(trimmed) + if let index = numericIndex, index > 0, index <= numericSorted.count { appendUnique(numericSorted[index - 1]) continue } @@ -33,6 +31,9 @@ public enum IDResolver { let matches = sorted.filter { $0.id.lowercased().hasPrefix(trimmed.lowercased()) } if matches.isEmpty { + if numericIndex != nil { + throw RemindCoreError.invalidIdentifier(trimmed) + } throw RemindCoreError.reminderNotFound(trimmed) } if matches.count > 1 { diff --git a/Tests/RemindCoreTests/IDResolverTests.swift b/Tests/RemindCoreTests/IDResolverTests.swift index bc7244e..4b581b1 100644 --- a/Tests/RemindCoreTests/IDResolverTests.swift +++ b/Tests/RemindCoreTests/IDResolverTests.swift @@ -116,6 +116,55 @@ struct IDResolverTests { #expect(resolved.first?.title == "First") } + @Test("Resolve an out-of-range numeric token as an ID prefix") + func resolveNumericPrefix() throws { + let reminder = ReminderItem( + id: "45534C82-FE4E-4C30-ABE1-2243ED31ACC8", + title: "Numeric prefix", + notes: nil, + isCompleted: false, + completionDate: nil, + priority: .none, + dueDate: nil, + listID: "list1", + listName: "Work" + ) + + let resolved = try IDResolver.resolve(["4553"], from: [reminder]) + #expect(resolved.map(\.id) == [reminder.id]) + } + + @Test("Keep valid numeric index precedence over an ID prefix") + func validIndexPrecedesNumericPrefix() throws { + let reminders = [ + ReminderItem( + id: "0001-prefix", + title: "Prefix match", + notes: nil, + isCompleted: false, + completionDate: nil, + priority: .none, + dueDate: nil, + listID: "list1", + listName: "Work" + ), + ReminderItem( + id: "other", + title: "Numeric index", + notes: nil, + isCompleted: false, + completionDate: nil, + priority: .none, + dueDate: nil, + listID: "list1", + listName: "Work" + ), + ] + + let resolved = try IDResolver.resolve(["0001"], from: reminders, numericFrom: [reminders[1]]) + #expect(resolved.map(\.id) == [reminders[1].id]) + } + @Test("Reject short prefix") func rejectShortPrefix() { #expect(throws: RemindCoreError.invalidIdentifier("ab")) { diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 8b5e05a..fbdd749 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -27,7 +27,7 @@ The signer never checks out or executes source. Build and verification jobs rece The shared GitHub release contains `remindctl-macos.zip`, `checksums.txt`, `ASSET-INVENTORY.json`, `SIGNING-MANIFEST.json`, and `RELEASE-NOTES.md`. The ZIP contains only `remindctl`. The inventory records the repository, frozen commit, version tag, dry-run status, archive size, and SHA-256; the signing manifest records the stable identifier `com.steipete.remindctl`, architectures, and Foundation Team ID. The checksum manifest covers every other release asset. Historical releases retain their original `release-inventory.json` schemas; local readers remain for those historical assets. -Both architecture slices must pass strict signature, stable identity, architecture, and online notarization checks. The signer applies hardened runtime and secure timestamps; source metadata validation checks the embedded version inputs, and native execution checks the CLI version and help. Fresh macos-26 arm64 and macos-15-intel runners execute the CLI natively. Standalone Mach-O files cannot be stapled; online `codesign --check-notarization -R=notarized` is the ticket check. CLI version/help smoke does not request Reminders permissions. +Both architecture slices must pass strict signature, stable identity, architecture, and online notarization checks. The signer applies hardened runtime and secure timestamps; source metadata validation checks the embedded version inputs, and execution checks the CLI version and help. Fresh `xcode-27` runners execute arm64 natively and x86_64 under Rosetta, retaining the macOS 14 deployment target. Standalone Mach-O files cannot be stapled; online `codesign --check-notarization -R=notarized` is the ticket check. CLI version/help smoke does not request Reminders permissions. After publication, the workflow dispatches `steipete/homebrew-tap` with the exact ZIP URL and a unique request ID. It waits for that run and verifies the resulting formula URL and SHA-256. A tap failure leaves the GitHub Release published; repair the tap handoff without republishing the version. diff --git a/docs/commands.md b/docs/commands.md index 8567547..2f7b9e1 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -73,8 +73,8 @@ remindctl edit 4A83 --list-id 7A12 remindctl edit 4A83 --no-repeat ``` -`edit`, `complete`, and `delete` accept indexes from the current default listing or ID prefixes. -Numeric indexes must be positive and within the current view; out-of-range values return an error. +Commands that target reminders accept indexes from the current default listing or ID prefixes. +An in-range numeric value always selects that index. An out-of-range numeric value falls back to ID-prefix matching and returns an error when no reminder ID matches. `complete` and `delete` process each reminder once, even when repeated indexes, IDs, or prefixes identify the same reminder. Previews and delete confirmation counts use these unique targets in first-input order; every input must still be valid and unambiguous. Reminders sort by due date, then title, then stable ID so equal dates and titles do not make numeric targets depend on EventKit's fetch order. Use IDs when reminders may be added, removed, or edited between commands. diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 7a132d5..4568885 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -3,9 +3,7 @@ set -euo pipefail : "${OUTPUT_DIR:?OUTPUT_DIR is required}" ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -candidate=$(find /Applications -maxdepth 1 -name 'Xcode_26*.app' | sort -V | tail -1) -[[ -n "$candidate" ]] || { echo 'Xcode 26 is required' >&2; exit 1; } -export DEVELOPER_DIR="$candidate/Contents/Developer" +export MACOSX_DEPLOYMENT_TARGET=14.0 mkdir -p "$OUTPUT_DIR" "$ROOT/scripts/build-macos-universal.sh" "$OUTPUT_DIR/remindctl" chmod +x "$OUTPUT_DIR/remindctl" diff --git a/scripts/test-release-caller.py b/scripts/test-release-caller.py index 8edcb92..d652e21 100644 --- a/scripts/test-release-caller.py +++ b/scripts/test-release-caller.py @@ -54,14 +54,19 @@ def test_output_directory_adapter(self): (root / 'tools').mkdir() shutil.copy(ROOT / 'scripts/build-release.sh', root / 'scripts/build-release.sh') builder = root / 'scripts/build-macos-universal.sh' - builder.write_text('#!/bin/bash\nset -eu\nprintf "synthetic" > "$1"\n') + builder.write_text('#!/bin/bash\nset -eu\n' + 'test "$DEVELOPER_DIR" = "/Applications/Xcode_27.app/Contents/Developer"\n' + 'test "$MACOSX_DEPLOYMENT_TARGET" = "14.0"\n' + 'printf "synthetic" > "$1"\n') builder.chmod(0o755) find = root / 'tools/find' - find.write_text('#!/bin/bash\necho /Applications/Xcode_26.6.app\n') + find.write_text('#!/bin/bash\necho "Unexpected Xcode discovery" >&2\nexit 1\n') find.chmod(0o755) output = root / 'output with spaces' subprocess.run([str(root / 'scripts/build-release.sh')], check=True, - env=dict(os.environ, OUTPUT_DIR=str(output), PATH=str(root / 'tools') + ':' + os.environ['PATH'])) + env=dict(os.environ, OUTPUT_DIR=str(output), + DEVELOPER_DIR='/Applications/Xcode_27.app/Contents/Developer', + PATH=str(root / 'tools') + ':' + os.environ['PATH'])) binary = output / BINARY self.assertEqual(binary.read_text(), 'synthetic') self.assertTrue(os.access(binary, os.X_OK))