Skip to content

update workpool demo page - #218

Merged
ianmacartney merged 4 commits into
mainfrom
ian/batch-workpool-demo
Aug 1, 2026
Merged

ianmacartney merged 4 commits into
mainfrom
ian/batch-workpool-demo

Conversation

@ianmacartney

Copy link
Copy Markdown
Member

update staticHosting

update dashboard example

update static hosting setup

@ianmacartney
ianmacartney requested a review from reeceyang July 24, 2026 23:13

ianmacartney commented Jul 24, 2026 •

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianmacartney ianmacartney changed the title update staticHosting update workpool demo page Jul 24, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/workpool/@convex-dev/workpool@218

commit: 1408876

Copy link
Copy Markdown
Member Author

not critical to review

@ianmacartney
ianmacartney marked this pull request as ready for review July 24, 2026 23:14
@ianmacartney
ianmacartney changed the base branch from ian/batch-try-catch-actions to graphite-base/218 July 25, 2026 00:05
@ianmacartney
ianmacartney force-pushed the ian/batch-workpool-demo branch from 422ba4e to c6d271a Compare July 25, 2026 00:05
@ianmacartney
ianmacartney changed the base branch from graphite-base/218 to main July 25, 2026 00:05
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The example dashboard now supports baseline/current workload comparisons and current-only runs. It selects matching historical runs, stores comparison state in the URL, displays metrics and charts, and lists recent runs. Run records now include scheduled-function counts. New backend actions execute comparison workloads and resolve run IDs. A capture script counts scheduled functions and stores the result. Static hosting now mounts at /, and the example documentation reflects the new dashboard and deployment flow.

Sequence Diagram(s)

sequenceDiagram
  participant Dashboard
  participant ConvexActions
  participant Workpool
  participant RunStore
  Dashboard->>ConvexActions: submit baseline/current scenario
  ConvexActions->>Workpool: execute workload on selected pool
  Workpool->>RunStore: create completed run
  ConvexActions->>RunStore: resolve run IDs
  RunStore-->>Dashboard: return run metadata and metrics
Loading

Possibly related PRs

  • get-convex/workpool#200: Introduced the dashboard, benchmark infrastructure, and static-hosting modules modified here.

Suggested reviewers: reeceyang

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change to the workpool demo page.
Description check ✅ Passed The description identifies the static hosting and dashboard example updates covered by the changeset.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ian/batch-workpool-demo

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.

@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: 9

🧹 Nitpick comments (8)
example/src/App.css (1)

43-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The focus outline is faint.

The focus ring uses rgba(22, 160, 133, 0.25) over a light background. Keyboard users may not see which control has focus. Raise the opacity or use a solid color.

♿ Proposed change
-  outline: 3px solid rgba(22, 160, 133, 0.25);
+  outline: 3px solid `#16a085`;
   outline-offset: 2px;
🤖 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 `@example/src/App.css` around lines 43 - 48, Update the focus-visible rule for
button, select, and textarea to use a more visible focus outline by increasing
the current teal color’s opacity or replacing it with a solid color, while
preserving the existing outline width and offset.
scripts/capture-scheduled-functions.mjs (1)

9-15: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

execFileSync("npx", ...) fails on Windows.

execFileSync does not resolve npx.cmd, so the script throws ENOENT on Windows. Add shell: true if contributors run this script on Windows.

♻️ Proposed portability fix
 function convex(args) {
   return execFileSync("npx", ["convex", ...args], {
     cwd: new URL("..", import.meta.url),
     encoding: "utf8",
     stdio: ["ignore", "pipe", "inherit"],
+    shell: process.platform === "win32",
   }).trim();
 }
🤖 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 `@scripts/capture-scheduled-functions.mjs` around lines 9 - 15, Update the
execFileSync invocation in convex to include shell: true in its options,
allowing npx to resolve through npx.cmd on Windows while preserving the existing
command arguments, working directory, encoding, and stdio settings.
example/src/App.tsx (3)

929-940: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Give the action column a header name.

<th /> produces an empty header cell. Screen readers announce no name for the compare-button column. Add visually hidden text or an aria-label.

♿ Proposed fix
-              <th />
+              <th><span className="sr-only">Actions</span></th>
🤖 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 `@example/src/App.tsx` around lines 929 - 940, Update the final action-column
header in the table’s thead to provide an accessible name for the compare-button
column, using visually hidden text or an aria-label on the existing empty th
while leaving the other headers unchanged.

505-524: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

cumulativeAt depends on ordering and scans every point.

The reduce keeps the pct of the last point with ms <= ms. That result is correct only if latencyCdf returns points sorted by ascending ms. The memo also runs the reduce once per distinct timestamp for both series, which is quadratic in the number of CDF points. Sort each series once, then walk both with an index pointer.

🤖 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 `@example/src/App.tsx` around lines 505 - 524, Update the cdfData useMemo and
its cumulativeAt logic to sort each oldCdf/currentCdf series by ascending ms
once, then compute cumulative values with an advancing index pointer rather than
reducing every point for each timestamp. Preserve the merged, numerically sorted
timestamp output and the existing baseline/current percentage semantics.

