Repository navigation
chore: remove unused memories-created quota/limit (display-only) - #7426
Conversation
… Sentry captures Transient network/socket errors (offline, timeouts, dropped connections, cancellations) and high-frequency repeated errors (per-frame ffmpeg writes, per-cycle assistant failures, DB-constraint loops) dominated Sentry event volume without being actionable. logError now drops non-actionable transient network/IO errors and collapses identical errors via a digit-normalized key to ~one capture per 5-minute window. Local file logs + breadcrumbs unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The screenshots.imagePath column is NOT NULL, but the model field is optional (nil for video-based screenshots). Coalesce nil to empty string on insert so a video screenshot never trips a NOT NULL constraint violation. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…threshold Extend the transient-network exception filter to the full set of offline/timeout/ dropped-connection codes (NSURLError + NSPOSIX), drop backend Gemini key-expiry noise (a server config issue, not a per-client bug), and raise appHangTimeoutInterval to 3s so only sustained freezes users feel are reported. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…nsert fix Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Greptile SummaryNote: The PR title and description reference removing a memories-created quota from the Flutter app and backend, but the actual diff contains only desktop macOS Swift changes — Sentry noise reduction and a database constraint fix. The description appears to belong to a different PR. The desktop changes add transient-error filtering and a 5-minute dedup window to
Confidence Score: 3/5The Sentry filtering changes are safe, but the imagePath coalesce fix needs a matching guard in the delete path before this is fully correct. The nil to empty-string coalesce in insertScreenshot means video-based screenshots are now inserted successfully, but deleteScreenshot(id:) reads imagePath back as Optional of empty string (non-nil), so RewindViewModel's if-let binds the empty string and calls deleteScreenshot with an empty relativePath. Foundation's appendingPathComponent with an empty string resolves to the screenshots directory root; fileExists returns true for directories so removeItem could target that root. RewindIndexer already stores imagePath as empty string directly so this path pre-existed, but insertScreenshot now adds a second trigger for the same condition. desktop/Desktop/Sources/Rewind/Core/RewindDatabase.swift — the imagePath coalesce fix needs a corresponding guard in the delete path; desktop/Desktop/Sources/Logger.swift — dedup map cap logic. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[logError called] --> B[Write to local log + breadcrumb]
B --> C{isNonActionableTransient?}
C -- Yes --> D[Return — local log only]
C -- No --> E{shouldCaptureToSentry?}
E -- No, within 5-min window --> F[Return — deduplicated]
E -- Yes --> G[SentrySDK.capture]
G --> H{beforeSend filter in OmiApp}
H -- Transient network or Gemini key error --> I[Return nil — dropped]
H -- Pass --> J[Event sent to Sentry]
K[insertScreenshot with nil imagePath] --> L[Coalesce nil to empty string]
L --> M[SQLite INSERT succeeds]
M --> N[deleteScreenshot reads imagePath as Optional empty string]
N --> O{if let imagePath = result.imagePath}
O -- binds empty string, passes nil guard --> P[deleteScreenshot relativePath empty string]
P --> Q[appendingPathComponent empty string]
Q --> R[Potential: references screenshots directory root]
Reviews (1): Last reviewed commit: "chore(desktop): changelog for Sentry noi..." | Re-trigger Greptile |
| // Bound the map so it can't grow unbounded over a long session. | ||
| if sentryLastCaptured.count > 500 { | ||
| let cutoff = now.addingTimeInterval(-sentryDedupWindow) | ||
| sentryLastCaptured = sentryLastCaptured.filter { $0.value > cutoff } | ||
| } |
There was a problem hiding this comment.
Dedup-map cap is ineffective during rapid error bursts
When more than 500 unique error keys are generated within a single 5-minute window, sentryLastCaptured.count > 500 triggers the cleanup, but filter { $0.value > cutoff } keeps every entry that is still inside the dedup window — meaning all recently added entries survive and the map is not pruned at all. In a high-error scenario (e.g. a tight loop emitting 600 distinct messages), the cap never actually limits growth. Consider evicting by LRU or removing the oldest half unconditionally when count > 500 rather than relying on a time-window filter that can be a no-op.
| // The `imagePath` column is NOT NULL in the schema, but the model field is | ||
| // optional (nil for video-based screenshots). Coalesce nil → "" so a video | ||
| // screenshot never trips a NOT NULL constraint violation on insert. | ||
| if record.imagePath == nil { record.imagePath = "" } |
There was a problem hiding this comment.
The coalesce
nil → "" now means row["imagePath"] as String? in deleteScreenshot(id:) returns Optional("") (non-nil) for every video-based screenshot. RewindViewModel then calls RewindStorage.deleteScreenshot(relativePath: ""). Foundation's appendingPathComponent("") resolves to the directory root itself — fileManager.fileExists returns true for directories, so removeItem would attempt to delete the screenshots directory root. Add a guard in RewindStorage.deleteScreenshot or in RewindViewModel's delete handler to skip empty paths.
| if record.imagePath == nil { record.imagePath = "" } | |
| if record.imagePath == nil || record.imagePath!.isEmpty { record.imagePath = "" } |
Re-do of #7426, which merged the wrong commit and did not actually land these changes. ## Why The mobile app showed a "5,000 memories created this month" quota bar, but nothing enforced it — display-only. Removing it everywhere. ## Changes **Backend**: drop `PlanLimits.memories_created` + `memories_created_used`/`_limit` from `UserSubscriptionResponse` and all plumbing; remove `BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH` from all 4 helm charts. **App**: remove the quota progress bar, the `memoriesCreated*` subscription fields (+ regenerated `subscription.g.dart`), and the `memoriesUsedThisMonth` l10n key across all 49 locales (+ regenerated localizations). **Kept**: the `memories_created` usage metric and the usage-history graph line (real analytics). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Why
The mobile app showed a "5,000 memories created this month" quota bar, but nothing enforced it — the limit was display-only. Removing it everywhere.
Changes
Backend
PlanLimits.memories_createdandmemories_created_used/_limitfromUserSubscriptionResponse+ all the plumbing that set/computed them.BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTHfrom all 4 helm charts.App
memoriesCreated/memoriesCreatedUsed/memoriesCreatedLimitfrom the subscription model (+ regeneratedsubscription.g.dart).memoriesUsedThisMonthl10n key across all 49 locales (+ regenerated localizations).Kept: the
memories_createdusage metric and the "memories created" line in the usage history graph (real analytics).Verification
flutter analyzeclean (one pre-existing unrelated lint);flutter gen-l10nzero untranslated warnings.test_subscription_planspasses. The other failing subscription/sync tests reproduce on cleanmain(pre-existing).🤖 Generated with Claude Code