Skip to content

Add event details and subscriber APIs - #49

Merged
ollieatkinson merged 1 commit into
trunkfrom
oliver--todo-runtime-events
Jun 3, 2026
Merged

Add event details and subscriber APIs#49
ollieatkinson merged 1 commit into
trunkfrom
oliver--todo-runtime-events

Conversation

@ollieatkinson

Copy link
Copy Markdown
Owner

Adds bracketed K/EventDetail parsing, an Events.Subscriber abstraction, and refreshed SwiftUI event hooks. Also removes the string-as-error fallback and tightens TaskPaper parsing options.

Validation:

  • swift test --filter KBracketedTests --filter EventSubscriptionSetBuilderTests --filter EventSubscriberTests --filter SwiftUISupportTests --filter CLI™ --filter TaskPaper™ --filter StringSortingTests --filter GoGeneratorTests --filter RustGeneratorTests --filter LexiconLSPCommandTests --filter LexiconCLICommandTests

@ollieatkinson
ollieatkinson force-pushed the oliver--todo-runtime-events branch from 71f3adc to f2cd55d Compare June 3, 2026 09:15
@ollieatkinson
ollieatkinson marked this pull request as ready for review June 3, 2026 09:57
@ollieatkinson
ollieatkinson requested a review from Copilot June 3, 2026 09:57

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2cd55d091

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/SwiftLexicon/K.swift Outdated

Copilot AI 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.

Pull request overview

This PR extends the SwiftLexicon event system by introducing a bracketed K/EventDetail representation (including parsing), adding an Events.Subscriber helper for managing subscriptions, and updating SwiftUI integration to use the new subscription model. It also removes the prior “throw String” error fallback across the repo by introducing a dedicated LexiconError, and tightens TaskPaper parsing via explicit options.

Changes:

  • Add EventDetail + bracketed K rendering/parsing, plus updated JSON event description behavior for stable nested JSON rendering.
  • Introduce Events.Subscriber and refactor SwiftUI event hooks (events(...), onEvent, onEvents) to avoid duplicate subscriptions.
  • Replace String: Error usage with LexiconError, and add TaskPaper.Options to gate “plain text outline” lemma parsing.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/Lexicon/util/String.swift Introduces LexiconError and removes String-as-Error fallback.
Sources/Lexicon/util/Optional.swift Updates thrown errors to use LexiconError.
Sources/Lexicon/TaskPaper.swift Adds TaskPaper.Options and makes lemma-colon requirements configurable.
Sources/SwiftLexicon/K.swift Adds bracketed K string output, EventDetail, and bracketed parsing.
Sources/SwiftLexicon/Event.swift Adds Event.detail; changes JSON event description formatting for arrays/objects.
Sources/SwiftLexicon/Events.swift Adds Events.Subscriber, makes Events Identifiable, and makes EventSubscription.cancel() idempotent.
Sources/SwiftLexicon/SwiftUI.swift Refactors SwiftUI event environment + modifiers to use Events.Subscriber.
Tests/SwiftLexiconTests/* Adds coverage for bracketed parsing, subscriber behavior, and SwiftUI hooks.
Tests/LexiconTests/* Updates tests to throw LexiconError; refactors CLI replay to use EventDetail(bracketed:); adds TaskPaper option tests; adds string sorting tests.
Tests/LexiconGeneratorsTests/* Updates generator tests’ error throwing and resource loading to use LexiconError.
Sources/lexicon-generate/CodeGenerator.swift Uses LexiconError for conflict reporting.
Package.swift Adds SwiftLexicon dependency to LexiconTests.
Comments suppressed due to low confidence (2)

Tests/LexiconTests/CLI™.swift:99

  • failureError doesn’t throw, so throw try failureError(...) is unnecessary (and becomes a warning/error under stricter settings).
    Tests/LexiconTests/CLI™.swift:105
  • failureError is declared throws and uses try LexiconError(...), but LexiconError’s initializer is non-throwing. Dropping throws/try avoids unnecessary error-handling noise.

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

Comment thread Sources/SwiftLexicon/Event.swift
@ollieatkinson
ollieatkinson force-pushed the oliver--todo-runtime-events branch 6 times, most recently from 03124c1 to c685cf5 Compare June 3, 2026 19:33
@ollieatkinson
ollieatkinson force-pushed the oliver--todo-runtime-events branch from c685cf5 to 760a19c Compare June 3, 2026 19:53
@ollieatkinson
ollieatkinson merged commit 2f05d60 into trunk Jun 3, 2026
2 checks passed
@ollieatkinson
ollieatkinson deleted the oliver--todo-runtime-events branch June 3, 2026 20:01
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