Skip to content

feat(ios): add opt-in reminders for nonrecurring tasks - #167

Open
TaylorFinklea wants to merge 12 commits into
logseq:mainfrom
TaylorFinklea:feature/ios-nonrecurring-task-reminders
Open

TaylorFinklea wants to merge 12 commits into
logseq:mainfrom
TaylorFinklea:feature/ios-nonrecurring-task-reminders

Conversation

@TaylorFinklea

@TaylorFinklea TaylorFinklea commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Add a default-off iOS reminder setting for eligible dated, nonrecurring task blocks and pages. Scheduled takes precedence, with Deadline used when Scheduled is absent or empty. Date-only values alert at 9 AM local time; date-times retain their instant. Notifications use generic localized text, and taps validate the current task context before navigation.

Use the existing core's complete eligible-task projection to reconcile observed edits, completion, deletion, graph changes, sign-out and sync updates. Keep notification writes serialized and fenced by current work, preserve unrelated notifications, and await background reconciliation or cleanup. Graph changes block old-scope writes throughout the operation; failed operations request a fresh projection of the remaining valid graph. Background expiration releases only its owning work, including coalesced callers. Scheduling runs on iOS; Android supplies matching shared settings fields.

Validation includes 1,308 core tests, a focused Task-page inventory case, deterministic normal-completion and regression-mutation checks, production-code host tests for callback coalescing, supersession, expiration, scope cleanup and failure recovery, 12 GraphSync tests, and six compiled Chinese catalog lookups. The iOS simulator product built and linked; the final follow-up changes only tests, and its full iOS harness typechecks. The unchanged model passed 65 Swift tests across six suites. The repository model-test helper has an Xcode-layout-specific output-map failure; its direct Swift Testing launcher passed.

Earlier integration evidence includes 14 core-to-Swift harness groups and signed-in notification, sync and cold-tap checks on the predecessor scheduler plus the separate autocomplete decoder fix (#166). The final lifecycle repairs were exercised with injected production code and the native build; signed-in UI and OS delivery were not rerun on this revision.

An unsuperseded failed background sync clears managed reminders until a later successful reconciliation, so alarm continuity through that failed refresh is not promised. A suspended app cannot observe and cancel reminders for remote edits until it next refreshes. Reconciliation retains delivered alerts for eligible overdue tasks while they remain open. Recurring tasks are excluded.

Read eligible tasks from the complete projected core graph and reconcile private local alerts with typed dates. Fence stale writes and drain notification cleanup before background completion or expiration.

Validation: 1,307 core tests, simulator build, and 13 core-to-native runtime check groups passed.
Return notification write failures through reconciliation and retain background cleanup on failure. Set the Gregorian calendar explicitly for UTC triggers and remove an unused capture.

Validation: simulator build, 14 runtime check groups, and actual OS scheduling and delivery passed.
Keep cleanup and cancellation scoped to their owning background attempt, coalesce sync callbacks, and protect graph transitions through failure. Reject incomplete inventories, surface scheduling errors, and honor Chinese script selection.

Validation: production-code callback and concurrency probes, 12 coordinator tests, compiled catalog lookups, and iOS simulator product build and link passed.
Exercise page-as-task inventory identity and repeated normal background completion with synchronous callback recording.

Validation: 1,308 core tests, the focused page case, production completion probes with regression mutants, and iOS harness typecheck passed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T19:52:48.849624Z d972295 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +121 to +124
if backgroundGeneration == generation {
backgroundTask = nil
backgroundCallers.removeAll()
backgroundExpirationCleanup = nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Expired refresh leaves task reminders scheduled

When expiration races a completed sync, runBackground clears its caller before expiration cleanup runs. expireBackground then finds no caller and leaves the expired refresh's reminders scheduled.

Learn more

An OS expiration cancels its waiting refresh task and queues an actor call to expireBackground. The underlying sync runs in a separate task, so it can finish and write reminders before the queued expiration call executes. If runBackground clears the caller and cleanup closure first, expireBackground cannot identify the expired operation, and expireAndDrain has no other cleanup path. The OS budget finishes with failure while the reminders remain pending.

Example: A sync adds a reminder for tomorrow just as iOS expires its refresh. Cancellation queues expiration, but the sync finishes and removes its caller first. Expiration then returns without clearing tomorrow's alert.

Recommended fix: Retain each request's run and expiration cleanup until cancellation or expiration has been resolved. Make runBackground await the request's expiration cleanup before retiring a canceled caller; ensure a late expireBackground cannot mistake a finished run for an unrelated newer run.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@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: 915686ee84

ℹ️ 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 on lines +11 to +14
let ref_id db attr = function
| Some (Ds.Ref id) -> Some id
| Some (Ds.Ref_to reference) -> Option.map (fun entity -> entity.Ds.id) (Ds.entity db reference)
| _ -> None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Normalize numeric references before resolving reminder tasks

For graph data containing numeric reference datoms, a representation explicitly supported by Datascript_value.ref_eid, this helper treats block/page = Ds.Int64 pageEid as missing. task_for_eid then defaults the page to the task itself and rejects ordinary block tasks because they are not Pages, silently excluding otherwise eligible tasks from reminders. Numeric Scheduled/Deadline references are also either rejected or mistaken for scalar timestamps. Use the existing schema-aware reference decoder for these reads, including empty-placeholder detection, and cover the raw-numeric-reference representation in the inventory tests.

Useful? React with 👍 / 👎.

))
let resolution = await Self.resolution(from: await callCore(request))
let response = await callCore(request)
await coreResponseObserver?(response)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile reminders after graph catalog refreshes