493-503: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Stop computing unread throughput state.

throughputOverTime emits contiguous time buckets from each run start, so throughputData remains index-aligned. currentInFlight is built here but the chart only reads baseline/current; remove it.

🤖 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 `@example/src/App.tsx` around lines 493 - 503, Update the throughputData
useMemo in App by removing the unused currentInFlight property from each
generated data point, while preserving the index-aligned baseline and current
throughput values and existing dependency behavior.
example/convex/test/run.ts (1)

124-139: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

The fixed 20-run window can miss the target run.

latestRunForPoolSince scans only the 20 newest runs. A run created by runComparison is normally within that window. If concurrent scenarios or a scenario that writes several run documents push the target out of the window, the query returns null and the calling action throws. Filter by pool and time in the query instead of post-filtering a fixed page.

♻️ Proposed narrowing
-    const runs = await ctx.db.query("runs").order("desc").take(20);
-    return (
-      runs.find(
-        (run) =>
-          run.startTime >= args.since && (run.pool ?? "new") === args.pool,
-      )?._id ?? null
-    );
+    const runs = await ctx.db.query("runs").order("desc").take(100);
+    return (
+      runs
+        .filter(
+          (run) =>
+            run.startTime >= args.since && (run.pool ?? "new") === args.pool,
+        )
+        .sort((a, b) => b.startTime - a.startTime)[0]?._id ?? null
+    );
🤖 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 `@example/convex/test/run.ts` around lines 124 - 139, Update
latestRunForPoolSince to apply the pool and startTime filters in the database
query before selecting the newest run, rather than limiting an unfiltered query
to 20 records and post-filtering. Return the matching run ID or null while
preserving the existing pool default behavior.
example/src/index.css (1)

1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Respect prefers-reduced-motion for smooth scrolling.

Smooth scrolling applies to every user. Users who request reduced motion can experience discomfort from the animated jump that scrollIntoView triggers in example/src/App.tsx. Gate the rule on the media query.

