Compare commits

...

15 Commits

Author SHA1 Message Date
6fc4282536 chore: Bump version to 0.3.31
All checks were successful
Build SilverBullet Plug / build (push) Successful in 39s
2026-02-20 13:26:57 -08:00
0a3b5aeaba chore(conductor): Mark track 'Fix RRULE object mapping' as complete 2026-02-20 13:26:57 -08:00
12c417c506 conductor(plan): Mark phase 'Verification & Cleanup' as complete 2026-02-20 13:26:57 -08:00
ca727c83d2 conductor(checkpoint): Checkpoint end of Phase 3 2026-02-20 13:26:57 -08:00
f922f59145 conductor(plan): Mark regression check as complete 2026-02-20 13:26:57 -08:00
be74e906d2 conductor(plan): Mark phase 'Fix Implementation' as complete 2026-02-20 13:26:57 -08:00
10d334c732 conductor(checkpoint): Checkpoint end of Phase 2 2026-02-20 13:26:57 -08:00
9499dbffb2 conductor(plan): Mark fix implementation task as complete 2026-02-20 13:26:57 -08:00
9ea6f7961e fix(icalendar): Correctly map verbose RRULE keys to standard iCal keys 2026-02-20 13:26:57 -08:00
7cc59ff5f9 conductor(plan): Mark phase 'Reproduction' as complete 2026-02-20 13:26:57 -08:00
974c75f01b conductor(checkpoint): Checkpoint end of Phase 1 2026-02-20 13:26:57 -08:00
dcaf4d36a5 conductor(plan): Mark reproduction task as complete 2026-02-20 13:26:57 -08:00
150fe04410 test(icalendar): Reproduce Unknown RRULE property error 2026-02-20 13:26:57 -08:00
6b621083b9 chore(conductor): Add new track 'Fix RRULE object mapping' 2026-02-20 13:26:57 -08:00
4237fcfd30 chore(conductor): Archive track 'Fix recurring meetings visibility' 2026-02-20 13:26:57 -08:00
14 changed files with 96 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
---
name: Library/sstent/icalendar
version: "0.3.30"
version: "0.3.31"
tags: meta/library
files:
- icalendar.plug.js

View File

@@ -14,5 +14,5 @@ This file tracks all major tracks for the project. Each track has its own detail
---
- [x] **Track: Fix issue where recurring meetings are not showing up.**
*Link: [./tracks/fix_recurring_visibility_20260219/](./tracks/fix_recurring_visibility_20260219/)*
- [x] **Track: Fix RRULE object expansion error by correctly mapping object keys to standard iCalendar RRULE properties.**
*Link: [./tracks/fix_rrule_object_mapping_20260219/](./tracks/fix_rrule_object_mapping_20260219/)*

View File

@@ -0,0 +1,5 @@
# Track fix_rrule_object_mapping_20260219 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View File

@@ -0,0 +1,8 @@
{
"track_id": "fix_rrule_object_mapping_20260219",
"type": "bug",
"status": "new",
"created_at": "2026-02-19T00:00:00Z",
"updated_at": "2026-02-19T00:00:00Z",
"description": "Fix RRULE object expansion error by correctly mapping object keys to standard iCalendar RRULE properties."
}

View File

@@ -0,0 +1,19 @@
# Implementation Plan - Fix RRULE Object Mapping
## Phase 1: Reproduction [checkpoint: 2fbb260]
- [x] Task: Reproduce `Unknown RRULE property` error 0b67cbb
- [x] Modify the test case in `icalendar_test.ts` to use `frequency` instead of `freq` in the mock object.
- [x] Run the test and confirm it fails with the expected error.
- [x] Task: Conductor - User Manual Verification 'Reproduction' (Protocol in workflow.md)
## Phase 2: Fix Implementation [checkpoint: fe28a5c]
- [x] Task: Implement mapping logic in `icalendar.ts` b8bc6cc
- [x] Create a mapping object for verbose keys to iCal keys.
- [x] Update `expandRecurrences` to use this mapping.
- [x] Run the test to confirm it passes.
- [x] Task: Conductor - User Manual Verification 'Fix Implementation' (Protocol in workflow.md)
## Phase 3: Verification & Cleanup [checkpoint: 793326a]
- [x] Task: Full Regression Check 7f9a618
- [x] Run all tests in `icalendar_test.ts`.
- [x] Task: Conductor - User Manual Verification 'Verification & Cleanup' (Protocol in workflow.md)

View File

