Skip to content

chore: use correct Vite instance for runner checks - #4

Open
anurag6569201 wants to merge 1 commit into
qa/agent-sveltejs-kit/pr-04-16973/basefrom
qa/agent-sveltejs-kit/pr-04-16973/head
Open

anurag6569201 wants to merge 1 commit into
qa/agent-sveltejs-kit/pr-04-16973/basefrom
qa/agent-sveltejs-kit/pr-04-16973/head

Conversation

@anurag6569201

Copy link
Copy Markdown

fixes the vite ecosystem ci error https://github.com/vitejs/vite-ecosystem-ci/actions/runs/32693769091/job/97332021820#step:7:1811

There is no point to us calling resolve_peer(...) for a Vite instance in the vite/index.js file anymore since we don't use to run the client build during a server build (SvelteKit 2 behaviour). Removing this should avoid the vite-ecosystem-ci error where the Vite runner instanceof check fails from two differently resolved Vite instances (the one that started the build and the one from our resolve_peer).

Source merge-base: 2eed638671196bb4734d7e17f5f6d70a2b704b5d
Source head: 82d2454fc48faed4f6c400b49cc79da7ea0520af

@shipwright-agent

Copy link
Copy Markdown

⛔ Shipwright · Blocked

Recommendation: do not merge PR #4 · Tier T1
Checks: 0 total · 0 needing attention

Next step: resolve the blocking findings before merge.

Findings (4)

  • CRITICAL The 'config.handler' was changed from 'async' to synchronous, but it still performs asynchronous work via 'resolve_entry' and 'get_import_aliases'. · packages/kit/src/exports/vite/index.js:331
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • CRITICAL 'get_runner' now destructures 'isRunnableDevEnvironment' from the first argument, but the call site in 'index.js' still passes '() => ({ root, vite })' to 'plugin_remote'. · packages/kit/src/runner.js:8
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The type import in 'runner.js' uses '@import * as vite from 'vite'' but the parameter is destructured as '{ isRunnableDevEnvironment }'. · packages/kit/src/runner.js:2
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The import of '* as vite from 'vite'' at the top level of 'index.js' changes the module loading strategy from a peer-resolved dynamic import to a static import. · packages/kit/src/exports/vite/index.js:10
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

Fireworks usage: 7,093 input · 549 output · 7,642 total tokens · $0.0019 · 9s · 0 fix iteration(s)

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

config: {
order: 'pre',
async handler(config, config_env) {
handler(config, config_env) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The 'config.handler' was changed from 'async' to synchronous, but it still performs asynchronous work via 'resolve_entry' and 'get_import_aliases'.

Impact: The 'config.handler' was changed from 'async' to synchronous, but it still performs asynchronous work via 'resolve_entry' and 'get_import_aliases'. If any of these paths rely on async resolution (e.g., dynamic imports, file system promises), the handler will return before the work completes, causing 'normalized_aliases' to be undefined or stale during the build. This can break alias resolution and produce incorrect…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

* @param {ViteDevServer} server
*/
export function get_runner(vite, server) {
export function get_runner({ isRunnableDevEnvironment }, server) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

'get_runner' now destructures 'isRunnableDevEnvironment' from the first argument, but the call site in 'index.js' still passes '() => ({ root, vite })' to 'plugin_remote'.

Impact: 'get_runner' now destructures 'isRunnableDevEnvironment' from the first argument, but the call site in 'index.js' still passes '() => ({ root, vite })' to 'plugin_remote'. If 'plugin_remote' invokes 'get_runner' with the old shape (a full vite module object), the destructured property will be 'undefined', causing a TypeError when calling 'isRunnableDevEnvironment(server.environments.ssr)'. This breaks SSR dev ser…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

import path from 'node:path';
import process from 'node:process';
import { styleText } from 'node:util';
import * as vite from 'vite';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The import of '* as vite from 'vite'' at the top level of 'index.js' changes the module loading strategy from a peer-resolved dynamic import to a static import.

Impact: The import of '* as vite from 'vite'' at the top level of 'index.js' changes the module loading strategy from a peer-resolved dynamic import to a static import. If the consuming project has a different Vite version than the one bundled with SvelteKit, this can lead to duplicate Vite instances, breaking the 'instanceof' check in 'isRunnableDevEnvironment' and potentially causing security-relevant misconfigurations (e…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

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.

1 participant