docs: Surface factory definition validation and schema; fix .md code blocks - #727
docs: Surface factory definition validation and schema; fix .md code blocks#727hongyi-chen wants to merge 5 commits into
Conversation
…blocks Factory definition syntax page: - Say up front that GitHub-backed definitions get the warp/factory-config check on every pull request, and that teams can make it a required status check. - Add "Validate a definition" near the top: the pull request check, the unauthenticated validation endpoint and the examples repo's validator script for local/CI use, and the coding-agent paths (the Warp Agent's built-in factory-files skill, and the Factory MCP tools). - Add "JSON Schema": the registry, bundle, and per-document URLs, the document-per-file-kind list, and editor schema association. - Link the schema from the intro; fold the two sections that were buried at the bottom of the page into the new ones; add Related pages. Factory MCP page: document get_factory_file_schema and validate_factory_files with a short "Author and validate factory definitions" section and cross-links. GitHub integration page: a pull request that doesn't touch the definition still gets the check and passes immediately (per prcheck.runCheck), so requiring the check doesn't block unrelated work. Markdown integration: Expressive Code renders one div.ec-line per source line with no newline characters, and puts data-language on <pre>, so the generated .md pages collapsed every code block onto one untagged line. Rebuild the text line by line, read the language from <pre>, and carry the block title onto the fence. Adds unit tests. Co-Authored-By: Warp <agent@warp.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR was generated with Warp. Comment |
|
Your Warp account is not a member of any team with access to this repository. |
1 similar comment
|
Your Warp account is not a member of any team with access to this repository. |
CodeQL flagged the quote-only escaping as incomplete (backslashes were not escaped). JSON.stringify produces a double-quoted string with both escaped. Co-Authored-By: Warp <agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR moves factory definition validation and JSON Schema guidance earlier in the factory docs, adds Factory MCP validation-tool coverage, updates related factory links, and fixes generated Markdown code block conversion with targeted tests.
Concerns
factory-as-code.mdxoverstates JSON Schema coverage in the intro by saying it publishes "the same rules" after listing YAML parser restrictions. Schema consumers still need the parser or validation endpoint for YAML-only restrictions and cross-file checks.- Security review: no security-specific findings were identified in the changed docs or Markdown conversion code.
- Spec review: no approved or repository spec context was provided, so there was no implementation spec drift to validate.
- Comment/test audit: added code comments explain converter behavior, and the new tests cover distinct converter paths without violating repository conventions.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
There was a problem hiding this comment.
Review summary
The independent agent completed its review for this commit.
Findings
src/content/docs/factories/factory-mcp.mdx:149— [SUGGESTION] The page already carries 3 callouts (:::noteat line 16,:::cautionat line 109,:::cautionat line 139), 1 over the linted budget of 2 (AGENTS.md → Callouts and hints; check_compression_contract.py reports '3 callouts exceed the linted budget of 2'). Requested change: not introduced by this diff, but since the PR substantially edits this page, fold one existing callout into body prose while editing.
Verdict
Approve with nits
Cut internal-mechanics asides and a mechanically parallel verb chain in the coding-agent validation guidance on factory-as-code.mdx and factory-mcp.mdx, per an editorial pass requested on PR #727. Co-Authored-By: Warp <agent@warp.dev>
There was a problem hiding this comment.
Review summary
The independent agent completed its review for this commit.
Findings
src/content/docs/factories/factory-as-code.mdx:38— [SUGGESTION] The claim that a subdirectory definition getswarp/factory-config (factory)appended to the check name isn't itemized in the PR's verification notes the way other claims are; requested resolution: cite the specific prcheck/service.go code path or confirm the exact rendered format before merging.src/content/docs/factories/factory-as-code.mdx:61-67— [SUGGESTION] The example validation-endpoint JSON response omits thevalidation_scopeobject that the live API actually returns alongsidediagnostics/state_dependent_checks_not_run; requested resolution: addvalidation_scopeto the example so it's fully representative.src/content/docs/factories/integrations/github.mdx:171— [SUGGESTION] The new literal string 'it passes with "No factory configuration changes"' is an unverified verbatim UI/API message not itemized in the Unverified claims section; requested resolution: cite the exact source location for this string or soften to a paraphrase if the wording isn't guaranteed stable.
Verdict
Approve
There was a problem hiding this comment.
Overview
The validation paths, JSON Schema URLs, and Factory MCP operations remain covered, and the Markdown converter change is intact with passing targeted tests.
Concerns
- JSON Schema is still described as publishing the same rules as the YAML parser, which is not correct for parser-only and cross-file validation.
- The requested editorial rework remains incomplete: the new validation and MCP sections retain dense internal mechanics and duplicate detail rather than focusing on the user action and linking for depth.
- The PR has no current visual proof of the new rendered documentation flow.
Verdict
Found: 1 critical, 4 important, 0 suggestions, 0 nits
Request changes
Address review findings on the editorial pass: - Fix the JSON Schema intro to limit its claim to accepted files and keys, since it cannot express YAML parser restrictions or cross-file rules; point readers to the validation paths for those. - Rewrite the Pull request checks subsection to lead with the reader's decision (the check runs, reports problems, passes unchanged definitions, can be required) and move the check's internal mechanics (head-commit validation, dry-run scope, subdirectory naming) to the GitHub integration reference, which already owns GitHub-specific behavior. - Tighten the coding-agent validation bullets to one action and one outcome each, cutting repeated schema/endpoint/tool mechanics that the adjacent sections already own. - Trim the Factory MCP author/validate section to a short description of each tool plus a practical prompt, cutting the diagnostics field inventory, state-dependent-check list, and cross-file rationale that duplicated the canonical validation page. Co-Authored-By: Warp <agent@warp.dev>


