Skip to content

fix(config): align void.json revalidate key schema with runtime validation - #224

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/schema-revalidate-key-pattern
Jun 30, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/schema-revalidate-key-pattern

Conversation

@hyfdev

@hyfdev hyfdev commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Editors now correctly flag invalid routing.revalidate keys in void.json instead of silently accepting keys the build will reject.

The bug

The editor JSON schema validated routing.revalidate object keys with the pattern ^(/|\*). The \* branch is unanchored, so it matched any key merely starting with * — accepting "*foo", "**", "*/". The runtime validator (packages/void/src/config.ts:473) requires each key to be exactly "*" or to start with "/", and throws config: "routing.revalidate" key '…' … must start with "/" or be "*". on anything else. So an editor using $schema showed no warning for keys that fail at build.

Expected-correct behavior

The schema should accept exactly what the runtime accepts: a key that is "*" or starts with "/".

The fix

Anchor the * branch: ^(/|\*) → ^(\/|\*$). This is byte-identical to the already-correct sibling pattern used by routing.revalidateQueryAllowlist (schema.json), restoring schema↔runtime parity.

Tests

Added a parity test in config.test.ts (in the same style as the existing schema.json sourceDir pattern matches runtime validation / redirect status enum parity tests): it loads the schema pattern and asserts it accepts *, /x, /docs/* and rejects *foo, **, */, foo — failing on origin/main and passing after. Local gate: config.test.ts 159/159; full --project unit zero-collateral vs a clean origin/main baseline; schema.json valid JSON; typecheck + lint + fmt clean. No existing void.json / doc example uses a now-rejected key.

Prepared with AI assistance.

@netlify

netlify Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for staging-void-cloud failed.

Name Link
🔨 Latest commit 0bebacf
🔍 Latest deploy log https://app.netlify.com/projects/staging-void-cloud/deploys/6a33f600a517a600084f3a3f

@hyfdev
hyfdev marked this pull request as ready for review June 18, 2026 14:35

Brooooooklyn commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Merge activity

  • Jun 30, 4:10 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 30, 4:10 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 30, 4:14 AM UTC: @Brooooooklyn merged this pull request with Graphite.

…ation

The editor JSON schema for routing.revalidate object keys used the
pattern ^(/|\*), whose \* branch is unanchored — so it accepted keys
like "*foo", "**", and "*/" that the runtime validator (config.ts)
rejects (a key must be exactly "*" or start with "/"). Editors using
$schema therefore showed no error for keys that fail at build time.

Anchor the \* branch to ^(\/|\*$), matching the runtime contract and
the already-correct routing.revalidateQueryAllowlist pattern.
@Brooooooklyn
Brooooooklyn force-pushed the fix/schema-revalidate-key-pattern branch from 0bebacf to 6c93a18 Compare June 30, 2026 04:10
@Brooooooklyn
Brooooooklyn merged commit d691c62 into main Jun 30, 2026
6 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/schema-revalidate-key-pattern branch June 30, 2026 04:14
cpojer pushed a commit that referenced this pull request Sep 11, 2026
* docs: plan 0077 — build-log tail in check-run output

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(api): completeCheckRun accepts optional output.text

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: oxfmt reflow of plan 0077

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(api): embed build-log tail in Void Build check-run output

Container-build check runs now include the last 100 captured log lines
(char-capped, fenced) as output.text on every terminal outcome. Assembled
best-effort in BuildManager.finalizeCheckRun; github_actions checks unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(api): dynamic check-run log fence + whole-string 65535 cap

A fixed six-backtick fence was escapable by a log line containing >=6
backticks (markdown injection into the check-run page). Fence now sizes to
max(6, longest content backtick run + 1), and the whole output.text string
converges to <=65535 so GitHub never rejects the PATCH.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: merge check-run log tail plan into 0076, rename to build logs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: drop references to the removed 0077 plan file

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(api): enforce check-run text caps in UTF-8 bytes + 422 drop-text fallback

GitHub validates output.text by UTF-8 bytesize, not code units — CJK/emoji
log tails passed our cap while exceeding GitHub's, stranding the check run
on a rejected PATCH. Caps now measure UTF-8 bytes (surrogate-safe cuts),
and completeCheckRun retries a 422 once without output.text so a rejected
tail can never cost the completion itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants