feat: codeblock verifier via planner and runner on sandbox#215
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
@farming-labs/astro
@farming-labs/astro-theme
@farming-labs/docs
@farming-labs/theme
@farming-labs/next
@farming-labs/nuxt
@farming-labs/nuxt-theme
@farming-labs/svelte
@farming-labs/svelte-theme
@farming-labs/tanstack-start
commit: |
There was a problem hiding this comment.
4 issues found across 16 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/docs/src/cli/codeblocks.ts">
<violation number="1" location="packages/docs/src/cli/codeblocks.ts:122">
P2: Disabled-mode JSON output bypasses redaction and can leak `planner.apiKey`.</violation>
<violation number="2" location="packages/docs/src/cli/codeblocks.ts:146">
P2: Report labeling uses the pre-override mode, so `--run` can execute validations while still printing a "plan" label.</violation>
</file>
<file name="packages/docs/src/code-blocks.ts">
<violation number="1" location="packages/docs/src/code-blocks.ts:304">
P1: The no-runnable-plans branch incorrectly converts any skipped result with a reason into FAIL when `missingEnv` is `error`, including non-env skips.</violation>
<violation number="2" location="packages/docs/src/code-blocks.ts:993">
P2: Closing fence detection rejects valid CommonMark closers that are longer than the opening fence.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 8 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/docs/src/code-blocks.ts">
<violation number="1" location="packages/docs/src/code-blocks.ts:965">
P2: Project discovery is nondeterministic: it always uses the first Vercel project, which can select the wrong project/team on multi-project accounts.</violation>
</file>
<file name="packages/docs/src/cli/codeblocks.ts">
<violation number="1" location="packages/docs/src/cli/codeblocks.ts:251">
P2: `readStaticRunnerConfig` incorrectly rejects valid runner objects when `provider` is omitted, so static fallback can silently ignore settings like `timeoutMs`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| const payload = (await response.json()) as { | ||
| projects?: Array<{ id?: unknown; accountId?: unknown }>; | ||
| }; | ||
| const project = payload.projects?.[0]; |
There was a problem hiding this comment.
P2: Project discovery is nondeterministic: it always uses the first Vercel project, which can select the wrong project/team on multi-project accounts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/src/code-blocks.ts, line 965:
<comment>Project discovery is nondeterministic: it always uses the first Vercel project, which can select the wrong project/team on multi-project accounts.</comment>
<file context>
@@ -876,12 +915,84 @@ async function runPlansInVercelSandbox(
+ const payload = (await response.json()) as {
+ projects?: Array<{ id?: unknown; accountId?: unknown }>;
+ };
+ const project = payload.projects?.[0];
+ if (!project) return undefined;
+
</file context>
| const project = payload.projects?.[0]; | |
| const projects = payload.projects ?? []; | |
| if (projects.length !== 1) return undefined; | |
| const project = projects[0]; |
| const runtime = readStringProperty(block, "runtime"); | ||
| const timeoutMs = readNumberProperty(block, "timeoutMs"); | ||
|
|
||
| if (provider !== "local" && provider !== "vercel-sandbox" && provider !== "cloud") { |
There was a problem hiding this comment.
P2: readStaticRunnerConfig incorrectly rejects valid runner objects when provider is omitted, so static fallback can silently ignore settings like timeoutMs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/src/cli/codeblocks.ts, line 251:
<comment>`readStaticRunnerConfig` incorrectly rejects valid runner objects when `provider` is omitted, so static fallback can silently ignore settings like `timeoutMs`.</comment>
<file context>
@@ -160,12 +165,136 @@ function readStaticCodeBlocksValidateConfig(
+ const runtime = readStringProperty(block, "runtime");
+ const timeoutMs = readNumberProperty(block, "timeoutMs");
+
+ if (provider !== "local" && provider !== "vercel-sandbox" && provider !== "cloud") {
+ return undefined;
+ }
</file context>
| if (provider !== "local" && provider !== "vercel-sandbox" && provider !== "cloud") { | |
| if (provider && provider !== "local" && provider !== "vercel-sandbox" && provider !== "cloud") { |
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/docs/src/code-blocks.ts">
<violation number="1" location="packages/docs/src/code-blocks.ts:965">
P2: Project discovery is nondeterministic: it always uses the first Vercel project, which can select the wrong project/team on multi-project accounts.</violation>
</file>
<file name="packages/docs/src/cli/codeblocks.ts">
<violation number="1" location="packages/docs/src/cli/codeblocks.ts:251">
P2: `readStaticRunnerConfig` incorrectly rejects valid runner objects when `provider` is omitted, so static fallback can silently ignore settings like `timeoutMs`.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Summary by cubic
Adds a code block validator to the docs CLI to plan and optionally run fenced MD/MDX snippets. Includes a
vercel-sandboxrunner powered by@vercel/sandboxwith token support and clear pass/skip/fail reporting.New Features
docs codeblocks validatewith--plan,--run,--json,--config(aliases:codeblocks/code-blocks; help and unknown-subcommand hints).codeBlocks.validatewith planner, runner, policies (missingEnv,unsupportedLanguage), andmode(plan|report);loadDocsConfigModulesupports silent mode for cleaner CLI output."metadata"(default),"openai","openai-compatible", and reserved"cloud"."local","vercel-sandbox", and reserved"cloud"; supportstokenEnv, per-command timeout, and runtime selection.defineDocspasses throughcodeBlocks; types exported fromindex.ts; MCP schema includescodeBlocksandvalidate; CLI/config docs and skills updated with examples; websitedocs.config.tsxexample; tests for CLI parsing, planning, and sandbox execution. Adds dependency@vercel/sandbox.Migration
docs.config.ts, enable:codeBlocks: { validate: { planner, runner, ... } }; setrunner.tokenEnv(defaults toVERCEL_TOKEN).OPENAI_API_KEYfor"openai"/compatible.VERCEL_TOKEN(or yourtokenEnv), optionalVERCEL_PROJECT_ID/VERCEL_TEAM_ID.env: { ... }.pnpm exec docs codeblocks validate --planpnpm exec docs codeblocks validateWritten for commit 7d95bce. Summary will update on new commits. Review in cubic