Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeScript 7 toolchain migration: tsgo declaration emit, TS6 tooling alias, entity type alignment - #228

Merged
RohinBhargava merged 9 commits into
mainfrom
rohin/ts7-and-other-deps
Jul 30, 2026
Merged

TypeScript 7 toolchain migration: tsgo declaration emit, TS6 tooling alias, entity type alignment#228
RohinBhargava merged 9 commits into
mainfrom
rohin/ts7-and-other-deps

Conversation

@RohinBhargava

@RohinBhargava RohinBhargava commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the framework and blueprint workspaces to build cleanly on TypeScript 7 (tsgo), and aligns the billing entity/DTO types that the migration surfaced.

Build toolchain

  • tsup --dtstsgo --emitDeclarationOnly across all framework packages and blueprint interfaces/implementations. The typescript@7 package ships no JS Compiler API, so rollup-plugin-dts crashes; worse, its bundling duplicates MikroORM's unique symbol brands, making identical entity types unrelated (TS2719). Per-file declaration emit via tsconfig.build.json (explicit rootDir, entry-scoped include) fixes both.
  • typescript aliased to npm:@typescript/typescript6 in all packages so typescript-eslint/typedoc get the TS 6 API (official side-by-side guidance); tsgo (from @typescript/native-preview) does typechecking and emit.
  • Wildcard subpath exports ("./types/*" etc.) added to blueprint lib packages — tsgo's declaration emitter cannot name types through re-export chains (TS2883).
  • Named type aliases for implements SV<...> first type args — tsgo emits SV<<T>... which it then fails to re-parse (TS1005 cascade in consumers).

API/type fixes surfaced by TS7 typechecking

  • setupRls, ComplianceDataService, RetentionService, testing harness: bare MikroORM params replaced with structural/relaxed types — v7 MikroORM.init() returns a readonly entities array that a bare MikroORM annotation rejects.
  • OTel BatchLogRecordProcessor options-object API, express Request.signal passthrough in the Bun shim.
  • Billing: .nullable() alignment on billingProvider across base/stripe implementations and apps; response DTOs and response schemas mark it optional; mappers coerce null → undefined. Constraint intersections widened to | null | undefined.
  • Stripe SDK apiVersion literals bumped to 2026-06-24.dahlia.

Publishing

  • publishConfig.access: public on all blueprint packages (new scoped packages default to restricted).
  • Workspace root marked private.
  • blockExoticSubdeps: false in framework workspace (uWebSockets.js is git-distributed).

Test plan

  • pnpm -r run build green across framework and blueprint workspaces
  • Framework unit tests pass (validator 350, core 371, express 27)
  • Blueprint E2E suites are blocked by pre-existing gaps unrelated to this change (uncommitted __test__/test-utils.ts, missing ENCRYPTION_KEY in .env.test)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added centralized role and permission definitions for access control, including role-to-permissions mappings.
    • Billing plan and subscription responses now include billingProvider when available.
  • Bug Fixes
    • Made billingProvider optional/nullable across validation, persistence, and exported service contracts (it is omitted cleanly when unset).
  • Chores
    • Updated Stripe plan seeding/sync jobs to use a newer Stripe API version.
    • Refreshed dependencies and publishing/type exports for improved TypeScript declaration publishing.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR makes billing provider fields optional across persistence, validation, entity, DTO, and mapper layers; adds RBAC definitions; updates framework ORM and build typing; refreshes package exports, versions, dependencies, changelogs, and TypeScript build configurations across the workspace.

Changes

Billing provider contract updates

Layer / File(s) Summary
Nullable persistence and validation contracts
blueprint/billing-*/persistence/**, blueprint/implementations/billing/**/domain/schemas/**
billingProvider now accepts null or omission in billing persistence entities and TypeBox/Zod schemas.
Entity, DTO, and mapper types
blueprint/implementations/billing/**/domain/types/**, blueprint/interfaces/billing/types/*
Billing entity shapes and plan/subscription DTOs now allow optional or nullable billingProvider values.
Response mappings
blueprint/billing-*/domain/mappers/*
Plan and subscription DTO mappings now include billingProvider, converting nullish values to undefined.

RBAC and framework compatibility

Layer / File(s) Summary
RBAC definitions
blueprint/core/auth/rbac.*, blueprint/ecommerce-stripe/schema.ts
Permission and role constants, grouped sets, and role-permission mappings were added and re-exported.
Structural ORM contracts
framework/core/src/persistence/rls.ts, framework/core/src/services/*, framework/testing/src/*
Framework services and test harness types now use narrower structural ORM contracts or relaxed MikroORM generics.
Framework runtime and type updates
framework/core/src/**, framework/express/src/**, framework/validator/src/**
Request abort signals and telemetry processor options were updated, while numerous TypeScript type expressions were reformatted or aliased.

Workspace release and build updates

Layer / File(s) Summary
Package build and exports
blueprint/implementations/**/package.json, blueprint/interfaces/**/package.json, framework/*/package.json
Packages gained or updated wildcard exports and separate tsgo declaration-generation steps.
Build configurations
**/tsconfig.build.json, framework/*/tsconfig.json
Build-specific TypeScript configurations and source roots were added across packages.
Versions and tooling
blueprint/**/package.json, framework/**/package.json, cli/src/core/package_json/package_json_constants.rs
Package, dependency, development-tool, changelog, and workspace override versions were refreshed; Stripe scripts now use API version 2026-06-24.dahlia.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main toolchain migration and type-alignment themes in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rohin/ts7-and-other-deps

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🧹 Nitpick comments (1)
blueprint/billing-base/persistence/entities/plan.entity.ts (1)

