Repository navigation
Adopt AST control plane artifacts in workbench - #76
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f734eb2dfe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| function generatedAstPath(surfaceId: string): string { | ||
| return join(GENERATED_DIR, `${surfaceId}.ui.surface.ast.json`); |
There was a problem hiding this comment.
Normalize bootstrapSurfaceId before resolving artifact paths
loadBootstrapGovernanceHandoff is fed by the bootstrapSurfaceId query param on the governance page, but generatedAstPath interpolates that value directly into a filesystem path. A crafted value containing path traversal segments (for example ../) can make the page probe/read files outside contracts/generated, because existsSync/readFileSync are executed on the joined path. Please normalize/validate the surface id (e.g., with the existing surface-id normalizer and separator checks) before using it in path construction.
Useful? React with 👍 / 👎.
| export async function loadLocalWorkbenchData(): Promise<LocalWorkbenchData> { | ||
| const session = await loadOrInitContractSession(); | ||
| const contract = summarizeContract(session.workingContract); | ||
| const canonicalAst = await readJsonFile<UiAstDocument>(session.canonicalAstPath); |
There was a problem hiding this comment.
Fall back when canonicalAstPath points to a stale session path
The workbench now always loads canonicalAst from session.canonicalAstPath, but session files persist absolute paths that can become stale when the repo location changes (or when an old session references a non-existent AST path). In that case loadLocalWorkbenchData throws before rendering the page. This is a regression in page-load robustness; add an existence check and fall back to loadCanonicalTargetAst()/resolved target path instead of hard-failing.
Useful? React with 👍 / 👎.
Summary
Dependency
1f2377c28ae8349250afae04408309d1d551d4e3Testing