feat(dashboard): recover business context edits and preserve team priorities - #766
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
The latest updates on your projects. Learn more about Unkey Deploy
|
|
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 |
2e8cc1c to
a156aec
Compare
Greptile SummaryThis PR makes organization business-context editing recoverable and revision-aware while carrying structured team priorities into Insights.
Confidence Score: 4/5The behavioral changes appear sound, but the explicit repository requirements concerning nested ternaries and focusable non-interactive elements must be satisfied before merging. No blocking correctness or security failure remains; the accepted findings are limited to two concrete repository-rule violations in the editor’s UI implementation. Files Needing Attention: apps/dashboard/app/(main)/organizations/components/business-context-editor.tsx Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Editor[Business context editor] --> Recovery[Per-user and organization session draft]
Editor --> Save[Revision-checked save]
Editor --> Cancel[Cancel AI draft]
Editor --> Restore[Restore retained version]
Save --> Profile[Current organization profile]
Restore --> Profile
Profile --> History[Last five saved versions]
Profile --> Context[Attributed investigation context]
Context --> Team[Team priorities and definitions]
Context --> Background[Team, website, or mixed brief]
Team --> Insights[Insights selection and investigation]
Background --> Insights
Reviews (1): Last reviewed commit: "fix(dashboard): protect newer context dr..." | Re-trigger Greptile |
| {canEdit | ||
| ? "Reading your website and preparing a draft. You can keep writing." | ||
| ? generation?.status === "queued" | ||
| ? "Waiting to start. You can keep writing." | ||
| : "Reading your website and preparing a draft. You can keep writing. Saving ends this generation." | ||
| : "An updated brief is being prepared."} |
There was a problem hiding this comment.
Nested ternaries obscure states
The new generation status uses nested ternaries, and the dialog title and description repeat this pattern. This violates the repository directive, “Don't use nested ternary expressions.” Extract named display values or use straightforward conditional logic. This repository requirement must be satisfied before merging.
Context Used: Ultracite Rules - AI-Ready Formatter and Linter (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| {review === "generation" | ||
| <Dialog.Title | ||
| render={(props) => ( | ||
| <h2 {...props} ref={reviewTitleRef} tabIndex={-1}> |
There was a problem hiding this comment.
Heading made programmatically focusable
The dialog renders a non-interactive h2 with tabIndex={-1} and targets it with initialFocus. This violates the repository directive, “Don't assign tabIndex to non-interactive HTML elements.” Use a focus target supported by the dialog primitive instead. This repository requirement must be satisfied before merging.
Context Used: Ultracite Rules - AI-Ready Formatter and Linter (source)
The three-case present-context follow-up stayed at 16/18 on the small manual rubric, still missed the targeted emitter attribution, and increased words by 7.3%. Remove the extra rule and its tests rather than retaining prompt growth without a demonstrated benefit. Preserve the original attributed-assertions guidance and reference-budget fallback. The small fixture context again matches the original paired run byte for byte. This reverses the rule from 7aa476d after rebasing onto merged parent #766.
* feat(ai): deliver canonical organization context to chat agents * feat(ai): deliver structured team context and mixed provenance * fix(ai): attribute team-defined event and success meanings once * fix(ai): preserve business assertions when references exceed budget * revert(ai): drop ineffective event-attribution prompt rule The three-case present-context follow-up stayed at 16/18 on the small manual rubric, still missed the targeted emitter attribution, and increased words by 7.3%. Remove the extra rule and its tests rather than retaining prompt growth without a demonstrated benefit. Preserve the original attributed-assertions guidance and reference-budget fallback. The small fixture context again matches the original paired run byte for byte. This reverses the rule from 7aa476d after rebasing onto merged parent #766.
Business context edits now survive navigation and reload. AI drafts can be permanently discarded or cancelled, and the last five saved versions can be reviewed as a diff and restored without silently overwriting a teammate's newer save.
Three optional team inputs—priority, success definition, and exclusions—survive regeneration and reach investigations as team assertions. Manual brief rewrites clear stale citations, while saved history preserves the original text and sources. Save and restore events record the correct organization, actor, and outcome in the audit log. Recovery clearing is guarded against late saves after navigation, failed browser storage cannot replace newer in-memory drafts, and explicit saved-version selection dismisses competing AI drafts. The context budget preserves a maximum-size brief plus all team inputs without increasing ordinary runs.
Validation: root lint and 33/33 workspace typecheck tasks; 23 isolated PostgreSQL tests; 8 RPC authorization/audit tests; 54 context-boundary tests plus the worker regressions; 10 browser regressions against a synthetic local database. No schema migration or customer data changes.
Scope: organization business context editing and its existing insight input contract. Parallel follow-ups add canonical context to chat and supplied-context attribution to investigation details. Generation scheduling reliability is separately reviewed in #765. AI-assisted implementation, reviewed and tested by Codex for the maintainer.