Skip to content

Import upstream quality fixes#6

Merged
Jay1 merged 4 commits into
mainfrom
feature/upstream-quality-imports
May 25, 2026
Merged

Import upstream quality fixes#6
Jay1 merged 4 commits into
mainfrom
feature/upstream-quality-imports

Conversation

@Jay1

@Jay1 Jay1 commented May 24, 2026

Copy link
Copy Markdown
Owner
  • Avoid duplicate checkpoint existence checks
  • Add Windows shell coverage for provider updates
  • Test idempotent theme DOM application

What Changed

Why

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Summary by CodeRabbit

  • Bug Fixes

    • Provider updates on Windows now execute correctly through the system shell.
  • New Features

    • Theme export utility exposed for reuse and a new depth preview added to theme editor.
    • Expanded theme variables including app-depth tokens and Catppuccin palette support.
  • UI / Styling

    • Updated composer, sidebar, toast, diff card, and timeline styling to new surface/state tokens.
  • Tests

    • Added/updated tests for Windows provider updates, theme application no-op behavior, and checkpoint diff logic.
  • Documentation

    • Added upstream quality imports and Catppuccin theme-depth plans and specs.

Review Change Stack

- Avoid duplicate checkpoint existence checks
- Add Windows shell coverage for provider updates
- Test idempotent theme DOM application
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Jay1, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 42 minutes and 31 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dd286fe6-c2eb-4083-a9be-7614c188a372

📥 Commits

Reviewing files that changed from the base of the PR and between 197f29b and 83eada2.

📒 Files selected for processing (2)
  • docs/superpowers/specs/2026-05-24-catppuccin-theme-depth-design.md
  • packages/shared/src/terminalThreads.ts
📝 Walkthrough

Walkthrough

This PR adds idempotent theme application and app-depth token generation, ensures provider update commands run through a shell on Windows (tests), optimizes a checkpoint diff hot-path existence check, wires UI components to new app surface tokens, and provides design/planning docs.

Changes

Upstream Quality Imports