21-24: 🗄️ Data Integrity & Integration | 🔵 Trivial

Verify the database migration for nullable provider columns.

These persistence definitions now permit NULL; confirm deployed schemas and migrations update every corresponding billingProvider column, including existing rows and rollback behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@blueprint/billing-base/persistence/entities/plan.entity.ts` around lines 21 -
24, Verify and update migrations for every nullable billingProvider definition,
covering blueprint/billing-base/persistence/entities/plan.entity.ts:21-24,
blueprint/billing-stripe/persistence/entities/plan.entity.ts:24-27,
blueprint/billing-stripe/persistence/entities/subscription.entity.ts:21-24, and
both corresponding sites in
blueprint/implementations/billing/stripe/persistence/entities/index.ts:46 and
58. Ensure deployed schemas allow NULL, existing rows are handled safely, and
rollback restores the prior constraint or data behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@blueprint/implementations/billing/base/package.json`:
- Around line 34-57: Align the package exports with the artifacts produced by
the build: update the `exports` entries for `./schemas/*`, `./services/*`, and
`./types/*` to remove the nonexistent wildcard subpaths, or change the build
configuration to emit matching per-file JS/MJS artifacts. Preserve the public
subpaths only if their corresponding runtime files are actually generated.

In `@blueprint/implementations/billing/stripe/package.json`:
- Around line 40-63: Align the wildcard package exports with the files emitted
by the tsup build: either add matching per-file entrypoints for the enum,
schemas, services, and types export patterns, or remove those wildcard exports.
Apply the same correction to
blueprint/implementations/billing/stripe/package.json at lines 40-63 and 69, and
blueprint/implementations/ecommerce/base/package.json at lines 34-51 and 57;
ensure all remaining export targets correspond to actual generated artifacts.

In `@blueprint/implementations/iam/base/package.json`:
- Around line 34-57: Remove the unsupported wildcard subpath export entries for
./types/*, ./schemas/*, and ./services/* from
blueprint/implementations/iam/base/package.json, retaining the barrel-only
exports. Apply the same removal to the wildcard subpath exports in
blueprint/interfaces/ecommerce/package.json; no per-file build entries are
needed.

In `@blueprint/implementations/worker/bullmq/package.json`:
- Around line 40-69: Restrict the wildcard export entries in the package.json
manifests to paths actually emitted by the build, or add matching build
entrypoints for every wildcard module. Apply the same correction to
blueprint/implementations/worker/bullmq/package.json (lines 40-69) and
blueprint/implementations/worker/redis/package.json (lines 40-69), ensuring the
exports for consumers, producers, schemas, and types resolve to generated files.

In `@blueprint/implementations/worker/database/package.json`:
- Around line 40-69: Update the build scripts in
blueprint/implementations/worker/database/package.json (lines 40-69) and
blueprint/implementations/worker/kafka/package.json (lines 40-69) so tsup emits
the leaf modules targeted by the wildcard exports, including consumer, producer,
schema, and type files, while preserving the existing index entrypoints and
declaration generation. Ensure the resulting lib paths match each package’s
exports for both import and require resolution.

In `@cli/src/core/package_json/package_json_constants.rs`:
- Line 48: Update the TYPESCRIPT_VERSION constant to remove the outer caret
while preserving the inner version range, so application.rs writes
npm:`@typescript/typescript6`@^6.0.2 to package.json.

In `@framework/common/package.json`:
- Line 31: Update the declaration build configuration for framework/common so
the root index.ts entry point is included and emits the published
lib/index.d.ts. In framework/common/tsconfig.json, adjust the include/rootDir
settings or relocate the barrel under src while preserving the existing package
build command in framework/common/package.json.

In `@framework/core/package.json`:
- Line 3: Document the published releases consistently: in
framework/core/package.json at lines 3-3, either set the version to the intended
release covered by the changelog or retain 1.5.6; in framework/core/CHANGELOG.md
at lines 3-20, add release-note entries for versions 1.5.5 and 1.5.6, including
their dependency changes.

In `@framework/express/src/cluster/bun.serve.shim.ts`:
- Around line 1105-1108: Update the request handling around the
reqEE/AbortController setup to propagate request.signal into the abort path,
ensuring client cancellation aborts the active writer and responsePromise.
Remove the associated request.signal listener when the response completes or
closes, using the existing response cleanup handlers.

In `@framework/testing/CHANGELOG.md`:
- Around line 3-14: Add a changelog section for version 1.2.21 in
framework/testing/CHANGELOG.md to match the version declared by
framework/testing/package.json, or update the manifest back to 1.2.20 if that
release is not intended.

In `@framework/testing/src/database.ts`:
- Around line 2-10: Update setupTestORM to return Promise<AnyMikroORM> (or an
equivalent generic ORM type), matching the relaxed type used by
clearTestDatabase and the harness. Preserve its existing setup behavior while
ensuring callers receive the aligned ORM contract without variance errors.

---

Nitpick comments:
In `@blueprint/billing-base/persistence/entities/plan.entity.ts`:
- Around line 21-24: Verify and update migrations for every nullable
billingProvider definition, covering
blueprint/billing-base/persistence/entities/plan.entity.ts:21-24,
blueprint/billing-stripe/persistence/entities/plan.entity.ts:24-27,
blueprint/billing-stripe/persistence/entities/subscription.entity.ts:21-24, and
both corresponding sites in
blueprint/implementations/billing/stripe/persistence/entities/index.ts:46 and
58. Ensure deployed schemas allow NULL, existing rows are handled safely, and
rollback restores the prior constraint or data behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 60552b06-d5fe-42f3-ac0d-8a2fd2286500

📥 Commits

Reviewing files that changed from the base of the PR and between 0ead6f3 and b57ac9d.

⛔ Files ignored due to path filters (4)
  • blueprint/core/auth/rbac.d.ts.map is excluded by !**/*.map
  • blueprint/core/auth/rbac.js.map is excluded by !**/*.map
  • blueprint/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • framework/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (147)
  • blueprint/billing-base/domain/mappers/plan.mappers.ts
  • blueprint/billing-base/domain/mappers/subscription.mappers.ts
  • blueprint/billing-base/package.json
  • blueprint/billing-base/persistence/entities/plan.entity.ts
  • blueprint/billing-base/persistence/entities/subscription.entity.ts
  • blueprint/billing-stripe/domain/mappers/plan.mappers.ts
  • blueprint/billing-stripe/domain/mappers/subscription.mappers.ts
  • blueprint/billing-stripe/package.json
  • blueprint/billing-stripe/persistence/entities/plan.entity.ts
  • blueprint/billing-stripe/persistence/entities/subscription.entity.ts
  • blueprint/billing-stripe/scripts/seed-plans-from-stripe.ts
  • blueprint/billing-stripe/scripts/sync-stripe-plans.ts
  • blueprint/client-sdk/package.json
  • blueprint/core/auth/rbac.d.ts
  • blueprint/core/auth/rbac.js
  • blueprint/core/package.json
  • blueprint/ecommerce-stripe/mikro-orm.config.ts
  • blueprint/ecommerce-stripe/package.json
  • blueprint/ecommerce-stripe/schema.ts
  • blueprint/iam-base/package.json
  • blueprint/iam-better-auth/auth.ts
  • blueprint/iam-better-auth/package.json
  • blueprint/implementations/billing/base/CHANGELOG.md
  • blueprint/implementations/billing/base/domain/schemas/typebox/plan.schema.ts
  • blueprint/implementations/billing/base/domain/schemas/typebox/subscription.schema.ts
  • blueprint/implementations/billing/base/domain/schemas/zod/plan.schema.ts
  • blueprint/implementations/billing/base/domain/schemas/zod/subscription.schema.ts
  • blueprint/implementations/billing/base/domain/types/baseBillingEntity.types.ts
  • blueprint/implementations/billing/base/package.json
  • blueprint/implementations/billing/base/tsconfig.build.json
  • blueprint/implementations/billing/stripe/CHANGELOG.md
  • blueprint/implementations/billing/stripe/domain/schemas/typebox/plan.schema.ts
  • blueprint/implementations/billing/stripe/domain/schemas/typebox/subscription.schema.ts
  • blueprint/implementations/billing/stripe/domain/schemas/zod/plan.schema.ts
  • blueprint/implementations/billing/stripe/domain/schemas/zod/subscription.schema.ts
  • blueprint/implementations/billing/stripe/domain/types/stripe.entity.types.ts
  • blueprint/implementations/billing/stripe/package.json
  • blueprint/implementations/billing/stripe/persistence/entities/index.ts
  • blueprint/implementations/billing/stripe/tsconfig.build.json
  • blueprint/implementations/ecommerce/base/CHANGELOG.md
  • blueprint/implementations/ecommerce/base/package.json
  • blueprint/implementations/ecommerce/base/tsconfig.build.json
  • blueprint/implementations/iam/base/CHANGELOG.md
  • blueprint/implementations/iam/base/package.json
  • blueprint/implementations/iam/base/tsconfig.build.json
  • blueprint/implementations/worker/bullmq/CHANGELOG.md
  • blueprint/implementations/worker/bullmq/package.json
  • blueprint/implementations/worker/bullmq/tsconfig.build.json
  • blueprint/implementations/worker/database/CHANGELOG.md
  • blueprint/implementations/worker/database/package.json
  • blueprint/implementations/worker/database/tsconfig.build.json
  • blueprint/implementations/worker/kafka/CHANGELOG.md
  • blueprint/implementations/worker/kafka/package.json
  • blueprint/implementations/worker/kafka/tsconfig.build.json
  • blueprint/implementations/worker/redis/CHANGELOG.md
  • blueprint/implementations/worker/redis/package.json
  • blueprint/implementations/worker/redis/tsconfig.build.json
  • blueprint/interfaces/billing/CHANGELOG.md
  • blueprint/interfaces/billing/package.json
  • blueprint/interfaces/billing/tsconfig.build.json
  • blueprint/interfaces/billing/types/plan.service.types.ts
  • blueprint/interfaces/billing/types/subscription.service.types.ts
  • blueprint/interfaces/ecommerce/CHANGELOG.md
  • blueprint/interfaces/ecommerce/package.json
  • blueprint/interfaces/ecommerce/tsconfig.build.json
  • blueprint/interfaces/iam/CHANGELOG.md
  • blueprint/interfaces/iam/package.json
  • blueprint/interfaces/iam/tsconfig.build.json
  • blueprint/interfaces/worker/CHANGELOG.md
  • blueprint/interfaces/worker/package.json
  • blueprint/interfaces/worker/tsconfig.build.json
  • blueprint/monitoring/package.json
  • blueprint/package.json
  • blueprint/pnpm-workspace.yaml
  • blueprint/sample-worker/package.json
  • cli/src/core/package_json/package_json_constants.rs
  • framework/bunrun/CHANGELOG.md
  • framework/bunrun/package.json
  • framework/bunrun/tsup.config.ts
  • framework/common/CHANGELOG.md
  • framework/common/package.json
  • framework/common/tsconfig.json
  • framework/core/CHANGELOG.md
  • framework/core/__test__/compliance.test.ts
  • framework/core/package.json
  • framework/core/src/http/mcpGenerator/mcpGenerator.ts
  • framework/core/src/http/middleware/request/auth.middleware.ts
  • framework/core/src/http/middleware/request/enrichDetails.middleware.ts
  • framework/core/src/http/openApiV3Generator/openApiV3Generator.ts
  • framework/core/src/http/router/expressLikeRouter.ts
  • framework/core/src/http/router/routerSharedLogic.ts
  • framework/core/src/http/telemetry/openTelemetryCollector.ts
  • framework/core/src/http/types/apiDefinition.types.ts
  • framework/core/src/http/types/contractDetails.types.ts
  • framework/core/src/http/types/expressLikeRouter.types.ts
  • framework/core/src/http/types/sdk.types.ts
  • framework/core/src/persistence/defineComplianceEntity.ts
  • framework/core/src/persistence/rls.ts
  • framework/core/src/services/complianceDataService.ts
  • framework/core/src/services/retentionService.ts
  • framework/core/src/ws/webSocketLike.ts
  • framework/core/tsconfig.build.json
  • framework/e2e-tests/package.json
  • framework/express/CHANGELOG.md
  • framework/express/package.json
  • framework/express/src/cluster/bun.serve.shim.ts
  • framework/express/src/expressApplication.ts
  • framework/express/tsconfig.build.json
  • framework/hyper-express/CHANGELOG.md
  • framework/hyper-express/package.json
  • framework/hyper-express/src/hyperExpressApplication.ts
  • framework/hyper-express/tsconfig.build.json
  • framework/infrastructure/S3/CHANGELOG.md
  • framework/infrastructure/S3/package.json
  • framework/infrastructure/S3/tsconfig.build.json
  • framework/infrastructure/redis/CHANGELOG.md
  • framework/infrastructure/redis/index.ts
  • framework/infrastructure/redis/package.json
  • framework/infrastructure/redis/tsconfig.build.json
  • framework/internal/CHANGELOG.md
  • framework/internal/package.json
  • framework/internal/tsconfig.json
  • framework/package.json
  • framework/pnpm-workspace.yaml
  • framework/testing/CHANGELOG.md
  • framework/testing/package.json
  • framework/testing/src/containers.ts
  • framework/testing/src/database.ts
  • framework/testing/src/harness.ts
  • framework/testing/tsconfig.build.json
  • framework/universal-sdk/CHANGELOG.md
  • framework/universal-sdk/package.json
  • framework/universal-sdk/src/universalSdk.ts
  • framework/universal-sdk/tsconfig.build.json
  • framework/validator/CHANGELOG.md
  • framework/validator/__test__/utils/mockSchemaValidator.ts
  • framework/validator/package.json
  • framework/validator/shims/zod-v3-openapi/zod-openapi.ts
  • framework/validator/src/shared/types/schema.types.ts
  • framework/validator/src/typebox/typeboxSchemaValidator.ts
  • framework/validator/src/zod/types/schema.types.ts
  • framework/validator/src/zod/zodSchemaValidator.ts
  • framework/validator/tsconfig.build.json
  • framework/ws/CHANGELOG.md
  • framework/ws/package.json
  • framework/ws/src/__tests__/webSocketIntegration.test.ts
  • framework/ws/tsconfig.build.json

Comment thread blueprint/implementations/billing/base/package.json
Comment thread blueprint/implementations/billing/stripe/package.json
Comment thread blueprint/implementations/iam/base/package.json
Comment thread blueprint/implementations/worker/bullmq/package.json
Comment on lines +40 to +69
"./consumers/*": {
"types": "./lib/consumers/*.d.ts",
"import": "./lib/consumers/*.mjs",
"require": "./lib/consumers/*.js",
"default": "./lib/consumers/*.js"
},
"./producers/*": {
"types": "./lib/producers/*.d.ts",
"import": "./lib/producers/*.mjs",
"require": "./lib/producers/*.js",
"default": "./lib/producers/*.js"
},
"./schemas/*": {
"types": "./lib/domain/schemas/*.d.ts",
"import": "./lib/domain/schemas/*.mjs",
"require": "./lib/domain/schemas/*.js",
"default": "./lib/domain/schemas/*.js"
},
"./types/*": {
"types": "./lib/domain/types/*.d.ts",
"import": "./lib/domain/types/*.mjs",
"require": "./lib/domain/types/*.js",
"default": "./lib/domain/types/*.js"
}
},
"files": [
"lib/**"
],
"scripts": {
"build": "tsgo --noEmit && tsup producers/index.ts consumers/index.ts domain/schemas/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
"build": "tsgo --noEmit && tsup producers/index.ts consumers/index.ts domain/schemas/index.ts domain/types/index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --out-dir lib --clean && tsgo -p tsconfig.build.json --emitDeclarationOnly && if [ -f eject-package.bash ]; then pnpm package:eject; fi",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Run after the package build in CI; do not rebuild here.
set -euo pipefail

for package_dir in \
  blueprint/implementations/worker/database \
  blueprint/implementations/worker/kafka
do
  fd -t f -e ts -E index.ts . \
    "$package_dir/consumers" \
    "$package_dir/producers" \
    "$package_dir/domain/schemas" \
    "$package_dir/domain/types" |
  while IFS= read -r source; do
    relative="${source#"$package_dir"/}"
    expected="$package_dir/lib/${relative%.ts}.mjs"
    test -f "$expected" || printf 'Missing wildcard export target: %s\n' "$expected"
  done
done

Repository: forklaunch/forklaunch

Length of output: 1551


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for pkg in blueprint/implementations/worker/database blueprint/implementations/worker/kafka; do
  echo "## $pkg"
  echo "--- package.json scripts/exports/files ---"
  python3 - <<'PY' "$pkg/package.json"
import json, sys
p = sys.argv[1]
with open(p) as f:
    data = json.load(f)
for k in ["scripts", "exports", "files"]:
    print(f"[{k}]")
    print(data.get(k))
PY
  echo "--- source tree (selected) ---"
  find "$pkg" -maxdepth 4 -type f \( \
    -path "*/consumers/*.ts" -o \
    -path "*/producers/*.ts" -o \
    -path "*/domain/schemas/*.ts" -o \
    -path "*/domain/types/*.ts" \
  \) | sort
  echo
done

Repository: forklaunch/forklaunch

Length of output: 6156


Emit the leaf modules for these wildcard exports.

tsup only builds the four index.ts entrypoints, but these wildcard exports point at leaf files like ./consumers/databaseWorker.consumer and ./domain/schemas/databaseWorker.schema. Those paths will not exist under lib/** in the published package, so imports through the new subpath exports will fail in both:

  • blueprint/implementations/worker/database/package.json
  • blueprint/implementations/worker/kafka/package.json
📍 Affects 2 files
  • blueprint/implementations/worker/database/package.json#L40-L69 (this comment)
  • blueprint/implementations/worker/kafka/package.json#L40-L69
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@blueprint/implementations/worker/database/package.json` around lines 40 - 69,
Update the build scripts in
blueprint/implementations/worker/database/package.json (lines 40-69) and
blueprint/implementations/worker/kafka/package.json (lines 40-69) so tsup emits
the leaf modules targeted by the wildcard exports, including consumer, producer,
schema, and type files, while preserving the existing index entrypoints and
declaration generation. Ensure the resulting lib paths match each package’s
exports for both import and require resolution.

],
"scripts": {
"build": "tsgo --noEmit && tsup index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
"build": "tsgo --noEmit && tsup index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --clean && tsgo --emitDeclarationOnly",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
jq '{build: .scripts.build, types, exports}' framework/common/package.json
jq '{rootDir: .compilerOptions.rootDir, include}' framework/common/tsconfig.json
sed -n '1,80p' framework/common/index.ts

Repository: forklaunch/forklaunch

Length of output: 604


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n[framework/common files]\n'
git ls-files framework/common | sed -n '1,120p'

printf '\n[framework/common index + tsconfig + package]\n'
cat -n framework/common/index.ts
printf '\n--- tsconfig ---\n'
cat -n framework/common/tsconfig.json
printf '\n--- package ---\n'
cat -n framework/common/package.json

Repository: forklaunch/forklaunch

Length of output: 159


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '"lib/index\.d\.ts"|index\.d\.ts|emitDeclarationOnly|tsgo --emitDeclarationOnly' -S framework common . || true

Repository: forklaunch/forklaunch

Length of output: 159


Emit declarations for the package entry point.
framework/common/package.json publishes lib/index.d.ts, but framework/common/tsconfig.json only includes src/**/*.ts and uses rootDir: "src", so the root index.ts barrel that tsup builds has no matching declaration output. Include index.ts in the declaration project or move the barrel under src/ so the published types file exists.

📍 Affects 2 files
  • framework/common/package.json#L31-L31 (this comment)
  • framework/common/tsconfig.json#L4-L7
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/common/package.json` at line 31, Update the declaration build
configuration for framework/common so the root index.ts entry point is included
and emits the published lib/index.d.ts. In framework/common/tsconfig.json,
adjust the include/rootDir settings or relocate the barrel under src while
preserving the existing package build command in framework/common/package.json.

Comment thread framework/core/package.json Outdated
Comment thread framework/express/src/cluster/bun.serve.shim.ts
Comment thread framework/testing/CHANGELOG.md
Comment thread framework/testing/src/database.ts
pnpm publish rewrites workspace:* to an exact version, so published
packages hard-pinned stale siblings ([email protected] -> [email protected]),
producing duplicate @forklaunch/core instances and TS2883 in scaffolded
apps. workspace:^ publishes caret ranges instead. Republished all
framework packages with inter-deps and all blueprint interface/
implementation packages (also picking up the tsgo declaration-emit
output).

Co-Authored-By: Claude Fable 5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
blueprint/implementations/billing/base/package.json (1)

33-57: ⚠️ Potential issue | 🟠 Major

Wildcard export targets still lack matching runtime artifacts across the implementation packages. The tsgo declaration-only migration does not add the JS/MJS leaf files advertised by these exports.

  • blueprint/implementations/billing/base/package.json#L33-L57: remove or emit matching schemas, services, and types leaf modules.
  • blueprint/implementations/billing/stripe/package.json#L39-L69: remove or emit matching enum, schemas, services, and types leaf modules.
  • blueprint/implementations/ecommerce/base/package.json#L33-L57: remove or emit matching schemas, services, and types leaf modules.
  • blueprint/implementations/iam/base/package.json#L33-L57: remove or emit matching types, schemas, and services leaf modules.
  • blueprint/implementations/worker/bullmq/package.json#L39-L69: remove or emit matching consumers, producers, schemas, and types leaf modules.
  • blueprint/implementations/worker/database/package.json#L39-L63: remove or emit matching consumers, producers, schemas, and types leaf modules.
  • blueprint/implementations/worker/redis/package.json#L39-L63: remove or emit matching consumers, producers, schemas, and types leaf modules.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@blueprint/implementations/billing/base/package.json` around lines 33 - 57,
