Skip to content

doc generation#81

Merged
arul28 merged 2 commits intomainfrom
ade/doc-generation-ee96fad9
Mar 24, 2026
Merged

doc generation#81
arul28 merged 2 commits intomainfrom
ade/doc-generation-ee96fad9

Conversation

@arul28
Copy link
Owner

@arul28 arul28 commented Mar 23, 2026

Summary by CodeRabbit

  • New Features

    • Added a pending generation state and recording of run metadata (requestedAt, source, event, reason, provider, modelId, reasoningEffort).
  • Improvements

    • UI shows progress for both pending and running generations and suppresses missing-docs banners while active.
    • Idle records with a finished timestamp map to succeeded.
    • Docs readiness now requires a minimum size threshold.
  • Tests

    • Added tests covering pending/running transitions, manual vs auto runs, and legacy status mapping.

@mintlify
Copy link

mintlify bot commented Mar 23, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ade-ac1c6011 🟢 Ready View Preview Mar 23, 2026, 3:55 AM

@vercel
Copy link

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ade Ready Ready Preview, Comment Mar 24, 2026 4:52am

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Warning

Rate limit exceeded

@arul28 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d465dc54-8674-428a-aed0-35597235e4ca

📥 Commits

Reviewing files that changed from the base of the PR and between 4a89230 and ab2bbeb.

📒 Files selected for processing (7)
  • apps/desktop/src/main/services/context/contextDocBuilder.ts
  • apps/desktop/src/main/services/context/contextDocService.test.ts
  • apps/desktop/src/main/services/context/contextDocService.ts
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx
  • apps/desktop/src/renderer/components/settings/ContextSection.tsx
  • apps/desktop/src/shared/types/packs.ts
📝 Walkthrough

Walkthrough

Adds richer, persisted context-doc generation metadata (requestedAt, source, event, reason, provider, modelId, reasoningEffort), introduces "pending" and "succeeded" states, refactors generation flows to record and merge run metadata, and updates tests and UI to treat "pending" as an active generation state.

Changes

Cohort / File(s) Summary
Type definitions
apps/desktop/src/shared/types/packs.ts
Added ContextDocGenerationSource and ContextDocGenerationEvent; expanded ContextDocGenerationStatus.state to include pending and succeeded; added nullable metadata fields (requestedAt, source, event, reason, provider, modelId, reasoningEffort).
Context service & builder
apps/desktop/src/main/services/context/contextDocService.ts, apps/desktop/src/main/services/context/contextDocBuilder.ts
Extended persisted status read/write shape to include new metadata; normalized legacy/unknown values; added buildGenerationStatus() and GenerationRunMeta; refactored generate flow into generateDocsInternal + metadata wrapper, wrote pending/running with metadata, preserved metadata on terminal writes, and added settle/revert logic for unrun pending states.
Tests
apps/desktop/src/main/services/context/contextDocService.test.ts
Added createDeferred<T>() test helper and three tests validating lifecycle and metadata persistence for auto-refresh (pending→running→succeeded), manual generate, and legacy idlesucceeded mapping.
Renderer / UI
apps/desktop/src/renderer/components/app/AppShell.tsx, apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx, apps/desktop/src/renderer/components/settings/ContextSection.tsx
Treat pending as active alongside running; added isContextGenerationActive() and source description helpers; updated polling, banners, UI messages, and docs-ready check (now requires sizeBytes >= 200).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

desktop

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'doc generation' is vague and generic, using non-descriptive terms that fail to convey the specific nature of the substantial changes across multiple files. Use a more descriptive title that captures the main change, such as 'Add pending state and metadata tracking to doc generation status' or 'Track generation lifecycle with pending state and auto-refresh metadata'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/doc-generation-ee96fad9

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/desktop/src/renderer/components/settings/ContextSection.tsx (2)

239-244: Minor inefficiency: describeGenerationSource called twice.

The function is called once for the condition check and again for string interpolation. Consider storing the result in a variable.