When a successful graph-catalog refresh removes the selected graph because it was deleted remotely or access was revoked, the refresh-graphs branch returns before this observer runs. refreshGraphCatalog() also calls the core directly rather than through the store response relay, so the observed scope change does not trigger reminder reconciliation. Existing alerts remain scheduled until another core/store callback or app activation, even though task_reminder_scope_db would now reject that graph. Notify the reminder observer for the catalog completion response as well.

Useful? React with 👍 / 👎.

Retain each background request's run and cleanup through late expiration, draining canceled callers without touching newer work. Decode numeric task references with the graph schema and observe graph catalog completion.

Add regressions for late cleanup, numeric temporal/page references, placeholder fallback, and catalog removal. Validate the 1310-test core gate, focused Swift concurrency and catalog cases, production reminder host checks, and iOS Swift builds/typecheck.
Measure navigation chrome at natural height so subcomposed controls can render after graph creation. Cover both chrome placement modes with an instrumented regression and run it before Android smoke tests.
Remove vertical growth from the Android capture and composer children while retaining horizontal expansion and Apple layout behavior. Exercise the actual native bridge and capture tree in the instrumented regression.

Copy link
Copy Markdown
Contributor Author

@codex review

Please review current head 8b79d14c744649ed82fbdc76cd647ca9802f2e92.

The earlier numeric-reference, graph-catalog reconciliation and expiration-cleanup changes are in 92c18c1. The Android graph-setup crash is repaired in d7c7db0 and 8b79d14: avoid intrinsic measurements of subcomposed bottom chrome, preserve natural-height Android capture/composer content, and cover the actual native bridge and both layout modes.

Validation: the local native core gate passed all 1,310 tests; official CI passed, and the Android E2E job passed, including the focused instrumentation class and original graph-creation/capture smoke flow. The iOS job in the E2E workflow is still running.

@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: 8b79d14c74

ℹ️ 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 on lines +419 to +420
taskReminderCoordinator.onSettingsChanged = { [weak self] in
self?.publishSettingsHostUpdate()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unsaved server URLs during reminder status updates

On iOS, returning to the foreground while Settings contains an unapplied Sync server URL invokes refreshPermissionStatus() and this callback even when task reminders are disabled. publishSettingsHostUpdate() sends a full settings snapshot, and ApplySettingsSnapshot in shared/src/logseq/model.ml:2824-2836 unconditionally replaces base_url_draft with the persisted URL. The user's edit is therefore silently discarded simply by switching apps; enabled reminder reconciliations can also discard it during sync. Publish only reminder fields here, or preserve a dirty URL draft when applying reminder-driven settings updates.

Useful? React with 👍 / 👎.

Keep edited connection drafts across host settings snapshots while clean drafts follow the saved URL. Preserve explicit Apply and Dismiss behavior.

Cover reminder-related settings updates, host URL changes, raw and empty drafts, and the native settings bridge.
Preserve the reminder feature and unsaved URL draft fix while incorporating upstream changes. Retain the testable Android bottom chrome layout with upstream unbounded-height measurement.

Copy link
Copy Markdown
Contributor Author

Merged current main (4dc01cad) into this branch at d9722956 and resolved the Android bottom-chrome conflict. The resolution retains upstream's unbounded-height behavior and the focused layout regression tests. The unsaved Sync server URL draft fix remains included.

Validation: the final native core gate passes all 1,321 tests. Independent integration review found no material issues. CI and iOS/Android E2E are running on the new head.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: d9722956ba

ℹ️ 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".

Preserve reminder lifecycle cleanup and unsaved Sync URL drafts while integrating upstream changes. Retain reminder mutation ownership around shared-link graph opening and register both settings regressions.
Accept the toggle's boolean value directly and make the drive settings projection explicit with disabled reminder defaults.
Retain upstream drive priority fixtures and main-only cache guards alongside reminder settings defaults and the existing Android layout regression check.
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.

1 participant