Update the package export maps or build outputs so every wildcard export
resolves to matching runtime JS/MJS artifacts, not declarations alone. In
blueprint/implementations/billing/base/package.json (lines 33-57), remove or
emit schemas, services, and types leaf modules; apply the same change to
billing/stripe/package.json (lines 39-69) for enum, schemas, services, and
types; ecommerce/base/package.json (lines 33-57) for schemas, services, and
types; iam/base/package.json (lines 33-57) for types, schemas, and services;
worker/bullmq/package.json (lines 39-69) for consumers, producers, schemas, and
types; worker/database/package.json (lines 39-63) for consumers, producers,
schemas, and types; and worker/redis/package.json (lines 39-63) for consumers,
producers, schemas, and types.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@blueprint/implementations/billing/base/package.json`:
- Around line 33-57: Update the package export maps or build outputs so every
wildcard export resolves to matching runtime JS/MJS artifacts, not declarations
alone. In blueprint/implementations/billing/base/package.json (lines 33-57),
remove or emit schemas, services, and types leaf modules; apply the same change
to billing/stripe/package.json (lines 39-69) for enum, schemas, services, and
types; ecommerce/base/package.json (lines 33-57) for schemas, services, and
types; iam/base/package.json (lines 33-57) for types, schemas, and services;
worker/bullmq/package.json (lines 39-69) for consumers, producers, schemas, and
types; worker/database/package.json (lines 39-63) for consumers, producers,
schemas, and types; and worker/redis/package.json (lines 39-63) for consumers,
producers, schemas, and types.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e384b86a-3ce1-415a-80f7-a8a32df1ce03

📥 Commits

Reviewing files that changed from the base of the PR and between b57ac9d and 65b4a58.

⛔ Files ignored due to path filters (2)
  • blueprint/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • framework/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (29)
  • blueprint/billing-base/package.json
  • blueprint/billing-stripe/package.json
  • blueprint/client-sdk/package.json
  • blueprint/ecommerce-stripe/package.json
  • blueprint/iam-base/package.json
  • blueprint/iam-better-auth/package.json
  • blueprint/implementations/billing/base/package.json
  • blueprint/implementations/billing/stripe/package.json
  • blueprint/implementations/ecommerce/base/package.json
  • blueprint/implementations/iam/base/package.json
  • blueprint/implementations/worker/bullmq/package.json
  • blueprint/implementations/worker/database/package.json
  • blueprint/implementations/worker/kafka/package.json
  • blueprint/implementations/worker/redis/package.json
  • blueprint/interfaces/billing/package.json
  • blueprint/interfaces/ecommerce/package.json
  • blueprint/interfaces/iam/package.json
  • blueprint/interfaces/worker/package.json
  • blueprint/sample-worker/package.json
  • framework/core/package.json
  • framework/e2e-tests/package.json
  • framework/express/package.json
  • framework/hyper-express/package.json
  • framework/infrastructure/S3/package.json
  • framework/infrastructure/redis/package.json
  • framework/internal/package.json
  • framework/universal-sdk/package.json
  • framework/validator/package.json
  • framework/ws/package.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • blueprint/interfaces/billing/package.json
  • blueprint/interfaces/ecommerce/package.json
  • framework/infrastructure/S3/package.json
  • blueprint/client-sdk/package.json
  • blueprint/implementations/worker/kafka/package.json
  • blueprint/interfaces/worker/package.json
  • blueprint/interfaces/iam/package.json

RohinBhargava and others added 3 commits July 29, 2026 18:24
tsgo's declaration emitter names types by their declaring file, which
must be directly importable via the exports map. The per-file d.ts
trees (replacing rollup-bundled declarations) made deep files like
universal-sdk lib/src/types/contentTypes.types.d.ts unaddressable,
breaking scaffolded client-sdk builds with TS2883.

Co-Authored-By: Claude Fable 5 <[email protected]>
- wildcard subpath exports restricted to the types condition; the
  import/require targets advertised files the build never emits
- CLI TYPESCRIPT_VERSION had a stray leading caret before the npm:
  alias protocol
- bun.serve shim: forward client aborts (request.signal) into the
  shim abort controller so writer/responsePromise are released
- setupTestORM returns AnyMikroORM to match the relaxed harness types
- backfill @forklaunch/core and @forklaunch/testing changelogs

Co-Authored-By: Claude Fable 5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/express/src/cluster/bun.serve.shim.ts`:
- Around line 1424-1433: Update the client-abort handling around onClientAbort
so it also settles responsePromise by invoking ensureResponse() when the request
aborts, including when request.signal is already aborted. Preserve the existing
abort-controller forwarding and listener cleanup behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4699d716-afb2-4d9d-8909-1026e91be2f8