@@ -0,0 +1,32 @@
# Specification: Fix RRULE Object Expansion Error
## Overview
The previous fix for handling object-type `rrule` properties (returned by `ts-ics`) introduced a regression. The conversion logic used uppercase full names (e.g., `FREQUENCY`), but the `rrule` library's `parseString` method expects standard iCalendar shortened keys (e.g., `FREQ`). This results in an `Error: Unknown RRULE property 'FREQUENCY'`.
## Functional Requirements
- **Correct Key Mapping:** The logic that converts an `rrule` object back to a string must use standard iCalendar RRULE property keys.
- **Mapping Table:**
- `frequency` -> `FREQ`
- `until` -> `UNTIL`
- `count` -> `COUNT`
- `interval` -> `INTERVAL`
- `bysecond` -> `BYSECOND`
- `byminute` -> `BYMINUTE`
- `byhour` -> `BYHOUR`
- `byday` -> `BYDAY`
- `bymonthday` -> `BYMONTHDAY`
- `byyearday` -> `BYYEARDAY`
- `byweekno` -> `BYWEEKNO`
- `bymonth` -> `BYMONTH`
- `bysetpos` -> `BYSETPOS`
- `wkst` -> `WKST`
- **Case Insensitivity:** The mapping should be case-insensitive for the input object keys.
## Implementation Steps
1. **Reproduce:** Update the existing `expandRecurrences - object rrule` test case to use the key `frequency` and verify it fails with the reported error.
2. **Fix:** Implement a mapping function in `icalendar.ts` to translate object keys to standard RRULE keys before stringifying.
3. **Verify:** Run the test case to confirm it now passes.
## Acceptance Criteria
- [ ] Test `expandRecurrences - object rrule` passes with an object using `frequency` key.
- [ ] No "Unknown RRULE property" errors are logged for valid RRULE objects.

View File

@@ -1,6 +1,6 @@
{
"name": "icalendar-plug",
"version": "0.3.30",
"version": "0.3.31",
"nodeModulesDir": "auto",
"tasks": {
"sync-version": "deno run -A scripts/sync-version.ts",

View File

@@ -1,5 +1,5 @@
name: icalendar
version: 0.3.30
version: 0.3.31
author: sstent
index: icalendar.ts
# Legacy SilverBullet permission name

View File

@@ -3,11 +3,32 @@ import { convertIcsCalendar } from "https://esm.sh/ts-ics@2.4.0";
import { RRule, RRuleSet } from "rrule";
import { getUtcOffsetMs, resolveIanaName } from "./timezones.ts";
const VERSION = "0.3.30";
const VERSION = "0.3.31";
const CACHE_KEY = "icalendar:lastSync";
console.log(`[iCalendar] Plug script executing at top level (Version ${VERSION})`);
/**
* Mapping of verbose RRULE object keys to standard iCalendar shortened keys.
*/
const RRULE_KEY_MAP: Record<string, string> = {
"frequency": "FREQ",
"until": "UNTIL",
"count": "COUNT",
"interval": "INTERVAL",
"bysecond": "BYSECOND",
"byminute": "BYMINUTE",
"byhour": "BYHOUR",
"byday": "BYDAY",
"bymonthday": "BYMONTHDAY",
"byyearday": "BYYEARDAY",
"byweekno": "BYWEEKNO",
"bymonth": "BYMONTH",
"bysetpos": "BYSETPOS",
"wkst": "WKST",
"freq": "FREQ", // Just in case
};
// ============================================================================
// Utility Functions
// ============================================================================
@@ -163,7 +184,10 @@ export function expandRecurrences(icsEvent: any, windowDays = 365): any[] {
} else if (typeof rruleStr === "object" && rruleStr !== null) {
// Handle object rrule (e.g. from ts-ics) by converting back to string
cleanRule = Object.entries(rruleStr)
.map(([k, v]) => `${k.toUpperCase()}=${v}`)
.map(([k, v]) => {
const standardKey = RRULE_KEY_MAP[k.toLowerCase()] || k.toUpperCase();
return `${standardKey}=${v}`;
})
.join(";");
} else {
console.warn(`[iCalendar] Invalid rrule type (${typeof rruleStr}) for event "${icsEvent.summary || "Untitled"}". Treating as non-recurring.`);

View File

@@ -182,7 +182,7 @@ Deno.test("expandRecurrences - object rrule (Reproduction of missing events)", (
const icsEvent = {
summary: "Object RRULE Event",
start: startStr,
rrule: { freq: "WEEKLY", byday: "MO" } // Simulating object rrule
rrule: { frequency: "WEEKLY", byday: "MO" } // Simulating object rrule with verbose key
};
// Spy on console.warn