typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Semantics of --stopBuildOnErrors has changed, now stops build on first error, instead of first project

Open Raynos opened this issue 1 month ago • 5 comments

Steps to reproduce

tsgo -b --verbose --stopBuildOnErrors

Behavior with [email protected]

Stops building other projects ( 30+ in my monorepo ) when one project has errors

Behavior with tsgo

Stops building other projects ( 30+ in my monorepo ) when one project has errors, but also stops processing other files / errors in the project who found an error.

It appears the semantics in tsgo are to either stopBuild on first error and print no more errors, or to stop processing files within the project flagged as error once an error has been found.

Raynos avatar Nov 11 '25 11:11 Raynos

First exection

$ pnpm build:tsgo --stopBuildOnErrors
 WARN  Unsupported engine: wanted: {"node":"^22.18.0"} (current: {"node":"v22.17.0","pnpm":"10.16.1"})

> [email protected] build:tsgo /Users/raynos/projects/depscan
> tsgo -b --verbose --stopBuildOnErrors

[11:23:58 AM] Projects in this build:
    * submodules/socket-patch/tsconfig.json
    * workspaces/lib/tsconfig.json
    * workspaces/legal-parser/tsconfig.json
    * workspaces/metadata-common/tsconfig.json
    * workspaces/metadata-service/tsconfig.json
    * workspaces/metadata-client/tsconfig.json
    * workspaces/obfuscated-pass/tsconfig.json
    * workspaces/reachability-pattern-tools/tsconfig.json
    * workspaces/pipeline/tsconfig.json
    * workspaces/analytics-schema/tsconfig.json
    * workspaces/clickhouse/tsconfig.json
    * workspaces/kafka/tsconfig.json
    * workspaces/app/tsconfig.json
    * tools/tsconfig.json
    * workspaces/analytics-shared/tsconfig.json
    * workspaces/analytics/tsconfig.json
    * workspaces/api-v0/tsconfig.json
    * workspaces/api-v1/tsconfig.json
    * workspaces/artifact-api-service/tsconfig.json
    * workspaces/artifact-search/tsconfig.json
    * workspaces/firewall-api-proxy/tsconfig.json
    * workspaces/gcp-admin/tsconfig.json
    * workspaces/gcs-bucket-server/tsconfig.json
    * workspaces/github-actions/tsconfig.json
    * workspaces/grafana-dashboards/tsconfig.json
    * workspaces/github-app/tsconfig.json
    * workspaces/github-interposer/tsconfig.json
    * workspaces/hosted-mcp/tsconfig.json
    * workspaces/metadata-service-admin/tsconfig.json
    * workspaces/metrics-exporter/tsconfig.json
    * workspaces/autotester/tsconfig.json
    * workspaces/vanta/tsconfig.json
    * workspaces/mini-services/tsconfig.json
    * workspaces/web-extension/tsconfig.json
    * workspaces/next-app/tsconfig.server.json
    * workspaces/reachability-analyzers-service/tsconfig.json
    * workspaces/subprocess-runner/tsconfig.json
    * tsconfig.json

[11:23:58 AM] Project 'submodules/socket-patch/tsconfig.json' is out of date because output for it was generated with version '5.9.3' that differs with current version '7.0.0-dev.20251103.1'

[11:23:58 AM] Building project 'submodules/socket-patch/tsconfig.json'...

[11:23:58 AM] Project 'workspaces/lib/tsconfig.json' is out of date because output for it was generated with version '7.0.0-dev.20250925.1' that differs with current version '7.0.0-dev.20251103.1'

[11:23:58 AM] Building project 'workspaces/lib/tsconfig.json'...

workspaces/lib/src/url-builder.ts:698:25 - error TS2345: Argument of type 'string | number | WithCurrentRepo | { 'top-25-cwe': WithCurrentRepo & WithCurrentRepoLabel; 'alerts-prevented-chart': WithCurrentRepo & WithCurrentRepoLabel; 'top-10-owasp': WithCurrentRepo & WithCurrentRepoLabel; 'top-10-kev': WithCurrentRepo & WithCurrentRepoLabel; } | ... 7 more ... | { ...; }' is not assignable to parameter of type 'Record<string, string | number | string[] | number[]>'.
  Type 'string' is not assignable to type 'Record<string, string | number | string[] | number[]>'.

698     paramsToQueryString(params ?? {}),
                            ~~~~~~~~~~~~
[11:24:00 AM] Project 'workspaces/legal-parser/tsconfig.json' can't be built because its dependency 'workspaces/lib' has errors

[11:24:00 AM] Skipping build of project 'workspaces/legal-parser/tsconfig.json' because its dependency 'workspaces/lib' has errors

[11:24:00 AM] Project 'workspaces/metadata-common/tsconfig.json' can't be built because its dependency 'workspaces/lib' has errors

[11:24:00 AM] Skipping build of project 'workspaces/metadata-common/tsconfig.json' because its dependency 'workspaces/lib' has errors

Then second execution. However it could be some other edgecase where it doesn't output the inferred type error until I fixed the url-builder issue.

~/projects/depscan on jake/typescript-go
$ pnpm build:tsgo --stopBuildOnErrors
 WARN  Unsupported engine: wanted: {"node":"^22.18.0"} (current: {"node":"v22.17.0","pnpm":"10.16.1"})

> [email protected] build:tsgo /Users/raynos/projects/depscan
> tsgo -b --verbose --stopBuildOnErrors