📥 Commits

Reviewing files that changed from the base of the PR and between d49b8ec and 3548e53.

📒 Files selected for processing (28)
  • blueprint/implementations/billing/base/package.json
  • blueprint/implementations/billing/stripe/package.json
  • blueprint/implementations/ecommerce/base/package.json
  • blueprint/implementations/iam/base/package.json
  • blueprint/implementations/worker/bullmq/package.json
  • blueprint/implementations/worker/database/package.json
  • blueprint/implementations/worker/kafka/package.json
  • blueprint/implementations/worker/redis/package.json
  • blueprint/interfaces/billing/package.json
  • blueprint/interfaces/ecommerce/package.json
  • blueprint/interfaces/iam/package.json
  • blueprint/interfaces/worker/package.json
  • cli/src/core/package_json/package_json_constants.rs
  • framework/common/package.json
  • framework/core/CHANGELOG.md
  • framework/core/package.json
  • framework/express/package.json
  • framework/express/src/cluster/bun.serve.shim.ts
  • framework/hyper-express/package.json
  • framework/infrastructure/S3/package.json
  • framework/infrastructure/redis/package.json
  • framework/internal/package.json
  • framework/testing/CHANGELOG.md
  • framework/testing/package.json
  • framework/testing/src/database.ts
  • framework/universal-sdk/package.json
  • framework/validator/package.json
  • framework/ws/package.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • framework/testing/CHANGELOG.md
  • framework/testing/src/database.ts
  • framework/core/CHANGELOG.md