Layer / File(s) Summary
Theme idempotent DOM synchronization
apps/web/src/hooks/useTheme.ts, apps/web/src/hooks/useTheme.test.ts
applyThemeState is exported and tested to be idempotent: re-applying identical theme state does not emit extra DOM writes.
Provider update Windows shell execution (tests)
apps/server/src/provider/Layers/ProviderHealth.test.ts
Process-spawn test helper captures ChildProcess.CommandOptions; tests override process.platform safely and assert provider update on win32 spawns with shell: true.
Checkpoint diff hot-path optimization
apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts, apps/server/src/checkpointing/Layers/CheckpointDiffQuery.test.ts
For adjacent turns, compute a turn-start ref and mark fromCheckpointExists to avoid an extra hasCheckpointRef lookup; update test expectation for reduced call count.
App-depth theme variables & tests
apps/web/src/theme/theme.logic.ts, apps/web/src/theme/theme.logic.test.ts, apps/web/src/index.css
Add Catppuccin palette and buildAppDepthVariables, emit app-depth --app-* CSS variables, and add tests verifying token generation and propagation.
ThemePackEditor depth preview
apps/web/src/components/ThemePackEditor.tsx
Import buildThemeCssVariables, compute depthPreview via useMemo, and render a surface depth preview UI block.
Chat composer & MessagesTimeline restyling
apps/web/src/components/ChatView.tsx, apps/web/src/components/chat/MessagesTimeline.tsx
Switch composer, queued follow-up, placeholder, and diff-card styling to use new --app-* surface and hover tokens.
Sidebar row styling and tests
apps/web/src/components/Sidebar.logic.ts, apps/web/src/components/Sidebar.logic.test.ts
Unify selected/active row styling, add left-border placeholder and focus variable, and update tests to expect --app-state-selected/--app-state-selected-border.
Toast surface helper
apps/web/src/components/ui/toast.tsx
Introduce resolveToastSurfaceClass(type) and use it for stacked and anchored toast root backgrounds.
Index CSS: composer-surface & app tokens
apps/web/src/index.css
Add --app-* custom properties for surfaces, states, statuses, diffs, and accents; redefine --composer-surface with --app-surface-composer and set composer border-color.
Routes sidebar gap opacity tweak
apps/web/src/routes/_chat.tsx
Adjust SIDEBAR_GAP_CLASS overlay opacity with after:opacity-80.
Design & implementation docs
docs/superpowers/*2026-05-24-*.md
Add upstream-quality-imports plan and Catppuccin theme-depth spec with goals, non-goals, acceptance criteria, and file/task maps.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

size:XXL

Poem

🐰 I hopped through tokens, shells, and diffs so neat,
Applied a theme once — no DOM repeat.
On Windows I nudged a spawn to wear a shell,
Checkpoints whisper “exists” and tests now tell.
nibbles a carrot, then does a little twirl

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lists three specific changes but provides no elaboration on what changed, why, or UI impact. Template sections for these critical details remain unpopulated, and the checklist is entirely unchecked. Populate the 'What Changed', 'Why', and 'UI Changes' sections with details explaining the three listed improvements. Check off applicable checklist items once completed.
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Import upstream quality fixes' is clear, concise, and accurately summarizes the main objective of the PR: importing upstream quality improvements into the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 feature/upstream-quality-imports

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.

@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
apps/server/src/provider/Layers/ProviderHealth.test.ts (1)

892-964: ⚡ Quick win

Consolidate duplicated updateProvider Windows-shell regression tests.

These two describe("updateProvider") blocks validate the same behavior and should be merged into a single focused regression test to keep this suite lean and easier to maintain.

✂️ Suggested consolidation
-  describe("updateProvider", () => {
-    it.effect("runs provider update commands through a shell on Windows", () => {
-      const calls: Array<{
-        args: ReadonlyArray<string>;
-        command: string;
-        shell: ChildProcess.CommandOptions["shell"];
-      }> = [];
-
-      return withProcessPlatform(
-        "win32",
-        Effect.gen(function* () {
-          const providerHealth = yield* ProviderHealth;
-          const result = yield* providerHealth.updateProvider({ provider: "cursor" });
-
-          assert.strictEqual(result.providers.length, 0);
-          assert.deepStrictEqual(calls, [
-            {
-              args: ["update"],
-              command: "agent",
-              shell: true,
-            },
-          ]);
-        }),
-      ).pipe(
-        Effect.provide(ProviderHealthLive),
-        Effect.provide(
-          mockSpawnerLayer((args, command, options) => {
-            calls.push({ args, command, shell: options.shell });
-            return { stdout: "", stderr: "update failed", code: 1 };
-          }),
-        ),
-        Effect.provide(ServerSettingsService.layerTest()),
-        Effect.provide(ServerConfig.layerTest(process.cwd(), { prefix: "jcode-provider-health-" })),
-      );
-    });
-  });
-
   describe("updateProvider", () => {
     it.effect("runs provider update commands through a shell on Windows", () => {
       const calls: Array<{
         command: string;
         args: ReadonlyArray<string>;
         shell: ChildProcess.CommandOptions["shell"];
       }> = [];
 
       return withProcessPlatform(
         "win32",
         Effect.gen(function* () {
           const providerHealth = yield* ProviderHealth;
-          yield* providerHealth.updateProvider({ provider: "cursor" });
+          const result = yield* providerHealth.updateProvider({ provider: "cursor" });
+          assert.strictEqual(result.providers.length, 0);
         }).pipe(
           Effect.provide(ProviderHealthLive),
           Effect.provide(ServerSettingsService.layerTest()),
           Effect.provide(
             ServerConfig.layerTest(process.cwd(), { prefix: "jcode-provider-health-" }),
           ),
           Effect.provide(
             mockSpawnerLayer((args, command, options) => {
               calls.push({ command, args, shell: options.shell });
               return { stdout: "", stderr: "update failed\n", code: 1 };
             }),
           ),
         ),
       ).pipe(
         Effect.tap(() =>
           Effect.sync(() => {
             assert.deepStrictEqual(calls, [{ command: "agent", args: ["update"], shell: true }]);
           }),
         ),
       );
     });
   });

As per coding guidelines: "apps/server/src/**/*.test.{ts,tsx}: Prefer focused regression tests beside the behavior being changed".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server/src/provider/Layers/ProviderHealth.test.ts` around lines 892 -
964, There are two duplicated Windows-shell regression tests for updateProvider;
consolidate them into one focused test by removing the redundant describe/it
block and keeping a single test that uses withProcessPlatform("win32"), obtains
ProviderHealth, calls updateProvider({ provider: "cursor" }), and asserts the
spawn call via mockSpawnerLayer; update the kept test to import/use
ProviderHealthLive, mockSpawnerLayer, ServerSettingsService.layerTest(),
ServerConfig.layerTest(...), and ensure the assertion checks calls contain {
command: "agent", args: ["update"], shell: true } so only one clear test remains
for updateProvider.
docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md (1)

94-94: 💤 Low value