[11:32:47 AM] Projects in this build:
    * submodules/socket-patch/tsconfig.json
    * workspaces/lib/tsconfig.json
    * workspaces/legal-parser/tsconfig.json
    * workspaces/metadata-common/tsconfig.json
    * workspaces/metadata-service/tsconfig.json
    * workspaces/metadata-client/tsconfig.json
    * workspaces/obfuscated-pass/tsconfig.json
    * workspaces/reachability-pattern-tools/tsconfig.json
    * workspaces/pipeline/tsconfig.json
    * workspaces/analytics-schema/tsconfig.json
    * workspaces/clickhouse/tsconfig.json
    * workspaces/kafka/tsconfig.json
    * workspaces/app/tsconfig.json
    * tools/tsconfig.json
    * workspaces/analytics-shared/tsconfig.json
    * workspaces/analytics/tsconfig.json
    * workspaces/api-v0/tsconfig.json
    * workspaces/api-v1/tsconfig.json
    * workspaces/artifact-api-service/tsconfig.json
    * workspaces/artifact-search/tsconfig.json
    * workspaces/firewall-api-proxy/tsconfig.json
    * workspaces/gcp-admin/tsconfig.json
    * workspaces/gcs-bucket-server/tsconfig.json
    * workspaces/github-actions/tsconfig.json
    * workspaces/grafana-dashboards/tsconfig.json
    * workspaces/github-app/tsconfig.json
    * workspaces/github-interposer/tsconfig.json
    * workspaces/hosted-mcp/tsconfig.json
    * workspaces/metadata-service-admin/tsconfig.json
    * workspaces/metrics-exporter/tsconfig.json
    * workspaces/autotester/tsconfig.json
    * workspaces/vanta/tsconfig.json
    * workspaces/mini-services/tsconfig.json
    * workspaces/web-extension/tsconfig.json
    * workspaces/next-app/tsconfig.server.json
    * workspaces/reachability-analyzers-service/tsconfig.json
    * workspaces/subprocess-runner/tsconfig.json
    * tsconfig.json

[11:32:47 AM] Project 'submodules/socket-patch/tsconfig.json' is up to date because newest input 'submodules/socket-patch/src/utils.ts' is older than output 'submodules/socket-patch/dist/tsconfig.tsbuildinfo'

[11:32:47 AM] Project 'workspaces/lib/tsconfig.json' is out of date because buildinfo file 'workspaces/lib/dist/tsconfig.tsbuildinfo' indicates that program needs to report errors.

[11:32:47 AM] Building project 'workspaces/lib/tsconfig.json'...

workspaces/lib/src/api-schema/nullable.ts:37:3 - error TS2742: The inferred type of 'openApiSchema' cannot be named without a reference to '.pnpm/[email protected]/node_modules/openapi-types'. This is likely not portable. A type annotation is necessary.

37   openApiSchema(tracker: OpenApiSchemaTracker<SocketSchema<any>>) {
     ~~~~~~~~~~~~~

[11:32:48 AM] Project 'workspaces/legal-parser/tsconfig.json' can't be built because its dependency 'workspaces/lib' has errors

[11:32:48 AM] Skipping build of project 'workspaces/legal-parser/tsconfig.json' because its dependency 'workspaces/lib' has errors

[11:32:48 AM] Project 'workspaces/metadata-common/tsconfig.json' can't be built because its dependency 'workspaces/lib' has errors

Raynos avatar Nov 11 '25 11:11 Raynos

Not sure if this a real issue, the behavior feels non deterministic. I'm porting my monorepo from tsc => tsgo and reporting edgecases I'm running into in the process.

Raynos avatar Nov 11 '25 11:11 Raynos

can you please paste config of workspaces/lib/tsconfig.json .. does it have noEmitOnError

sheetalkamat avatar Nov 24 '25 20:11 sheetalkamat

"noEmitOnError": true,

It has no emit on error set.

{
  "extends": "../../tsconfig/tsconfig.strictest.json",
  "compilerOptions": {
    "lib": ["es2024", "dom", "dom.iterable"],
    "rootDir": "src",
    "outDir": "dist",
    "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
  },
  "include": [
    "src/**/*.js",
    "src/**/*.json",
    "src/**/*.ts",
    "src/**/*.tsx",
    "../../types/**/*.d.ts",
    "../../reset.d.ts"
  ],
  "references": [
    {
      "path": "../../submodules/socket-patch"
    }
  ]
}

// strictest
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "strict": true,
    "strictNullChecks": true,

    /* Additional checks */
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "forceConsistentCasingInFileNames": true,
    "noUnusedLocals": true,

    /* New checks being tried out */
    "exactOptionalPropertyTypes": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedParameters": true
  }
}

// base
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    "allowJs": true,
    "composite": true,
    "declaration": true,
    "declarationMap": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "incremental": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "lib": ["es2024"],
    "target": "esnext",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "noEmit": false,
    "noEmitOnError": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": false,
    "strictNullChecks": true,
    "noUnusedLocals": true
  }
}

Raynos avatar Nov 25 '25 14:11 Raynos

Can you pullout a small repro for this. I tried few combinations and cannot repro it. All the emits and diagnostics are ordered and guarded by wholeProgram's errors. Its surprising that the first run shows semantic error while second one shows declaration emit error.

sheetalkamat avatar Dec 08 '25 22:12 sheetalkamat