Summary
Customers editing factory definitions couldn't tell what files and keys are valid, how to check their YAML before it applies, or what tooling helps with that. The
warp/factory-configpull request check and the JSON Schema existed but were buried at the bottom of the page; they now appear near the top alongside the other validation paths — the validation endpoint, the validator script, the Warp Agent'sfactory-filesskill, and the Factory MCP tools. The Factory MCP page now documents its two schema/validation tools directly instead of only listing them in a table.This PR also fixes the generated
.mdpages (docs.warp.dev/<page>.md): code blocks were rendering as a single unlabeled line, which made the Markdown version of every page unreadable for agents.Changes
Content files are under
src/content/docs/factories/.factory-as-code.mdx## Validate a definitionsection:### Pull request checks- what the check validates, when it passes immediately, the(directory)suffix for a subdirectory definition, and how to require it in branch protection.### Validate locally or in CI- the validation endpoint, thevalidate_factory_files.pyscript and its exit codes, the examples repo's CI workflow, and what a clean result does and does not prove.### Validate with a coding agent- the Warp Agent's built-infactory-filesskill, the Factory MCP tools, and the shell fallback.## JSON Schemasection: registry, bundle, and per-document URLs; the document-per-file-kind list; and a# yaml-language-server: $schema=example for editor completion.## Related pages.factory-mcp.mdx## Author and validate factory definitionssection documentingget_factory_file_schemaandvalidate_factory_files, with a cross-link to the validation section.integrations/github.mdxfactory-skills.mdx,how-factories-work.mdx#pull-request-checkssection.src/integrations/docs-markdown-integration.js(+ test).mdpages: the converter read a code block's full text content instead of its per-line structure, so every block collapsed to one unlabeled line. It now rebuilds each block line by line, carries the language onto the fence, and preserves a block'stitle="...". Added unit tests (node --test src/integrations/docs-markdown-integration.test.js).Content design plan
Audience and JTBD: An engineer (or a coding agent) with a factory definition open in their own repository, mid-edit, who needs to know which keys are allowed and whether what they wrote will apply.
Problem: The page answered "what keys exist" at length but hid the safety net (pull request check) and the exhaustive source of truth (JSON Schema) at the bottom, and never mentioned the validation endpoint, the validator script, the Warp skill, or the Factory MCP tools. The Markdown version of the page lost all code block formatting.
Goals:
Purpose and value: Customers reported these exact questions. Answering them on the page they already have open removes support back-and-forth and stops invalid definitions from reaching a production branch.
Content type: Reference (existing page), with a short task-oriented validation section. No new page.
Skill and template:
draft_referenceconventions; existing page updated in place.High-impact scenarios:
Unverified claims
None. Every endpoint, tool name, check name, diagnostic code, and behavior claim was checked against warp-server source (files listed below) and the live API:
GET /api/v1/factory-files/schemas,.../v1alpha1, and.../v1alpha1/factory.schema.jsonfetched unauthenticated;factory.schema.jsoncompiled standalone with Ajv (draft 2020-12), auto-resolvingcommon.schema.jsonby URL, and accepted a validfactory.yamlwhile rejecting an unknown key.POST /api/v1/factory-files/validatecalled unauthenticated with valid and invalid trees; the invalid tree returnedFF_UNKNOWN_FIELDandFF_INVALID_REFERENCEwith path, line, and column, and a tree with anchors, aliases, and a duplicate key returnedFF_ANCHOR,FF_ALIAS, andFF_DUPLICATE_KEY. A leading# yaml-language-server: $schema=...comment validates clean.factory-filesskill being always bundled for the Warp Agent in the GUI, TUI, and cloud agents:warp/app/src/ai/skills/bundled_tests.rs.# yaml-language-server: $schema=<url>first-line comment. That is the extension's documented modeline feature and the use the server's per-document endpoint was built for (see the comment onGetFactoryFileSchemaDocumentHandler), but it was not exercised in an editor here.Documentation risk
Risk: engineering-review-required
Rationale: Adds validation endpoint, schema URL, check-name, and MCP tool claims; every claim was verified against warp-server source and the live API, but the change adds commands and configuration examples.
Source files consulted: warp-server@9f9b411b (logic/factoryfile/prcheck/service.go; logic/factory_files_registration.go; logic/factoryfile/validation/contract.go; logic/factoryfile/diagnostic.go; router/handlers/public_api/factory_file_schemas.go and factory_file_validation.go; router/handlers/public_api/factory_mcp/{server,handle_validate_factory_files,handle_get_factory_file_schema}.go), warp@c12e2130 (resources/bundled/skills/factory-files/SKILL.md; app/src/ai/skills/bundled_tests.rs)
Engineering review status: pending
Docs override: none
Rework changes
Addressed all five review findings from rework cycle 1:
integrations/github.mdx), which already documents GitHub-specific check behavior.Also checked the CodeQL note (incomplete string escaping in
docs-markdown-integration.js's title-attribute path): the fix (title.replace→JSON.stringify) already landed in a prior commit on this branch (267d1ca2), and the alert's most recent scan instance is markedfixedat that commit - no further code change needed.Computer-use screenshots (2)
Full "Validate a definition" section showing H2 heading and all three H3 subsections (Pull request checks, Validate locally or in CI, Validate with a coding agent) together with the right-hand "ON THIS PAGE" table of contents listing all headings including the new ones.
"JSON Schema" section showing the H2 heading, intro paragraph, bulleted list of three schema endpoint URLs with descriptions, additional paragraph about per-file-kind schema documents, and a code block (factory.yaml) demonstrating the yaml-language-server comment; the "Directory structure" section begins below, and the right-hand "ON THIS PAGE" TOC is visible.
Co-Authored-By: Warp agent@warp.dev