Clarify "resolved provider environment" term.

Line 94 mentions "Provider update commands run with resolved provider environment" but this term is not defined in the document. The design slices mention shell: true on Windows but don't explicitly define what "resolved provider environment" means. Consider adding a brief clarification or linking to where this is defined.

💡 Suggested clarification
-- [ ] Provider update commands run with resolved provider environment and are tested.
+- [ ] Provider update commands run through a shell on Windows (with resolved provider environment) and are tested.

Or add a footnote/definition in the "Slice 2: Provider Update Windows Shell" section explaining what "resolved provider environment" encompasses.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md` at line
94, Define "resolved provider environment" where it's referenced by adding a
concise definition or footnote that explains what it includes (e.g., merged env
vars from provider config, secrets, platform overrides, and any path/shell
adaptations), and either inline near "Provider update commands" or in the "Slice
2: Provider Update Windows Shell" section; update the sentence "- [ ] Provider
update commands run with resolved provider environment and are tested." to link
to or reference that definition so readers know exactly which variables and
shell behaviors are applied when running provider update commands.
docs/superpowers/plans/2026-05-24-upstream-quality-imports.md (2)

9-9: 💤 Low value

Consider using markdown link syntax for cross-document reference.

Line 9 references the design spec as a plain path. Using markdown link syntax would make navigation easier for readers.

🔗 Proposed link syntax
-- `docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`: approved design for the import tranche.
+- [`docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`](../specs/2026-05-24-upstream-quality-imports-design.md): approved design for the import tranche.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-05-24-upstream-quality-imports.md` at line 9,
Replace the plain path reference
'`docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`' in
docs/superpowers/plans/2026-05-24-upstream-quality-imports.md with a Markdown
link (e.g., [Upstream quality imports
design](docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md))
so the design spec becomes clickable; update the exact line that currently
contains the backticked path to use the link syntax and keep the existing
label/description text for clarity.

1-6: ⚡ Quick win

Consider adding a metadata table for consistency.

The design spec document includes a metadata table with Status, Type, Owner, Audience, Canonical path, Last reviewed, Review cadence, and Source of truth. Adding a similar table to this implementation plan would improve consistency and provide helpful context. As per coding guidelines, keep metadata tables current when adding or substantially changing a document.

📋 Proposed metadata table
 # Upstream Quality Imports Implementation Plan
 
+| Field           | Value                                                                           |
+| --------------- | ------------------------------------------------------------------------------- |
+| Status          | Draft                                                                           |
+| Type            | Implementation plan                                                             |
+| Owner           | Engineering                                                                     |
+| Audience        | Maintainers and automation agents                                               |
+| Canonical path  | `docs/superpowers/plans/2026-05-24-upstream-quality-imports.md`                 |
+| Last reviewed   | 2026-05-24                                                                      |
+| Review cadence  | Event-driven; review when implementation tasks change or blockers are resolved  |
+| Source of truth | `docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`          |
+
 > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-05-24-upstream-quality-imports.md` around lines 1
- 6, Add a standard metadata table to the top of the "Upstream Quality Imports
Implementation Plan" document (immediately under the title/header) containing
the fields Status, Type, Owner, Audience, Canonical path, Last reviewed, Review
cadence, and Source of truth; populate with sensible defaults (e.g., Draft,
Implementation Plan, owner name or team, intended audience, canonical path
placeholder, today's date or Unknown, cadence like "annually", and link/source),
use a markdown table for consistency, and include a short note in the doc header
to update these fields whenever the document is added to or substantially
changed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-05-24-upstream-quality-imports.md`:
- Around line 35-39: Update the checklist to replace ambiguous/manual items with
precise references: point the typecheck entries to the actual scripts in
apps/web/package.json and apps/server/package.json (use the existing "typecheck"
npm scripts), change the fmt check entry to state how the root package.json's
"fmt:check" (oxfmt --check) is invoked with a files list (i.e., show how
<touched files> are passed through to oxfmt), and either add the exact aikido
command/config location or explicitly mark it as an external/manual step with
where it runs; similarly replace "Run LSP diagnostics for touched TypeScript
files" with the concrete command/tool or mark it as an IDE/manual step and link
to its config.