Comment on lines +1424 to +1433
// client disconnects surface on the fetch request signal; forward them
// so writer/responsePromise are released
const onClientAbort = () => abort.abort();
if (request.signal.aborted) {
abort.abort();
} else {
request.signal.addEventListener('abort', onClientAbort, {
once: true
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Settle responsePromise on client abort.

The new forwarding reaches onAbort, but that path never calls ensureResponse(). If the client disconnects before headers are sent, return await responsePromise remains pending and retains the request state.

Proposed fix
 const onAbort = () => {
+  ensureResponse();
   cleanup();
   Object.assign(req, {
     aborted: true,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// client disconnects surface on the fetch request signal; forward them
// so writer/responsePromise are released
const onClientAbort = () => abort.abort();
if (request.signal.aborted) {
abort.abort();
} else {
request.signal.addEventListener('abort', onClientAbort, {
once: true
});
}
const onAbort = () => {
ensureResponse();
cleanup();
Object.assign(req, {
aborted: true,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/express/src/cluster/bun.serve.shim.ts` around lines 1424 - 1433,
Update the client-abort handling around onClientAbort so it also settles
responsePromise by invoking ensureResponse() when the request aborts, including
when request.signal is already aborted. Preserve the existing abort-controller
forwarding and listener cleanup behavior.

@RohinBhargava
RohinBhargava merged commit 8f5ee4c into main Jul 30, 2026
16 checks passed
@RohinBhargava
RohinBhargava deleted the rohin/ts7-and-other-deps branch July 30, 2026 03:53
RohinBhargava added a commit that referenced this pull request Jul 31, 2026
…npm placeholders (#230)

## Summary

Fixes the scaffold issues that force downstream consumers (ForkLaunch
Studio) to patch generated files after `init`. Audit of the reported
five items against main:

| # | Issue | Status |
|---|-------|--------|
| 1 | pnpm-workspace.yaml placeholder breaks installs; re-init clobbers
fixes | **Fixed here** |
| 2 | MikroORM version skew (7.0.15 vs 7.1.8) | Already fixed on main
(#228): CLI pins 7.1.8, scaffold resolves a single instance |
| 3 | BullMqWorkerOptions.queueOptions TS2345 | Not reproducible on
main: scaffold emits concrete `queueOptions`, fresh `init worker -t
bullmq` + `tsc --noEmit` passes with 0 errors (was collateral of the
#2-era duplicate-package skew) |
| 4 | Root workspace globs `apps/*` | Not present on main: the CLI emits
no root pnpm-workspace.yaml and no `apps/*` glob anywhere |
| 5 | Bun temp-dir sandbox blocks module installs | **Mitigated here** |

## Root cause for #1

The placeholder text is written by **pnpm itself**, not the CLI: the
post-init `pnpm format` triggers pnpm 11's auto-install, which blocks
unapproved build scripts and injects `allowBuilds: { esbuild: set this
to true or false, ... }` into the workspace yaml. The CLI then made it
unfixable: every `init service/router/worker` and `change application`
round-tripped the yaml through a `packages`-only struct, silently
dropping `allowBuilds` and any other consumer-added keys.

## Changes

- `generate_pnpm_workspace` seeds `allowBuilds: true` for the scaffold's
known build-script deps, so pnpm never injects placeholders
- The workspace struct preserves unmodeled keys (`overrides`,
`blockExoticSubdeps`, ...) via serde flatten, and every rewrite heals
placeholder string values to `true`
- `change application` renders through the same preserving helper
instead of a from-scratch struct
- `release create` bun installs get a project-local `TMPDIR` so Bun's
temporary-directory sandbox cannot block them
- New fixture test (`init_worker_workspace_and_typecheck.sh`): scaffolds
fresh, asserts no placeholders + `allowBuilds` seeded, asserts survival
across `init worker`/`init service`, poisons the yaml with placeholders
+ foreign keys and asserts healing + preservation, then requires `pnpm
install` and per-project `tsc --noEmit` to pass with zero patches

## Test plan

- `cargo test`: 327 passed
- Fixture script run locally end-to-end: passes (install clean, `tsgo
--noEmit` clean in core/worker/service, full build green)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Workspace configuration now supports build-script allowlists for safer
dependency installation.
- Existing workspace settings, including custom configuration, are
preserved when projects are initialized or updated.
- Missing workspace package entries and pnpm placeholders are
automatically restored.

- **Bug Fixes**
  - Runtime switching now keeps workspace package definitions intact.
- Bun dependency installation uses a project-local temporary directory,
improving reliability in restricted environments.
  - Invalid build allowlist values are normalized automatically.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Fable 5 <[email protected]>
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