Skip to content

fix(calendar): truncate the series when updating future instances by ID - #1317

Closed
saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-update-future-instance-id
Closed

saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-update-future-instance-id

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

What problem this solves

calendar events and calendar search list expanded instances (singleEvents=true), so the event ID a user or script has for a recurring meeting is usually an instance ID such as ser1_20250102T100000Z. resolveRecurringScopeResolution accepts that and resolves the series as ParentEventID; TestApplyUpdateScopeFuture_RecurringInstanceID pins that behavior. calendar delete --scope future then truncates resolution.ParentEventID.

calendar update --scope future drops it. applyUpdateScope returns only the target and the recurrence, and Run truncates plan.EventID, the ID the user typed. With an instance ID, both PATCHes go to the instance and the command exits 0:

$ gog calendar update primary ser1_20250102T100000Z --scope future --original-start 2025-01-02T10:00:00Z --summary Renamed
PATCH events/ser1_20250102T100000Z  recurrence=[RRULE:FREQ=DAILY]                       summary=Renamed
PATCH events/ser1_20250102T100000Z  recurrence=[RRULE:FREQ=DAILY;UNTIL=20250102T095959Z]   <- should be ser1

The second PATCH ends the instance's own recurrence a second before it starts, and ser1 is never truncated, so the original series keeps all its later occurrences. Passing the series ID ser1 works correctly, because there the typed ID is the series.

Change

applyUpdateScope returns the whole recurringScopeResolution. calendar update patches TargetEventID and truncates ParentEventID with ParentRecurrence, the same pattern calendar delete --scope future follows. The three existing applyUpdateScope tests are updated for the new return value, and the instance-ID test now also asserts ParentEventID.

Evidence

  • internal/cmd/calendar_update_future_instance_test.go runs CalendarUpdateCmd --scope future against an httptest daily series and records each PATCH target, once with the series ID (control) and once with the instance ID. On main (e8428c3) the instance-ID case sends the truncation to ser1_20250102T100000Z; with this change it goes to ser1 with UNTIL=20250102T095959Z, matching the series-ID case. The existing update, scope, delete and recurrence tests pass.

  • A built bin/gog from main and from this branch was run against a local Calendar stand-in through GOG_GOOGLE_API_BASE_URL, with an empty GOG_HOME and the file keyring. The stand-in is not Google:

    main,   series ID:   PATCH instance (recurrence + summary), PATCH ser1 (UNTIL)        exit 0
    main,   instance ID: PATCH instance (recurrence + summary), PATCH instance (UNTIL)    exit 0
    branch, series ID:   PATCH instance (recurrence + summary), PATCH ser1 (UNTIL)        exit 0
    branch, instance ID: PATCH instance (recurrence + summary), PATCH ser1 (UNTIL)        exit 0
    
  • make ci passed locally (macOS arm64, go1.27.3).

Boundary: no live Google Calendar was used. This change only makes the instance-ID path send the same requests the series-ID path already sends; it does not change how --scope future splits a series.

🤖 Generated with Claude Code

calendar update --scope future resolves an instance ID to its series,
but then truncated the recurrence of plan.EventID, the ID the user
passed. With an instance ID from calendar events or calendar search,
both PATCHes went to the instance and the original series kept every
later occurrence. Return the whole scope resolution from
applyUpdateScope and truncate ParentEventID, as calendar delete
--scope future does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Future-occurrence updates now truncate the resolved parent series when the user supplies an instance ID.

Example: Update ser1_20250102T100000Z with --scope future --original-start 2025-01-02T10:00:00Z.

  • Before: The truncation PATCH targets ser1_20250102T100000Z, leaving ser1 unchanged.
  • After: The truncation PATCH targets ser1 with UNTIL=20250102T095959Z.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with sufficient CLI transport proof, useful regression coverage, and no remaining findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Contributor-supplied built-CLI traces exercise the production Calendar transport against a local HTTP stand-in on macOS arm64, showing instance-ID truncation moving to ser1 while the series-ID control stays correct; this establishes request targeting, not Google-side series splitting.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updating future occurrences using an instance ID leaves the original series' later occurrences intact.
Reason: This restores the existing instance-ID contract without adding flags, changing defaults, or expanding scope.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main Calendar targeting bug with a focused change; the earlier changelog finding is resolved and no actionable defects remain.

Priority: P2
Reviewed head: bdca5656c4dac1e903449c0ca443cc8900a063be

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Calendar update command resolves an event and recurrence scope, patches the selected instance, and truncates the parent series through the Google Calendar client.

flowchart TD
  A[Calendar update command] --> B[Update plan]
  B --> C[Shared scope resolver]
  C --> D[Instance update]
  C --> E[Parent truncation]
  D --> F[Google Calendar client]
  E --> F
Loading

Technical review

Best possible solution:

Preserve the shared scope result through the update command and truncate its parent series, as this PR does.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically sends truncation to the supplied instance ID; the contributor also supplies failing-main and passing-branch CLI traces against a local HTTP stand-in.

Is this the best way to solve the issue?

The patch repairs the lost parent ID using the existing shared resolver and preserves the established series-ID path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31.

Provenance checked

  • Instance-ID recurring scope keeps the original intent (feat(calendar): improve parity for recurrence, availability, and selection #319: Allow single and future edit/delete operations to accept recurring-instance IDs.)
  • Shared scope result keeps the original intent (f1d355b: Share recurring scope resolution between update and delete, including the parent series ID.)
  • Update request planning keeps the original intent (fd4b03f: Extract update request planning while retaining scoped mutation behavior.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f1d355b adds internal/cmd/calendar_recurrence_scope.go:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f1d355bfa7e4; files: internal/cmd/calendar_recurrence_scope.go)
  • salmonumbrella: Raw commit bc6d342 adds internal/cmd/calendar_edit.go:633 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc6d342e6095; files: internal/cmd/calendar_edit.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Change distribution Production +9/-5; tests +98/-3; changelog +2 The small production fix has command-level HTTP regression coverage for instance input and a series-ID control.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A supported Calendar update path truncates the wrong event, with impact limited to future-scope updates using instance IDs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-08T15:15:42.562Z sha 7b93c37 :: needs changes before merge. :: [P3] Add the required PR reference to the changelog entry

Reviewed November 8, 2026, 2:19 PM ET / 19:19 UTC (Revision 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saariuslystoned

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
@steipete

Copy link
Copy Markdown
Collaborator

Thank you for the fix. I reproduced the claim and consolidated truncating the parent event series for future-instance updates into #1336, with regression coverage and your coauthor credit retained. The full make ci gate, built-CLI checks for the new request-validation fixes, and exact-head GitHub CI passed. Closing this PR as superseded by the merged implementation in #1336.

@steipete steipete closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants