fix(insights): validate saved definitions and retire obsolete investigations - #776
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
9c5524e to
2d0754f
Compare
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryThis PR validates effective measurement-plan bindings during saves and retires obsolete retention investigations only after transactional ownership, definition, and observation checks.
Confidence Score: 5/5The final head appears safe to merge, with all previous findings resolved and no remaining actionable defects identified. The Redis teardown now closes and clears the real cache client, root watch and coverage commands consistently exclude integration suites, and the two earlier rule violations remain fixed. The retirement path verifies the canonical saved definition and exact latest observation under transaction locks before resolving a case, while persistence fences protect the stale transition from older and equal-snapshot writes. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Load due retention observation] --> B[Attempt remeasurement]
B -->|Measured| C[Continue with measured signal]
B -->|Not measured in production| D[Lock organization and website]
D --> E{Saved definition still matches?}
E -->|Yes or unavailable| F[Keep investigation due]
E -->|No| G[Lock matching open investigation]
G --> H{Exact observation is still latest?}
H -->|No| F
H -->|Yes| I[Resolve investigation as stale]
I --> J[Append quiet non-published history]
J --> K[Invalidate insight and agent caches]
Reviews (3): Last reviewed commit: "test(insights): close test resources and..." | Re-trigger Greptile |
|
@greptileai Please re-review the current final head |
|
@greptileai Please re-review final head |
Business-context saves could preserve invalid website bindings when callers omitted measurement plans. Editing or removing an activation/return definition also left its old investigation permanently due.
Validate the effective plans inside the existing save transaction. During discovery, retire an obsolete due case only after locking and verifying the current organization, website, explicit saved definitions, and exact latest observation. Record it as stale with a quiet history entry that explicitly says recovery was not measured. Preserve unknown, failed, insufficient, and future measurements; a label-only rename remains measurable. The retirement marker blocks older and equal-snapshot writes from reopening the case on both persistence paths, while later measured work for a restored definition can reopen it.
Also apply the existing measurement-card typography utilities and document a merge gate requiring completed final-head reviews and resolved feedback. Addresses all three review comments on #775. No schema or model/prompt changes. AI-assisted maintainer contribution.
Validation: root lint and all 33 workspace typecheck tasks passed; 41 service integration tests and 29 persisted lifecycle tests passed against isolated synthetic PostgreSQL and real local Redis cache invalidation; 59 related insights unit/source tests passed. Four stale-binding cases, six definition-retirement cases, and four equal-snapshot writes were reproduced failing before their fixes. Independent review cleared the final patch, including concurrent retirement, parallel detector reads, and later definition restoration.
Scope: measurement definition saves, lifecycle, and the associated review feedback. Rebased onto current staging after #777; no unmerged dependency.
Integration tests exercise real local Redis invalidation and close both PostgreSQL and Redis during teardown. Root watch/coverage and package unit commands select integration suites externally; native watch/coverage selector checks verify a unit-test control runs while this database suite is excluded.