♻️ Suggested optimization
 {isContextGenerationActive(docsStatus?.generation) ? (
-  <div style={{ fontFamily: SANS_FONT, fontSize: 11, color: COLORS.info, padding: "8px 12px", borderRadius: 8, background: `${COLORS.info}08`, border: `1px solid ${COLORS.info}18` }}>
-    Context docs are being generated. This may take a minute depending on your model and project size.
-    {describeGenerationSource(docsStatus?.generation) ? ` ${describeGenerationSource(docsStatus?.generation)}` : ""}
-  </div>
+  (() => {
+    const sourceDesc = describeGenerationSource(docsStatus?.generation);
+    return (
+      <div style={{ fontFamily: SANS_FONT, fontSize: 11, color: COLORS.info, padding: "8px 12px", borderRadius: 8, background: `${COLORS.info}08`, border: `1px solid ${COLORS.info}18` }}>
+        Context docs are being generated. This may take a minute depending on your model and project size.
+        {sourceDesc ? ` ${sourceDesc}` : ""}
+      </div>
+    );
+  })()
 ) : null}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/renderer/components/settings/ContextSection.tsx` around
lines 239 - 244, Store the result of
describeGenerationSource(docsStatus?.generation) in a local variable (e.g.,
generationSource) and use that variable both for the truthy check and for the
string interpolation inside the JSX; update the conditional that currently uses
isContextGenerationActive(docsStatus?.generation) and the inner interpolation to
reference the saved generationSource so describeGenerationSource is called only
once and the value is reused.

49-66: Consider extracting shared helpers.

The isContextGenerationActive function is duplicated from ProjectSetupPage.tsx. Consider extracting both helpers to a shared utility file (e.g., lib/contextUtils.ts) to maintain DRY principles and ensure consistent behavior.

♻️ Example shared utility
// lib/contextUtils.ts
import type { ContextStatus } from "../../shared/types";

export function isContextGenerationActive(
  status: ContextStatus["generation"] | null | undefined
): boolean {
  return status?.state === "pending" || status?.state === "running";
}

export function describeGenerationSource(
  status: ContextStatus["generation"] | null | undefined
): string | null {
  if (!status || !isContextGenerationActive(status)) return null;
  if (status.source !== "auto") return null;
  // ... switch cases
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/renderer/components/settings/ContextSection.tsx` around
lines 49 - 66, Extract the duplicated helpers isContextGenerationActive and
describeGenerationSource into a shared utility module (e.g., contextUtils.ts)
and replace the local implementations in ContextSection.tsx and
ProjectSetupPage.tsx with imports from that module; ensure the exported
functions keep the same signatures and behavior (including the switch cases in
describeGenerationSource and the status?.state checks in
isContextGenerationActive) so callers can simply import {
isContextGenerationActive, describeGenerationSource } and use them unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/desktop/src/renderer/components/settings/ContextSection.tsx`:
- Around line 239-244: Store the result of
describeGenerationSource(docsStatus?.generation) in a local variable (e.g.,
generationSource) and use that variable both for the truthy check and for the
string interpolation inside the JSX; update the conditional that currently uses
isContextGenerationActive(docsStatus?.generation) and the inner interpolation to
reference the saved generationSource so describeGenerationSource is called only
once and the value is reused.
- Around line 49-66: Extract the duplicated helpers isContextGenerationActive
and describeGenerationSource into a shared utility module (e.g.,
contextUtils.ts) and replace the local implementations in ContextSection.tsx and
ProjectSetupPage.tsx with imports from that module; ensure the exported
functions keep the same signatures and behavior (including the switch cases in
describeGenerationSource and the status?.state checks in
isContextGenerationActive) so callers can simply import {
isContextGenerationActive, describeGenerationSource } and use them unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fcd0eddd-5d8a-4191-b159-f5b2ef718dc1

📥 Commits

Reviewing files that changed from the base of the PR and between dc4ced8 and 55f6c0b.

📒 Files selected for processing (7)
  • apps/desktop/src/main/services/context/contextDocBuilder.ts
  • apps/desktop/src/main/services/context/contextDocService.test.ts
  • apps/desktop/src/main/services/context/contextDocService.ts
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx
  • apps/desktop/src/renderer/components/settings/ContextSection.tsx
  • apps/desktop/src/shared/types/packs.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx`:
- Around line 74-75: The helper hasReadyContextDocs currently uses
status?.docs?.every(...), which returns true for empty arrays and thus wrongly
reports readiness when status.docs is []; update hasReadyContextDocs to first
check that status?.docs exists and has length > 0, then apply docs.every(doc =>
doc.exists && doc.sizeBytes >= 200) so empty arrays are treated as not ready;
modify the function that takes (status: ContextStatus | null) accordingly and
ensure any callers (e.g., the UI branch around "Both docs are present") rely on
the updated helper.

In `@apps/desktop/src/renderer/components/settings/ContextSection.tsx`:
- Around line 239-243: The UI currently treats docsStatus?.generation with state
"pending" as already "being generated"; update the user-facing copy to branch on
generation.state instead of using isContextGenerationActive for messaging: when
docsStatus?.generation?.state === "pending" show "queued" or "starting" wording
(e.g., "Context docs are queued and will start shortly"), and only show "being
generated"/"generating…" when docsStatus?.generation?.state === "running" (use
describeGenerationSource for extra context). Apply the same change in
ProjectSetupPage where generation status text is shown so polling/disable logic
can keep using "pending" but the displayed text reflects "queued" vs "running".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b63621cc-d763-4568-a7df-1f0cee72a866

📥 Commits

Reviewing files that changed from the base of the PR and between 55f6c0b and 036d998.

📒 Files selected for processing (7)
  • apps/desktop/src/main/services/context/contextDocBuilder.ts
  • apps/desktop/src/main/services/context/contextDocService.test.ts
  • apps/desktop/src/main/services/context/contextDocService.ts
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx
  • apps/desktop/src/renderer/components/settings/ContextSection.tsx
  • apps/desktop/src/shared/types/packs.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/desktop/src/main/services/context/contextDocBuilder.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/main/services/context/contextDocService.test.ts
  • apps/desktop/src/shared/types/packs.ts
  • apps/desktop/src/main/services/context/contextDocService.ts

@arul28 arul28 force-pushed the ade/doc-generation-ee96fad9 branch from 4a89230 to ab2bbeb Compare March 24, 2026 04:52
@arul28 arul28 merged commit 59647ff into main Mar 24, 2026
9 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant