Skip to content

Add scheduledTime to AlarmInvocationInfo#6412

Merged
jqmmes merged 4 commits intomainfrom
joaquim/scheduled-time-in-alarm-invocation
Mar 26, 2026
Merged

Add scheduledTime to AlarmInvocationInfo#6412
jqmmes merged 4 commits intomainfrom
joaquim/scheduled-time-in-alarm-invocation

Conversation

@jqmmes
Copy link
Copy Markdown
Contributor

@jqmmes jqmmes commented Mar 25, 2026

Adds the scheduledTime to AlarmInvocation. This is accessible via getScheduledTime

@jqmmes jqmmes changed the title Add scheduledTime to AlarmInvocation Add scheduledTime to AlarmInvocationInfo Mar 25, 2026
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 25, 2026

Now I have a complete picture of the changes. Let me do my final analysis:

Summary of the PR:

  • Adds scheduledTime (as a double milliseconds-since-epoch) to AlarmInvocationInfo, which is the object passed to Durable Object alarm handlers.
  • The value is converted from kj::Date (nanoseconds) to milliseconds via integer division, then stored as double. This is consistent with how ScheduledEvent.scheduledTime works.
  • TypeScript types are updated correctly.
  • Test coverage validates the new property.

Analysis:

  1. Backward compatibility: This is purely additive — a new read-only property on an existing object. Existing alarm handlers that don't access scheduledTime are completely unaffected. No compat flag needed.

  2. Safety: scheduledTime is captured by value (it's a kj::Date, wrapping int64_t), so the lambda capture is safe. No lifetime issues.

  3. Precision: The static_cast<double> of milliseconds-since-epoch is fine for any practical date (loss only beyond ~285,000 years from epoch).

  4. Type snapshots: All four generated snapshot files are updated consistently.

  5. Test: The test stores the time passed to setAlarm and verifies it matches alarmInfo.scheduledTime in the handler. This is a good end-to-end validation.

  6. JSG_READONLY_INSTANCE_PROPERTY: Technically the project convention prefers prototype properties, but the pre-existing isRetry and retryCount already use instance properties. Being consistent with the existing class is the right call here.

This is a clean, well-scoped change with no issues to flag.

LGTM

github run

@jqmmes jqmmes marked this pull request as ready for review March 25, 2026 15:34
@jqmmes jqmmes requested review from a team as code owners March 25, 2026 15:34
@jqmmes jqmmes requested a review from dario-piotrowicz March 25, 2026 15:34
jqmmes added 4 commits March 25, 2026 16:12
Adds the scheduledTime to AlarmInvocation. This is accessible via getScheduledTime
Sets up scheduledTime in AlarmInvocation
Updates the test to verify scheduledTime is accessible in an actor alarm
@jqmmes jqmmes force-pushed the joaquim/scheduled-time-in-alarm-invocation branch from 3e0c74b to 1c500ff Compare March 25, 2026 16:12
@jqmmes jqmmes merged commit b68585d into main Mar 26, 2026
24 checks passed
@jqmmes jqmmes deleted the joaquim/scheduled-time-in-alarm-invocation branch March 26, 2026 14:14
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.

3 participants