♿ Proposed change
-html {
-  scroll-behavior: smooth;
+@media (prefers-reduced-motion: no-preference) {
+  html {
+    scroll-behavior: smooth;
+  }
 }
🤖 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 `@example/src/index.css` around lines 1 - 3, Update the html scroll-behavior
rule in the stylesheet to apply smooth scrolling only within a
prefers-reduced-motion media query that indicates reduced motion is not
requested; preserve the default behavior for users who request reduced motion.
src/component/stats.ts (1)

217-250: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Link scheduledFunctionsInRange to the capture script or remove it.

scheduledFunctionsInRange has no callers except its own definition. scripts/capture-scheduled-functions.mjs still runs the same take(1001)/overflow logic as an --inline-query, so the query can drift. Use the exported query from the script or delete the duplicate export.

🤖 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 `@src/component/stats.ts` around lines 217 - 250, Remove the unused duplicate
scheduledFunctionsInRange query, or update
scripts/capture-scheduled-functions.mjs to invoke this exported query instead of
reimplementing the take(1001)/overflow logic; ensure only one implementation
remains authoritative.
🤖 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 `@example/convex/test/dashboard.ts`:
- Around line 241-248: The run lookup timestamps use a zero-tolerance boundary
that can reject valid runs due to clock differences. In
example/convex/test/dashboard.ts lines 241-248, subtract the established
tolerance from oldStartedAfter before passing it as since; apply the same
adjustment to startedAfter in runCurrent at lines 273-279, preserving the
existing run lookup behavior otherwise.

In `@example/README.md`:
- Around line 46-49: Update the production dashboard deployment flow documented
by the deploy:dashboard:prod command to use static-hosting’s build-aware upload
path, ensuring VITE_CONVEX_URL is set to the production deployment during the
build and the backend deploy runs before asset upload; keep the development
deploy flow unchanged.

In `@example/src/App.css`:
- Line 205: Remove the unnecessary quotes around SFMono-Regular in both
font-family declarations identified by the diff, while preserving the existing
fallback fonts and declaration order.
- Line 12: Update the text-rendering declaration in the App.css styles to use
the lowercase optimizelegibility keyword required by the configured
value-keyword-case rule, preserving the existing property and behavior.

In `@example/src/App.tsx`:
- Around line 369-371: Use scenarioKey as the single scenario-normalization
helper: keep the implementation at example/src/App.tsx lines 369-371 unchanged,
and at lines 579-581 replace both inline bare-only replacements in sameScenario
with a comparison of scenarioKey(oldRun.scenario) and
scenarioKey(currentRun.scenario).
- Around line 109-117: Update the useEffect handling comparison URL
synchronization so it explicitly clears the URL hash when ids.old is absent or
the comparison is otherwise inactive. Preserve the existing
`#compare/`<old>,<current> replacement when both ids are available, ensuring stale
hashes cannot remain after a current-only run.
- Around line 654-658: Update the summary paragraph in the baseline branch to
report both `current.completedCount` and the baseline run’s completed-task count
separately, rather than claiming the current count applies to both
implementations; keep the non-baseline message unchanged.
- Around line 708-719: Update the scheduled-functions metric flow in App.tsx to
represent the current-run pending state when current.scheduledFunctions is
undefined, providing an explanatory note instead of an unexplained em dash.
Ensure the metric type explicitly permits an optional note field if required,
run npm run typecheck, and add coverage for the transition before and after the
current value is captured.

In `@package.json`:
- Line 75: Update the static-hosting upgrade documentation or example
configuration associated with `@convex-dev/static-hosting` to cover the 0.2.0
migration: mention that existing assets must be re-uploaded with upload --prod
or migrated to component-owned storage, and account for the removal of
exposeUploadApi. Keep the pinned dependency version aligned with the documented
migration steps.

---

Nitpick comments:
In `@example/convex/test/run.ts`:
- Around line 124-139: Update latestRunForPoolSince to apply the pool and
startTime filters in the database query before selecting the newest run, rather
than limiting an unfiltered query to 20 records and post-filtering. Return the
matching run ID or null while preserving the existing pool default behavior.

In `@example/src/App.css`:
- Around line 43-48: Update the focus-visible rule for button, select, and
textarea to use a more visible focus outline by increasing the current teal
color’s opacity or replacing it with a solid color, while preserving the
existing outline width and offset.

In `@example/src/App.tsx`:
- Around line 929-940: Update the final action-column header in the table’s
thead to provide an accessible name for the compare-button column, using
visually hidden text or an aria-label on the existing empty th while leaving the
other headers unchanged.
- Around line 505-524: Update the cdfData useMemo and its cumulativeAt logic to
sort each oldCdf/currentCdf series by ascending ms once, then compute cumulative
values with an advancing index pointer rather than reducing every point for each
timestamp. Preserve the merged, numerically sorted timestamp output and the
existing baseline/current percentage semantics.
- Around line 493-503: Update the throughputData useMemo in App by removing the
unused currentInFlight property from each generated data point, while preserving
the index-aligned baseline and current throughput values and existing dependency
behavior.

In `@example/src/index.css`:
- Around line 1-3: Update the html scroll-behavior rule in the stylesheet to
apply smooth scrolling only within a prefers-reduced-motion media query that
indicates reduced motion is not requested; preserve the default behavior for
users who request reduced motion.

In `@scripts/capture-scheduled-functions.mjs`:
- Around line 9-15: Update the execFileSync invocation in convex to include
shell: true in its options, allowing npx to resolve through npx.cmd on Windows
while preserving the existing command arguments, working directory, encoding,
and stdio settings.

In `@src/component/stats.ts`:
- Around line 217-250: Remove the unused duplicate scheduledFunctionsInRange
query, or update scripts/capture-scheduled-functions.mjs to invoke this exported
query instead of reimplementing the take(1001)/overflow logic; ensure only one
implementation remains authoritative.
🪄 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: Repository: get-convex/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 62d69dee-f10f-4aba-a3ee-c90672beecca

📥 Commits

Reviewing files that changed from the base of the PR and between ead29f2 and 1408876.

⛔ Files ignored due to path filters (2)
  • example/convex/_generated/api.d.ts is excluded by !**/_generated/**
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (14)
  • eslint.config.js
  • example/README.md
  • example/convex/convex.config.ts
  • example/convex/http.ts
  • example/convex/schema.ts
  • example/convex/staticHosting.ts
  • example/convex/test/dashboard.ts
  • example/convex/test/run.ts
  • example/src/App.css
  • example/src/App.tsx
  • example/src/index.css
  • package.json
  • scripts/capture-scheduled-functions.mjs
  • src/component/stats.ts
💤 Files with no reviewable changes (1)
  • example/convex/http.ts

Comment on lines +241 to +248
const oldStartedAfter = Date.now();
await ctx.runAction(fn, { ...args, pool: "old" });
const oldRunId: Id<"runs"> | null = await ctx.runQuery(
internal.test.run.latestRunForPoolSince,
{ pool: "old", since: oldStartedAfter },
);
if (!oldRunId)
throw new Error("The baseline scenario did not create a run");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Both actions resolve the run with a zero-tolerance since boundary. Each action captures Date.now() and requires run.startTime >= since. The scenario records startTime from a different clock, so a valid run can be rejected and the action throws a misleading error.

  • example/convex/test/dashboard.ts#L241-L248: subtract a tolerance from oldStartedAfter before you pass it as since.
  • example/convex/test/dashboard.ts#L273-L279: apply the same tolerance to startedAfter in runCurrent.
📍 Affects 1 file
  • example/convex/test/dashboard.ts#L241-L248 (this comment)
  • example/convex/test/dashboard.ts#L273-L279
🤖 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 `@example/convex/test/dashboard.ts` around lines 241 - 248, The run lookup
timestamps use a zero-tolerance boundary that can reject valid runs due to clock
differences. In example/convex/test/dashboard.ts lines 241-248, subtract the
established tolerance from oldStartedAfter before passing it as since; apply the
same adjustment to startedAfter in runCurrent at lines 273-279, preserving the
existing run lookup behavior otherwise.

Comment thread example/README.md
Comment on lines 46 to 49
```sh
npm run deploy:dashboard # uploads to dev
npm run deploy:dashboard:prod # uploads to prod
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n '"deploy:dashboard(:prod)?"' package.json
rg -n 'envDir|VITE_CONVEX_URL' example
npm view `@convex-dev/static-hosting`@0.2.0 readme |
  rg -n 'upload --build|VITE_CONVEX_URL|deploy.*backend|upload.*dist'

Repository: get-convex/workpool

Length of output: 1728


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '--- example/README.md ---\n'
sed -n '1,70p' example/README.md

printf '\n--- example/vite.config.ts ---\n'
sed -n '1,80p' example/vite.config.ts

printf '\n--- package scripts around deploy ---\n'
sed -n '1,120p' package.json

printf '\n--- convex/static-hosting package refs ---\n'
rg -n '"`@convex-dev/static-hosting`"|static-hosting' package-lock.json package.json example/package.json .

Repository: get-convex/workpool

Length of output: 248


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- example/README.md ---'
sed -n '1,70p' example/README.md

printf '%s\n' ''
printf '%s\n' '--- example/vite.config.ts ---'
sed -n '1,80p' example/vite.config.ts

printf '%s\n' ''
printf '%s\n' '--- package scripts around deploy ---'
sed -n '1,120p' package.json

printf '%s\n' ''
printf '%s\n' '--- convex/static-hosting package refs ---'
rg -n '"`@convex-dev/static-hosting`"|static-hosting' package-lock.json package.json example/package.json .

Repository: get-convex/workpool

Length of output: 8424


Use the static-hosting build-aware deployment flow for deploy:dashboard:prod.

deploy:dashboard:prod now calls Vite directly and then runs static-hosting upload --prod. That build uses the repo-root .env.local; if it still contains VITE_CONVEX_URL for dev, the uploaded site connects to the dev deployment. @convex-dev/static-hosting@0.2.0 exposes upload --build, which builds with VITE_CONVEX_URL set; use that path or explicitly set VITE_CONVEX_URL before vite build, and deploy the backend before uploading assets.

🤖 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 `@example/README.md` around lines 46 - 49, Update the production dashboard
deployment flow documented by the deploy:dashboard:prod command to use
static-hosting’s build-aware upload path, ensuring VITE_CONVEX_URL is set to the
production deployment during the build and the backend deploy runs before asset
upload; keep the development deploy flow unchanged.

Comment thread example/src/App.css
"Segoe UI",
sans-serif;
font-synthesis: none;
text-rendering: optimizeLegibility;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stylelint fails on the text-rendering keyword case.

The configured value-keyword-case rule requires lowercase. CSS keywords are case-insensitive, so the change is safe.

🔧 Proposed fix
-  text-rendering: optimizeLegibility;
+  text-rendering: optimizelegibility;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
text-rendering: optimizeLegibility;
text-rendering: optimizelegibility;
🧰 Tools
🪛 Stylelint (17.14.1)

[error] 12-12: Expected "optimizeLegibility" to be "optimizelegibility" (value-keyword-case)

(value-keyword-case)

🤖 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 `@example/src/App.css` at line 12, Update the text-rendering declaration in the
App.css styles to use the lowercase optimizelegibility keyword required by the
configured value-keyword-case rule, preserving the existing property and
behavior.

Source: Linters/SAST tools

Comment thread example/src/App.css
textarea {
min-height: 190px;
resize: vertical;
font-family: "SFMono-Regular", Consolas, monospace;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stylelint rejects the quotes around SFMono-Regular.

The font-family-name-quotes rule requires no quotes for a name that needs none. Both declarations report the same error.

🔧 Proposed fix
-  font-family: "SFMono-Regular", Consolas, monospace;
+  font-family: SFMono-Regular, Consolas, monospace;

Also applies to: 571-571

🧰 Tools
🪛 Stylelint (17.14.1)

[error] 205-205: Expected no quotes around "SFMono-Regular" (font-family-name-quotes)

(font-family-name-quotes)

🤖 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 `@example/src/App.css` at line 205, Remove the unnecessary quotes around
SFMono-Regular in both font-family declarations identified by the diff, while
preserving the existing fallback fonts and declaration order.

Source: Linters/SAST tools

Comment thread example/src/App.tsx
Comment on lines +109 to +117
useEffect(() => {
if (ids.old && ids.current) {
window.history.replaceState(
null,
"",
`${window.location.pathname}${window.location.search}#compare/${ids.old},${ids.current}`,
);
}
return out;
}, [tA, tB]);

// Merge CDFs by ms axis: zip both sorted arrays into points with optional aPct/bPct.
const cdfData = useMemo(() => {
const aArr = cA ?? [];
const bArr = cB ?? [];
const points: Array<{ ms: number; aPct?: number; bPct?: number }> = [];
aArr.forEach((p) => points.push({ ms: p.ms, aPct: p.pct }));
bArr.forEach((p) => points.push({ ms: p.ms, bPct: p.pct }));
points.sort((x, y) => x.ms - y.ms);
return points;
}, [cA, cB]);
}, [ids]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear the hash when a comparison is not active.

The effect writes #compare/<old>,<current> only when both ids are set. After a current-only run, ids.old is null, so the previous hash stays in the URL. If the user reloads the page, readIdsFromHash restores the stale pair instead of the run that is displayed.

🐛 Proposed fix
   useEffect(() => {
+    const base = `${window.location.pathname}${window.location.search}`;
     if (ids.old && ids.current) {
       window.history.replaceState(
         null,
         "",
-        `${window.location.pathname}${window.location.search}`#compare/`${ids.old},${ids.current}`,
+        `${base}`#compare/`${ids.old},${ids.current}`,
       );
+    } else if (window.location.hash.startsWith("`#compare/`")) {
+      window.history.replaceState(null, "", base);
     }
   }, [ids]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
if (ids.old && ids.current) {
window.history.replaceState(
null,
"",
`${window.location.pathname}${window.location.search}#compare/${ids.old},${ids.current}`,
);
}
return out;
}, [tA, tB]);
// Merge CDFs by ms axis: zip both sorted arrays into points with optional aPct/bPct.
const cdfData = useMemo(() => {
const aArr = cA ?? [];
const bArr = cB ?? [];
const points: Array<{ ms: number; aPct?: number; bPct?: number }> = [];
aArr.forEach((p) => points.push({ ms: p.ms, aPct: p.pct }));
bArr.forEach((p) => points.push({ ms: p.ms, bPct: p.pct }));
points.sort((x, y) => x.ms - y.ms);
return points;
}, [cA, cB]);
}, [ids]);
useEffect(() => {
const base = `${window.location.pathname}${window.location.search}`;
if (ids.old && ids.current) {
window.history.replaceState(
null,
"",
`${base}`#compare/`${ids.old},${ids.current}`,
);
} else if (window.location.hash.startsWith("`#compare/`")) {
window.history.replaceState(null, "", base);
}
}, [ids]);
🤖 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 `@example/src/App.tsx` around lines 109 - 117, Update the useEffect handling
comparison URL synchronization so it explicitly clears the URL hash when ids.old
is absent or the comparison is otherwise inactive. Preserve the existing
`#compare/`<old>,<current> replacement when both ids are available, ensuring stale
hashes cannot remain after a current-only run.

Comment thread example/src/App.tsx
Comment on lines +369 to +371
function scenarioKey(scenario: string): string {
return scenario.replace(/-(old|new)-(bare|oc)$/, "");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Two different regexes normalize the same scenario name. scenarioKey strips -(old|new)-(bare|oc)$, but the sameScenario check strips only -(old|new)-bare$. A pair of -oc runs is linked by findCounterpart and then flagged with the "different scenarios" warning.

  • example/src/App.tsx#L369-L371: keep scenarioKey as the single normalization helper.
  • example/src/App.tsx#L579-L581: replace the inline replace(/-(old|new)-bare$/, "") calls with scenarioKey(oldRun.scenario) === scenarioKey(currentRun.scenario).
📍 Affects 1 file
  • example/src/App.tsx#L369-L371 (this comment)
  • example/src/App.tsx#L579-L581
🤖 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 `@example/src/App.tsx` around lines 369 - 371, Use scenarioKey as the single
scenario-normalization helper: keep the implementation at example/src/App.tsx
lines 369-371 unchanged, and at lines 579-581 replace both inline bare-only
replacements in sameScenario with a comparison of scenarioKey(oldRun.scenario)
and scenarioKey(currentRun.scenario).

Comment thread example/src/App.tsx
Comment on lines +654 to +658
<p>
{baseline
? `${current.completedCount} tasks completed on both implementations under the same scenario parameters.`
: `${current.completedCount} tasks completed on the current implementation.`}
</p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The summary text asserts an equal task count for both runs.

The sentence reports current.completedCount and states that this number completed "on both implementations". The baseline run can have a different completedCount. Report each count separately.

🐛 Proposed fix
         <p>
           {baseline
-            ? `${current.completedCount} tasks completed on both implementations under the same scenario parameters.`
+            ? `${current.completedCount} tasks completed on current, ${baseline.completedCount} on baseline, under the same scenario parameters.`
             : `${current.completedCount} tasks completed on the current implementation.`}
         </p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p>
{baseline
? `${current.completedCount} tasks completed on both implementations under the same scenario parameters.`
: `${current.completedCount} tasks completed on the current implementation.`}
</p>
<p>
{baseline
? `${current.completedCount} tasks completed on current, ${baseline.completedCount} on baseline, under the same scenario parameters.`
: `${current.completedCount} tasks completed on the current implementation.`}
</p>
🤖 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 `@example/src/App.tsx` around lines 654 - 658, Update the summary paragraph in
the baseline branch to report both `current.completedCount` and the baseline
run’s completed-task count separately, rather than claiming the current count
applies to both implementations; keep the non-baseline message unchanged.

Comment thread example/src/App.tsx
Comment on lines +708 to +719
{
label: "Scheduled calls",
baseline: baseline?.scheduledFunctions,
current: current.scheduledFunctions,
format: formatNumber,
lower: true,
note:
baseline && baseline.scheduledFunctions === undefined
? "Baseline capture pending"
: undefined,
},
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the typecheck script for the example app.
rg -n '"(typecheck|tsc|build)"' -g 'package.json'

Repository: get-convex/workpool

Length of output: 157


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== package json files =="
git ls-files '*package.json' | sed -n '1,80p'

echo
echo "== example package.json dependencies and scripts =="
if [ -f example/package.json ]; then
  jq '{scripts, dependencies, devDependencies}' example/package.json
fi

echo
echo "== locate App.tsx =="
git ls-files '*App.tsx' | sed -n '1,80p'

echo
echo "== search metric.note and scheduledFunctions =="
rg -n 'metric\.note|metrics|scheduledFunctions|Baseline capture pending|baseline\?\.scheduledFunctions|current\.scheduledFunctions' -S --glob '!node_modules' --glob '!dist' --glob '!build' | sed -n '1,220p'

Repository: get-convex/workpool

Length of output: 339


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== package json files =="
git ls-files '*package.json' | sed -n '1,80p'

echo
echo "== example package.json dependencies and scripts =="
if [ -f example/package.json ]; then
  jq '{scripts, dependencies, devDependencies}' example/package.json
fi

echo
echo "== locate App.tsx =="
git les-files '*App.tsx' | sed -n '1,80p'

echo
echo "== search metric.note and scheduledFunctions =="
rg -n 'metric\.note|metrics|scheduledFunctions|Baseline capture pending|baseline\?\.scheduledFunctions|current\.scheduledFunctions' -S --glob '!node_modules' --glob '!dist' --glob '!build' | sed -n '1,220p'

Repository: get-convex/workpool

Length of output: 366


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== root package.json scripts/dependencies =="
jq '{scripts, dependencies, devDependencies}' package.json || true

echo
echo "== root package files matching package.json =="
git ls-files '*package.json'

echo
echo "== candidate files for App.tsx =="
git ls-files '**/App.tsx' || true

echo
echo "== focused search for scheduledFunctions/metric.note =="
rg -n 'scheduledFunctions|metric\.note|Baseline capture pending|metrics(\[[0-9][0-9]\])?=' -S --glob '!node_modules' . || true

Repository: get-convex/workpool

Length of output: 5002


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== root package.json scripts/dependencies =="
jq '{scripts, dependencies, devDependencies}' package.json || true

echo
echo "== package manifest files tracked by git =="
git ls-files 'package.json' example/package.json '**/package.json' || true

echo
echo "== tracked App.tsx files =="
git ls-files '*/App.tsx' || true

echo
echo "== focused search for scheduledFunctions/metric.note =="
rg -n 'scheduledFunctions|metric\.note|Baseline capture pending|metrics(\[[0-9][0-9]\])?=' -S --glob '!node_modules/' . || true

Repository: get-convex/workpool

Length of output: 4993


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tsconfig files =="
git ls-files 'tsconfig*.json' 'example/**/tsconfig*.json' | sed -n '1,80p'

echo
echo "== example/src/App.tsx relevant context =="
sed -n '330,760p' example/src/App.tsx

echo
echo "== TypeScript availability =="
if command -v npx >/dev/null && command -v node >/dev/null; then
  node -e "try { console.log(require.resolve('typescript')); } catch (e) { console.log('typescript not resolvable'); process.exit(1) }" || true
  npm exec -- tsc --version || true
fi

echo
echo "== type inference probe for array element union =="
node - <<'JS'
function f() {
  const metrics = [
    { baseline: 1, current: 1, format: String },
    { baseline: 2, current: 2, format: String, note: "x" },
  ];
  for (const metric of metrics) {
    console.log(String(metric.note));
  }
}
try {
  f();
  console.log("JS: member with undefined note coerces undefined value to string.");
} catch (e) {
  console.log("JS: runtime error:", e.message);
}
JS

Repository: get-convex/workpool

Length of output: 13574


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tsconfig files =="
git ls-files 'tsconfig*.json' 'example/**/tsconfig*.json' | sed -n '1,80p'

echo
echo "== example/src/App.tsx relevant context =="
sed -n '330,760p' example/src/App.tsx

echo
echo "== TypeScript availability =="
if command -v npx >/dev/null && command -v node >/dev/null; then
  node -e "try { console.log(require.resolve('typescript')); } catch (e) { console.log('typescript not resolvable'); process.exit(1) }" || true
  npm exec -- tsc --version || true
fi

echo
echo "== runtime behavior probe for undefined optional property in object array =="
node - <<'JS'
function f() {
  const metrics = [
    { baseline: 1, current: 1, format: String },
    { baseline: 2, current: 2, format: String, note: "x" },
  ];
  for (const metric of metrics) {
    console.log(String(metric.note));
  }
}
try {
  f();
  console.log("JS: member without note has undefined note value.");
} catch (e) {
  console.log("JS: runtime error:", e.message);
}
JS

Repository: get-convex/workpool

Length of output: 13584


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== example tsconfig =="
jq '{compilerOptions, include, exclude}' example/tsconfig.json || true

echo
echo "== root tsconfig files =="
for f in tsconfig.json tsconfig.build.json tsconfig.test.json; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    jq '{compilerOptions, include, exclude}' "$f" || true
  fi
done

echo
echo "== dashboard test references =="
sed -n '1,120p' example/convex/test/dashboard.ts || true
sed -n '150,220p' example/convex/test/run.ts || true

echo
echo "== typecheck dry run against example App.tsx =="
npm exec -- node -- import typescript from 'typescript'
npm exec -- tsc --noEmit --project example/tsconfig.json --pretty false | sed -n '1,200p' || true

Repository: get-convex/workpool

Length of output: 8500


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== found config files for typecheck =="
git ls-files '*/tsconfig*.json' '**/tsconfig*.json' 'tsconfig*.json' | sed -n '1,200p'

echo
echo "== all tsconfig contents summary =="
python3 - <<'PY'
import json, subprocess, os
files = subprocess.check_output(['git','ls-files','*tsconfig*.json']).decode().splitlines()
print('\n'.join(files))
for f in files:
    try:
        data = json.load(open(f))
    except Exception as e:
        data = f'ERROR {e}'
    print(f'\n--- {f} ---')
    print(json.dumps({
        'compilerOptions': {k:v for k,V in (data.get('compilerOptions') or {}).items() if k in {'strict','noImplicitAny','allowAny'|'strictNullChecks'|'noUncheckedIndexedAccess'}},
        'include': data.get('include'),
        'exclude': data.get('exclude'),
    }, indent=2, default=str))
PY

echo
echo "== package test/dashboard/getRun signature =="
if [ -f example/convex/test/dashboard.ts ]; then
  rg -n "export .*getRun|getRun\\s*=" -A 40 example/convex/test/dashboard.ts
fi

echo
echo "== run.ts patch/capture context =="
if [ -f example/convex/test/run.ts ]; then
  rg -n "capture|scheduledFunctions|runs" -B 8 -A 12 example/convex/test/run.ts | sed -n '1,220p'
fi

echo
echo "== tsc noEmit example project with tsconfig.json =="
npm exec -- tsc --noEmit --project tsconfig.json --pretty false | sed -n '1,200p' || true
npm exec -- tsc --noEmit --project example/tsconfig.json --pretty false | sed -n '1,200p' || true

Repository: get-convex/workpool

Length of output: 780


Check metric.note compilation and current-run pending state.

Run npm run typecheck; the current-current card can be rendered before current.scheduledFunctions is captured, leaving an em dash with no explanation. Add coverage for this transition and, if needed, share an explicit optional note field on the metric type.

🤖 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 `@example/src/App.tsx` around lines 708 - 719, Update the scheduled-functions
metric flow in App.tsx to represent the current-run pending state when
current.scheduledFunctions is undefined, providing an explanatory note instead
of an unexplained em dash. Ensure the metric type explicitly permits an optional
note field if required, run npm run typecheck, and add coverage for the
transition before and after the current value is captured.

Comment thread package.json
"devDependencies": {
"@convex-dev/eslint-plugin": "^2.0.0",
"@convex-dev/static-hosting": "^0.1.3",
"@convex-dev/static-hosting": "^0.2.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the static-hosting usage and the installed version constraints.
fd -H -t f 'convex.config.ts|staticHosting.ts' example | xargs -r rg -n -C5 'static-hosting|staticHosting|exposeDeploymentQuery|http|route|"/"'
rg -n '"`@convex-dev/static-hosting`"' -g '*.json'

Repository: get-convex/workpool

Length of output: 1628


🌐 Web query:

@convex-dev/static-hosting 0.2.0 changelog breaking changes exposeDeploymentQuery

💡 Result:

In @convex-dev/static-hosting version 0.2.0, there are significant breaking changes, primarily related to the migration of file storage into the component itself [1][2][3]. The primary breaking changes include: 1. Storage-Breaking Changes: Version 0.2.0 shifts how files are stored and managed [1][3]. Previously, files lived in the application's storage; they now reside within the component [2][3]. As a result, you must re-upload your assets after upgrading [1][2][3]. 2. Removal of exposeUploadApi: You are required to remove existing exposeUploadApi re-exports from your convex/staticHosting.ts file [2][3]. 3. Migration Requirements: Because this is a storage-breaking update, users are strongly advised to consult the dedicated 0.1.x to 0.2.x migration guide [1][2][3]. This guide covers critical steps such as choosing a root-routing mode, regenerating the component API, auditing historical blobs, and ensuring a smooth transition to the new component-owned storage [1][2][3]. Regarding exposeDeploymentQuery, it is a function exported by @convex-dev/static-hosting [4] used to expose functionality related to the deployment. In the context of the 0.2.0 upgrade, the focus is on re-architecting how assets are handled, so you should ensure your integration follows the updated patterns documented in the migration guide rather than relying on previous versions' setup [1][2][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -u

echo "== package references =="
rg -n '"`@convex-dev/static-hosting`"|`@convex-dev/static-hosting`|staticHosting' -g '*.json' -g '*.md' -g '*.ts' . || true

echo
echo "== static hosting files =="
fd -H -t f 'staticHosting\.ts|INTEGRATION\.md|CONVEX|README' | sed -n '1,120p'

echo
echo "== git diff for relevant files =="
git diff --stat -- 'package.json' 'example/convex/convex.config.ts' 'example/convex/staticHosting.ts' || true
git diff -- 'package.json' 'example/convex/convex.config.ts' 'example/convex/staticHosting.ts' || true

Repository: get-convex/workpool

Length of output: 1828


🌐 Web query:

github get-convex static-hosting INTEGRATION.md 0.2.0 exposeDeploymentQuery defineApp

💡 Result:

The @convex-dev/static-hosting component integrates with Convex using defineApp and exposeDeploymentQuery to facilitate hosting and live-reload functionality [1][2][3]. In your convex/convex.config.ts file, you use defineApp to install the static hosting component [1][2]: import { defineApp } from "convex/server"; import staticHosting from "@convex-dev/static-hosting/convex.config"; const app = defineApp; app.use(staticHosting); export default app; To enable live-reload notifications in your application, you must expose the deployment query within a module (typically convex/staticHosting.ts), utilizing the component name defined in your configuration [1][2][4]: import { exposeDeploymentQuery } from "@convex-dev/static-hosting"; import { components } from "./_generated/api"; // Assuming the component is registered as staticHosting in convex.config.ts export const { getCurrentDeployment } = exposeDeploymentQuery( components.staticHosting,); This getCurrentDeployment query can then be used by the UpdateBanner component or the useDeploymentUpdates hook in your frontend to detect and notify users of new deployments [2][4]. Note that older versions or varied configurations may refer to the component as selfHosting [1][5]. Always ensure the component name passed to exposeDeploymentQuery matches the identifier used in your defineApp setup [4].

Citations:


🌐 Web query:

@convex-dev/static-hosting 0.1.0 exposeUploadApi 0.2.0 migration root routing app.use staticHosting

💡 Result:

The migration from @convex-dev/static-hosting 0.1.0 to 0.2.0 is a storage-breaking change that requires significant updates to your project, as 0.2.0 shifts upload handling and file storage from the main application storage directly into the component's private storage [1][2][3]. Key migration steps include: 1. Remove exposeUploadApi: You must remove all exposeUploadApi re-exports from your convex/staticHosting.ts file [1][2][3]. The component now manages these internal functions automatically [1][2]. 2. Choose Routing Mode: 0.2.0 offers two primary serving modes depending on your needs [1][2][3]: - Component-Owned Root: If the static site can occupy the root path (/), mount the component at the root in your configuration and remove any existing registerStaticRoutes calls in your http.ts [2][3]. - App-Owned Root (Preserve Existing Routes): If you must keep existing HTTP routes (like webhooks or auth) at the root, continue using your existing convex/http.ts file [2][3]. The 0.2.0 component is designed to read its assets without requiring changes to those route URLs [1][2][3]. 3. Redeploy Assets: Because of the storage migration, you must re-upload your static assets using the new CLI commands [1][2][3]. 4. Cleanup: It is recommended to perform an audit of your app storage to identify and clean up any historical blobs left by 0.1.x uploads, as the component-private storage cannot automatically delete assets stored in the main application's storage [1][2][3]. It is highly recommended to consult the official 0.1.x to 0.2.0 migration guide provided in the @convex-dev/static-hosting repository before executing these changes to ensure a smooth transition and avoid potential downtime [1][2][3].

Citations:


Confirm the 0.2.0 static-hosting migration steps are covered.

@convex-dev/static-hosting 0.2.0 is storage-breaking and removes exposeUploadApi; this example also pins one package version without a migration note. If static assets existed before this upgrade, add the required upload --prod re-upload or note that assets need migration to component-owned storage.

🤖 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 `@package.json` at line 75, Update the static-hosting upgrade documentation or
example configuration associated with `@convex-dev/static-hosting` to cover the
0.2.0 migration: mention that existing assets must be re-uploaded with upload
--prod or migrated to component-owned storage, and account for the removal of
exposeUploadApi. Keep the pinned dependency version aligned with the documented
migration steps.

@ianmacartney
ianmacartney merged commit 9982ac1 into main Aug 1, 2026
4 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