Website build error#1136
Conversation
There was a problem hiding this comment.
main, but PRs should target staged.
The main branch is auto-published from staged and should not receive direct PRs.
Please close this PR and re-open it against the staged branch.
You can change the base branch using the Edit button at the top of this PR,
or run: gh pr edit 1136 --base staged
There was a problem hiding this comment.
Pull request overview
Fixes the website build failure caused by agent frontmatter using model as an array (instead of a single string), so the Agents page can render and filter safely.
Changes:
- Update
escapeHtml(and agent page types) to acceptmodelasstring | string[]and render arrays safely. - Update Agents page model filtering logic to support
item.modelas an array. - Adjust Astro/Vite build settings (sourcemaps + chunk warning threshold), and update one agent to use a multi-model
modellist.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/scripts/utils.ts | Makes escapeHtml handle string[] so SSR rendering won’t crash when model is an array. |
| website/src/scripts/pages/agents.ts | Updates model typing and filtering to handle array-valued models. |
| website/src/scripts/pages/agents-render.ts | Updates RenderableAgent.model typing to allow arrays. |
| website/astro.config.mjs | Changes Vite build settings (sourcemap + chunk warning limit). |
| agents/dotnet-self-learning-architect.agent.md | Switches model frontmatter to an array and reformats content. |
Comments suppressed due to low confidence (1)
website/src/scripts/pages/agents.ts:54
- The model filtering logic will still behave incorrectly when an agent's
modelis an array because the generatedagents.jsonfilter list currently collectsmodelvalues as-is. That meansfilters.modelswill contain the entire array as a single option (stringified like "a,b,c"), and selecting it will never match here because this predicate checks for individual model entries. Please normalize models so filters contain individual strings (flatten arrays during data generation, or defensively split/flatten filter values before comparison).
return item.model && (Array.isArray(item.model) ? item.model.some(m => currentFilters.models.includes(m)) : currentFilters.models.includes(item.model));
| return true; | ||
| } | ||
| return item.model && currentFilters.models.includes(item.model); | ||
| return item.model && (Array.isArray(item.model) ? item.model.some(m => currentFilters.models.includes(m)) : currentFilters.models.includes(item.model)); |
There was a problem hiding this comment.
This inline conditional is difficult to read and maintain, and it duplicates the concept of “normalize model(s) to a list then match any”. Consider extracting a small helper (e.g., normalize to string[] once per item) to keep the filter predicate clearer and easier to extend.
This issue also appears on line 54 of the same file.
| // Production sourcemaps trigger a known warning in the expressive-code Vite plugin. | ||
| // The docs site does not need emitted JS sourcemaps for its validation build. | ||
| sourcemap: false, | ||
| // Starlight ships large syntax-highlighting chunks that are expected for this site. | ||
| // Raise the threshold so Vite only warns on materially larger regressions. | ||
| chunkSizeWarningLimit: 900, |
There was a problem hiding this comment.
This changes build output behavior (disables sourcemaps and raises chunkSizeWarningLimit) but the PR description only mentions handling model as an array. Please either (1) update the PR description to justify these Vite config changes, or (2) split them into a separate PR so the website build fix can be reviewed independently.
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| with: | ||
| fetch-depth: 0 # Full history needed for git-based last updated dates | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: "20" | ||
| cache: "npm" | ||
|
|
||
| - name: Install root dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Install website dependencies | ||
| run: npm ci | ||
| working-directory: ./website | ||
|
|
||
| - name: Build Astro site | ||
| run: npm run website:build |
34fde07 to
a5ef601
Compare
Build error on website as we didn't handle when
modelis an array