Repository navigation
Run an AppleScript handler with typed arguments and a pre-send check - #390
Conversation
|
Hi @oliverames. Thanks for splitting this out. Two things before I merge: could you make |
Mattt's mattt#390 review: - beforeSending is @sendable, so the nonisolated(unsafe) binding is gone. - The task's cancellation is checked again after the hook returns, so a task cancelled while the hook runs does not start the script. - A test cancels the task while the hook is blocked and checks that the script never runs.
c317c8f to
ce80938
Compare
|
@mattt On the macOS 26 test step: it isn't a test. The job fails in different steps on different runs (Test on the first run, Build on the latest), and the log says the build failed before any test ran: The runner image has Xcode 26.0.1 now while the cached I opened #393 to remove every |
The fork's integration build still had the pre-review code for the Reminders, Notes and AppleScript helper work. Bring in the same fixes Mattt is reviewing upstream: - Reminders: clamp stored relative alarms instead of trapping; carry the reminder's calendar and time zone on all-day and timed dues and keep seconds; read views in the stored time zone; include the house number in the street match and reject a bare locality; gate complete by reminders_update and rename by reminders_lists_rename; report an uncertain result when a complete's readback finds no reminder; accept completion_date on update; use the database tag records for notes_tags. - Notes: count scannedNoteCount against the scan budget and cap the page request by what is left; keep unreadableNoteIDs whether or not they matched; read tag filters from the database tag records; stop overwriting keywords from note text; don't pad short table rows; drop TagTally. - AppleScript: make beforeSending @sendable, drop nonisolated(unsafe), and check cancellation after the hook returns. 781 tests, 0 failures; format clean; the app builds.
|
@mattt Both are in The macOS 26 job is still red for the module-cache reason above, and #393 fixes that. |
NSAppleScript.execute can now call a handler of a fixed script with arguments that reach it as Apple event descriptors, never as source text. A caller's beforeSending check runs on the script queue right before the script.
Mattt's mattt#390 review: - beforeSending is @sendable, so the nonisolated(unsafe) binding is gone. - The task's cancellation is checked again after the hook returns, so a task cancelled while the hook runs does not start the script. - A test cancels the task while the hook is blocked and checks that the script never runs.
ce80938 to
14070a2
Compare
Split out from #383 per #364.
This adds
NSAppleScript.Subroutineand optionalcalling:andbeforeSending:parameters toNSAppleScript.execute, so a fixed script can receive typed Apple event descriptors instead of interpolated source text, and run a last-second check on the serial queue right before executing.Review fixes
beforeSendingis@Sendable, so thenonisolated(unsafe)binding is gone.Testing
swift format lint --strictis clean on both files.imcp-serverTests/AppleScriptTests: 9 tests, 0 failures. They cover hostile string values, typed parameter descriptors (string,boolean,strings,enumCode),beforeSendingordering and short-circuiting, cancellation before the script, cancellation while queued, and cancellation during the hook.The macOS 26 failure is not a test
The macOS 26 job fails in different steps on different runs (Test once, Build on the latest run), and the log names no test because the build fails first. The error is a stale module cache:
The runner image now has Xcode 26.0.1, while the cached
.pcmwas built against 26.0. The cache key already includes the Xcode build number, but the cached module files live underDerivedData/.../HelperDerivedData/ModuleCache.noindex, and the workflow's cleanup only removesDerivedData/ModuleCache.noindex. I have a separate small PR that removes everyModuleCache.noindexunderDerivedDatabefore saving.