You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/rules/main-rules.mdc
+20-26Lines changed: 20 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,17 @@ alwaysApply: true
7
7
8
8
# Code Changes
9
9
10
-
Non-test code changes are now permitted for:
10
+
This is a legacy codebase (2016) with a robust test suite added in 2024-25.
11
+
12
+
**Permitted without confirmation:**
11
13
- Bug fixes with corresponding test coverage
12
14
- Refactoring with existing test coverage
13
15
- Removal of deprecated features (QuietHours, CalendarEditor)
14
16
15
-
For new features or significant changes, add tests first.
16
-
17
-
Previously the name of this rule was
18
-
19
-
dont change any non test code without getting confirmation first
20
-
21
-
and its body:
22
-
23
-
dont change any non test code without getting confirmation first. this is a very old application I'm working on making a thorough test suite for before making any changes.
24
-
25
-
now the test suite is a lot more robust we've relaxed the rule a bit but still be cognizant of it
17
+
**Requires tests first:**
18
+
- New features or significant changes
26
19
20
+
When in doubt, add tests first.
27
21
28
22
# Work to make tests as faithful to the real code as possible
29
23
@@ -32,34 +26,34 @@ its ok to mock out core android apis that the instrumentation testsuite doesn't
32
26
33
27
# Don't try to boil the ocean. Dont try to make big sweeping changes when more focused ones will do
34
28
35
-
Always think of the minimum viable solution to a problem or change to make. make sure that works and then build on top of it. break things down into small testable pieces first. That said NO CHEATING! I.e. don't comment out or skip a test to solve a problem unless its just a temporary bandaid while working on something more important.
29
+
Always think of the minimum viable solution to a problem or change to make. make sure that works and then build on top of it. break things down into small testable pieces first. That said
30
+
31
+
**NO CHEATING!** I.e. don't comment out or skip a test to solve a problem unless its just a temporary bandaid while working on something more important.
36
32
37
33
# keep all code implementations as consise as possible.
38
34
39
35
Everything it needs nothing it doesn't. Every new line of code is one that potentially doesn't work 😄
40
36
41
37
42
-
# Please check the documentation if you are implementing something potentially complex or nonstandard.
38
+
# Check documentation if implementing something potentially complex or nonstandard.
43
39
44
-
often there are things we've learned already i.e.
40
+
See `docs/README.md` for the full documentation index. often there are things we've learned already i.e.
45
41
46
-
docs/dev_completed/constructor-mocking-android.md
42
+
**Key references:**
47
43
48
-
documents how through a lot work an reserch we learned
44
+
- `docs/dev_completed/constructor-mocking-android.md` - **MockK limitations**: `mockkStatic`, `mockkConstructor`, and `anyConstructed` almost always fail in Android instrumentation tests. Use dependency injection patterns instead.
49
45
50
-
mockKStatic, mockConstructor and anyConstructed ALMOST ALWAYS FAIL. And aren't worth trying anymore where there are better alternatives.
46
+
- `docs/architecture/calendar_monitoring.md` - Deep detail on how calendar monitoring works (EVENT_REMINDER broadcasts, manual rescans, etc.)
51
47
52
-
also
48
+
- `docs/architecture/clock_implementation.md` - How `CNPlusClockInterface` enables testable time-dependent code
53
49
54
-
docs/calendar_monitoring.md
55
50
56
-
goes into DEEP detail about how calendar monitoring works in the app
51
+
# Copyright Headers
57
52
53
+
For new or updated copyright headers, use:
58
54
59
-
# any new or updated copyright headers please attribute to
60
-
55
+
```
61
56
Copyright (C) 2025 William Harris (wharris+cnplus@upscalews.com)
57
+
```
62
58
63
-
William inherited the application from Sergey Parshin
64
-
65
-
so any time you see the need to update those or create new ones please attribute to William
59
+
(William inherited the application from Sergey Parshin in 2020)
Note: The CalendarMonitorService uses a wake lock during the rescan process to ensure reliable operation, especially when processing calendar changes and firing events.
C -->|Parameters:<br/>start_delay=2000<br/>rescan_monitor=true<br/>reload_calendar=true<br/>user_action_until=0| D[CalendarMonitorService.onHandleIntent]
176
+
B --> C["Intent: CalendarMonitorService<br/>(start_delay=2000, rescan_monitor=true,<br/>reload_calendar=true, user_action_until=0)"]
177
+
C --> D[CalendarMonitorService.onHandleIntent]
163
178
164
179
D --> E[CalendarMonitor.onRescanFromService]
165
180
E --> F[CalendarMonitorManual.scanNextEvent]
166
181
167
-
F --> G[CalendarProvider.getEventAlertsForInstancesRange]
182
+
F --> G[calendarProvider.getEventAlertsForInstancesInRange]
168
183
F --> H[filterAndMergeAlerts]
169
184
H --> I[MonitorStorage.getAlertsForInstanceStartRange]
170
185
H --> J[Update MonitorStorage]
@@ -175,15 +190,16 @@ flowchart TD
175
190
M[Time advances past reminder time] --> N[ManualEventAlarmBroadcastReceiver]
176
191
N --> O[CalendarMonitor.onAlarmBroadcast]
177
192
178
-
O --> P{Check timing condition<br/>nextEventFireFromScan <br/> currentTime + ALARM_THRESHOLD}
193
+
O --> P{nextEventFireFromScan < currentTime + ALARM_THRESHOLD?}
179
194
P -->|true| Q[manualFireEventsAt_NoHousekeeping]
180
195
181
196
Q --> R[MonitorStorage.getAlertsAt]
182
197
Q --> S[registerFiredEventsInDB]
183
198
S --> T[ApplicationController.registerNewEvents]
184
199
Q --> U[markAlertsAsHandledInDB]
185
200
186
-
V[CalendarMonitorService final intent] -->|Parameters:<br/>alert_time=reminderTime<br/>rescan_monitor=true<br/>reload_calendar=false<br/>start_delay=0| D
201
+
U --> V[afterCalendarEventFired]
202
+
V --> W["launchRescanService<br/>(rescan_monitor=true, reload_calendar=true)"]
187
203
```
188
204
189
205
## Additional Calendar Monitoring Triggers
@@ -192,6 +208,7 @@ Besides the two main flows above, the Calendar Monitor can be triggered through
0 commit comments