Files
webstudio/packages/content-engine/src/limits.ts
T
Oleg Isonen 3c7dac7eb0 fix: resolve MCP preview and content graph reports (#6511)
## Summary

- Raise the document-reference graph budget independently of the 20-file
content hydration limit, and document the 2,000-document graph cap. This
lets the reported 29-post referenced query complete.
- Make iterative preview startup verify the generated project identity
endpoint instead of compiling the application route; exact route
validation remains with screenshot/capture.
- Keep production preview readiness tied to the application route even
when no CSS assets are present.
- Include a stable structured diagnostic when the browser DevTools
connection closes, while preserving the existing reconnect behavior.
- Document and test a safe leaves-first `convert-instance` migration for
required-part composite trees.

Closes #6508, #6515
Ref #6509, #6510

## Verification

- Content Engine suite: 656 tests passed.
- Vision suite: 85 tests passed.
- CLI preview/readiness/controller tests: 32 passed; project-build
instance conversion tests: 89 passed.
- CLI typecheck, targeted lint, formatting, and diff checks passed.
- The full CLI suite timed out in unrelated launcher/fixture tests under
parallel load. The preview-script and launcher tests passed with fewer
workers, and the MDX fixture test passed alone in 29 seconds. No full
local agent evaluation command was run.
- All required GitHub checks passed on latest commit `7f7b981` (29
successful; visual regression skipped).

## Remaining scope

- #6509 remains open: this PR improves diagnostics but does not
establish a stable Edge DevTools capture.
- #6510 remains open: this PR removes the initial route-compilation
dependency, but does not yet provide route-specific preparing/retry
status.

## Checklist

- [x] Review the change and preserve production preview route checks.
- [x] Add regression coverage for the review fix and required-part
conversion recipe.
- [x] Update MCP manual docs with the supported conversion order.
- [x] Run focused tests, typecheck, lint, and formatting.
- [ ] Run the full local agent evaluation suite (not run).
- [x] Confirm required CI checks pass on the latest commit.
2026-10-09 16:14:18 +02:00

45 lines
1.3 KiB
TypeScript

/** Safety and size limits shared by content compilation and query runtimes. */
export const contentEngineLimits = {
requestBytes: 512 * 1024,
filterCount: 32,
filterDepth: 8,
sortCount: 8,
outputFieldCount: 256,
fieldPathDepth: 9,
defaultResultCount: 20,
resultCount: 1000,
resultBytes: 16 * 1024 * 1024,
candidateDocuments: 1000,
documentGraphDocuments: 2000,
databaseBytes: 500 * 1024,
frontmatterBytes: 64 * 1024,
frontmatterDepth: 8,
frontmatterFields: 256,
frontmatterStringBytes: 16 * 1024,
jsonBytes: 1024 * 1024,
jsonDepth: 8,
jsonFields: 256,
jsonStringBytes: 16 * 1024,
indexedPropertiesBytes: 64 * 1024,
excerptBytes: 2 * 1024,
mdxDepth: 100,
mdxNodes: 20_000,
mdxProps: 4_000,
hydratedFileBytes: 1024 * 1024,
hydratedTotalBytes: 2 * 1024 * 1024,
hydratedFileCount: 20,
hydratedRangeBytes: 256 * 1024,
concurrentContentReads: 8,
} as const;
export const parseContentDatabaseMaxBytes = (value: string | undefined) => {
if (value === undefined || value === "") {
return contentEngineLimits.databaseBytes;
}
const maxBytes = Number(value);
if (Number.isSafeInteger(maxBytes) === false || maxBytes <= 0) {
throw new Error("CONTENT_DATABASE_MAX_BYTES must be a positive integer");
}
return maxBytes;
};