Add product workflow and API preview - #30
Conversation
|
Warning Review limit reached
Next review available in: 14 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (22)
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 |
| await saveSpec(pending); | ||
| if (revision === autosaveRevision) saveStatus.set('saved'); |
There was a problem hiding this comment.
Stale autosaves overwrite newer revisions
An autosave that has already entered saveSpec(pending) is not cancelled or prevented from committing when a later manual save completes. If the older request resolves last, it writes its stale snapshot over the newer revision in storage; reopening the document then loses the recent edits. Serialize writes or make persistence reject stale revisions, rather than using autosaveRevision only to gate the status indicator.
Artifacts
Controlled autosave and manual-save race harness
- Vitest harness that holds an older autosave and a newer manual save independently, completes the newer save first, then completes the older autosave to inspect persisted state—the takeaway is that the test deterministically exercises the claimed stale-write ordering.
Autosave race execution output
- Captured successful Vitest output shows persisted state changing from "Newer manual save" to "Older autosave snapshot" when the older autosave finishes last—the takeaway is that the stale autosave overwrites the later manual save.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/editorSession.ts
Line: 107-108
Comment:
**Stale autosaves overwrite newer revisions**
An autosave that has already entered `saveSpec(pending)` is not cancelled or prevented from committing when a later manual save completes. If the older request resolves last, it writes its stale snapshot over the newer revision in storage; reopening the document then loses the recent edits. Serialize writes or make persistence reject stale revisions, rather than using `autosaveRevision` only to gate the status indicator.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (!current || typeof current !== 'object' || !(segment in current)) return false; | ||
| current = (current as Record<string, unknown>)[segment]; |
There was a problem hiding this comment.
Prototype properties resolve as local references
segment in current follows the prototype chain, so otherwise-invalid local references such as #/constructor and #/toString are treated as resolved and omitted from diagnostics. Require an own property at each segment, such as with Object.hasOwn(current, segment), before advancing the traversal.
Artifacts
Focused inherited local-reference reproduction harness
- A Vitest harness invokes `validateDocument` with otherwise-valid minimal OpenAPI documents containing `#/constructor` and `#/toString`, establishing the expected unresolved-reference diagnostics.
Observed inherited local-reference validation output
- Executed Vitest output shows both references returned empty diagnostics and failed the expected unresolved-reference assertions, proving inherited prototype segments are incorrectly accepted.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/validation.ts
Line: 38-39
Comment:
**Prototype properties resolve as local references**
`segment in current` follows the prototype chain, so otherwise-invalid local references such as `#/constructor` and `#/toString` are treated as resolved and omitted from diagnostics. Require an own property at each segment, such as with `Object.hasOwn(current, segment)`, before advancing the traversal.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Agent: This follow-up completes the product-quality and developer-experience work added after the original editor-completion pull request merged.
What changed
Verification
pnpm checkpnpm test— 5 files, 10 testspnpm lintpnpm build/,/info,/servers,/authentication,/paths,/components,/webhooks,/review, and/previewall returned HTTP 200Greptile Summary
This change introduces editor-session workflows including autosave, manual save, draft recovery, history controls, validation, review tooling, navigation, and API preview. Two correctness issues were verified: a delayed autosave can overwrite a newer manual save, and invalid local references targeting inherited object properties are not surfaced as diagnostics. These issues should be resolved before merge to prevent lost specification edits and incomplete validation feedback.
Confidence Score: 3/5
Not merge-safe until the two verified P1 correctness issues are fixed.
There are two independent P1 findings and neither is security-related, which results in a score of 3 under the required scoring table.
Files Needing Attention: src/lib/editorSession.ts needs write ordering or stale-write rejection; src/lib/validation.ts needs own-property checks during local reference traversal.
What T-Rex did
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: add interactive API preview" | Re-trigger Greptile