In `@docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`:
- Line 12: The spec's "Source of truth" line references a non-existent path
`.jcode/upstream-watch/state.json` (and missing `.jcode/` dir); open
docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md and either
(A) replace the `.jcode/upstream-watch/state.json` entry with an existing
canonical artifact (e.g., the actual upstream-state file or another doc used as
canonical) while keeping `docs/jcode-operating-model.md`, or (B) add the missing
`.jcode/upstream-watch/state.json` (and parent `.jcode/` dir) with the expected
state schema so the original reference is valid; ensure the "Source of truth"
line lists only paths that actually exist and match
`docs/jcode-operating-model.md` and/or the new state file name you choose.
- Around line 20-28: The spec references upstream PR/version IDs without a
source-grounding file; update the spec text in the referenced document to either
(a) replace bare IDs like "DPCode v0.0.49 / PR `#129`" and "T3Code
`#2760/`#2779/#2781/#2794/#2792/#2780/#2791" with direct links to the
corresponding upstream PRs/versions (use full URLs to each upstream PR or
release), or (b) change the references to point to the actual in-repo
upstream-watch state file that exists (instead of the missing
.jcode/upstream-watch/state.json) and include the exact filename that is present
in the repo, so the PR/ID claims are provably source-grounded; ensure the
updated lines clearly show either the upstream URL(s) or the correct in-repo
state file reference.

---

Nitpick comments:
In `@apps/server/src/provider/Layers/ProviderHealth.test.ts`:
- Around line 892-964: There are two duplicated Windows-shell regression tests
for updateProvider; consolidate them into one focused test by removing the
redundant describe/it block and keeping a single test that uses
withProcessPlatform("win32"), obtains ProviderHealth, calls updateProvider({
provider: "cursor" }), and asserts the spawn call via mockSpawnerLayer; update
the kept test to import/use ProviderHealthLive, mockSpawnerLayer,
ServerSettingsService.layerTest(), ServerConfig.layerTest(...), and ensure the
assertion checks calls contain { command: "agent", args: ["update"], shell: true
} so only one clear test remains for updateProvider.

In `@docs/superpowers/plans/2026-05-24-upstream-quality-imports.md`:
- Line 9: Replace the plain path reference
'`docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`' in
docs/superpowers/plans/2026-05-24-upstream-quality-imports.md with a Markdown
link (e.g., [Upstream quality imports
design](docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md))
so the design spec becomes clickable; update the exact line that currently
contains the backticked path to use the link syntax and keep the existing
label/description text for clarity.
- Around line 1-6: Add a standard metadata table to the top of the "Upstream
Quality Imports Implementation Plan" document (immediately under the
title/header) containing the fields Status, Type, Owner, Audience, Canonical
path, Last reviewed, Review cadence, and Source of truth; populate with sensible
defaults (e.g., Draft, Implementation Plan, owner name or team, intended
audience, canonical path placeholder, today's date or Unknown, cadence like
"annually", and link/source), use a markdown table for consistency, and include
a short note in the doc header to update these fields whenever the document is
added to or substantially changed.

In `@docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md`:
- Line 94: Define "resolved provider environment" where it's referenced by
adding a concise definition or footnote that explains what it includes (e.g.,
merged env vars from provider config, secrets, platform overrides, and any
path/shell adaptations), and either inline near "Provider update commands" or in
the "Slice 2: Provider Update Windows Shell" section; update the sentence "- [ ]
Provider update commands run with resolved provider environment and are tested."
to link to or reference that definition so readers know exactly which variables
and shell behaviors are applied when running provider update commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f3d02c7-f7b7-4c85-8d0c-0bb45044b1b1

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd6881 and 2e01bc1.

📒 Files selected for processing (7)
  • apps/server/src/checkpointing/Layers/CheckpointDiffQuery.test.ts
  • apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts
  • apps/server/src/provider/Layers/ProviderHealth.test.ts
  • apps/web/src/hooks/useTheme.test.ts
  • apps/web/src/hooks/useTheme.ts
  • docs/superpowers/plans/2026-05-24-upstream-quality-imports.md
  • docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md

Comment thread docs/superpowers/plans/2026-05-24-upstream-quality-imports.md Outdated
Comment thread docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md Outdated
Comment thread docs/superpowers/specs/2026-05-24-upstream-quality-imports-design.md Outdated
@Jay1 Jay1 self-assigned this May 24, 2026
Jay1 added 2 commits May 24, 2026 19:57
- Clarify upstream quality import verification and source references
- Add Catppuccin theme depth design and implementation plan
- Remove duplicate Windows provider update test block
@github-actions github-actions Bot added size:XL and removed size:L labels May 25, 2026
@Jay1 Jay1 merged commit 4f2bc91 into main May 25, 2026
8 checks passed
@Jay1 Jay1 deleted the feature/upstream-quality-imports branch May 25, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant