Skip to content

Harden macOS alert action handling #29

Description

@HituziANDO

Problem

The macOS alert stores three action handlers in separate properties and calls fatalError when a fourth action is added. Adding or changing actions requires editing multiple branches.

Scope

  • Store button metadata and handlers in an ordered collection.
  • Map NSApplication.ModalResponse to the correct collection entry.
  • Return a recoverable failure if an explicit action limit remains necessary.
  • Preserve shortcut-key behavior.

Acceptance criteria

  • Adding an action does not require another dedicated handler property.
  • No supported action count terminates the process with fatalError.
  • Button order, shortcuts, and callbacks remain correct.

Tests

  • Cover zero through several actions, response mapping, missing handlers, and shortcut keys on macOS.

Relevant files

  • Framework/Sources/Alert.swift

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions