Repository navigation
Keep @prisma-next/config path-agnostic for contract sources - #356
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR refactors the contract source provider API from a directly-callable async function to a structured object with Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI/Vite Plugin
participant ConfigLoader as Config Loader
participant Validator as Validator
participant Provider as Contract Source Provider
participant FS as File System
CLI->>ConfigLoader: loadConfig(configPath)
ConfigLoader->>ConfigLoader: resolve config path + load via c12
ConfigLoader->>Validator: validateConfig(config)
Validator->>Validator: validate contract.source.load (function)
Validator->>Validator: validate contract.source.inputs (array)
Validator->>Validator: validate no inputs match output artifacts
Validator-->>ConfigLoader: validated config
ConfigLoader-->>CLI: PrismaNextConfig
CLI->>CLI: resolveWatchedFiles()
CLI->>CLI: collect config path + contract.source.inputs
CLI->>CLI: build module graph from config + input paths
CLI->>CLI: filter out contract output artifacts
CLI-->>CLI: watched file set
CLI->>Provider: source.load(context, { configDir })
FS->>Provider: resolve contractPath relative to configDir
Provider->>FS: read/parse schema or import module
Provider-->>CLI: Result<Contract, Diagnostics>
CLI->>CLI: emit contract + update watched files
FS-->>CLI: file system watches for changes
CLI->>CLI: handleTrackedFileChange(file)
alt file in ignoredOutputFiles
CLI-->>CLI: ignore (self-triggered)
else file in watchedFiles
CLI->>Provider: source.load(...) again
Provider-->>CLI: Result<Contract>
CLI->>CLI: emit contract
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/middleware-telemetry
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/runtime-executor
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/1-framework/3-tooling/cli/test/config-loader.test.ts (1)
68-167: Good coverage of the new metadata paths.The four new cases exercise the authoritative-inputs,
moduleGraph, default-artifact filtering, and fallback-warning branches. Use oftoEqualon the fullcontractWatchobject is aligned with the "prefer object matchers" guideline.One small suggestion: the last case uses
result.metadata.contractWatch?.inputswith optional chaining; sincecontractis present in the config,contractWatchis guaranteed non-null — prefer a non-null assertion or assert on the full object viatoEqual/toMatchObjectto keep style consistent with the other three cases.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/test/config-loader.test.ts` around lines 68 - 167, The test uses optional chaining when asserting contract watch metadata (result.metadata.contractWatch?.inputs) but contract is always present here; replace the optional assertion with a non-null assertion or assert the entire object like the other tests (e.g., expect(result.metadata.contractWatch).toEqual(...) or toMatchObject(...)) so the style is consistent with the other cases and avoids the unnecessary optional chaining (refer to result.metadata.contractWatch and the surrounding it block).packages/1-framework/3-tooling/cli/src/config-loader.ts (1)
47-50: Unnecessary optional chaining onoutputJsonPath.
resolve(...)always returns a non-nullable string, sooutputJsonPath?.endsWith('.json')can be simplified tooutputJsonPath.endsWith('.json').Proposed nit
- const outputDtsPath = outputJsonPath?.endsWith('.json') + const outputDtsPath = outputJsonPath.endsWith('.json') ? `${outputJsonPath.slice(0, -5)}.d.ts` : undefined;Also worth noting: when
contract.outputuses a non-.jsonextension, the colocated.d.tsartifact won't be filtered out ofwatchInputs. That's probably fine given the canonical output is.json, but worth a comment if that's intentional.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/src/config-loader.ts` around lines 47 - 50, The optional chaining on outputJsonPath is unnecessary because resolve(...) always returns a string; update the conditional that sets outputDtsPath to use outputJsonPath.endsWith('.json') instead of outputJsonPath?.endsWith('.json') and remove the redundant null-safety. Locate the code that computes outputJsonPath (uses resolve(configDir, contract.output ?? DEFAULT_CONTRACT_OUTPUT)) and outputDtsPath and make the change; optionally add a brief comment near outputDtsPath noting that non-".json" contract.output values will not produce a colocated ".d.ts" (so watchInputs may include it) if you want to document that behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/1-framework/3-tooling/cli/src/config-loader.ts`:
- Around line 47-50: The optional chaining on outputJsonPath is unnecessary
because resolve(...) always returns a string; update the conditional that sets
outputDtsPath to use outputJsonPath.endsWith('.json') instead of
outputJsonPath?.endsWith('.json') and remove the redundant null-safety. Locate
the code that computes outputJsonPath (uses resolve(configDir, contract.output
?? DEFAULT_CONTRACT_OUTPUT)) and outputDtsPath and make the change; optionally
add a brief comment near outputDtsPath noting that non-".json" contract.output
values will not produce a colocated ".d.ts" (so watchInputs may include it) if
you want to document that behavior.
In `@packages/1-framework/3-tooling/cli/test/config-loader.test.ts`:
- Around line 68-167: The test uses optional chaining when asserting contract
watch metadata (result.metadata.contractWatch?.inputs) but contract is always
present here; replace the optional assertion with a non-null assertion or assert
the entire object like the other tests (e.g.,
expect(result.metadata.contractWatch).toEqual(...) or toMatchObject(...)) so the
style is consistent with the other cases and avoids the unnecessary optional
chaining (refer to result.metadata.contractWatch and the surrounding it block).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 75bf42d9-cb80-4ee9-b957-e1dbac73ee33
📒 Files selected for processing (20)
packages/1-framework/1-core/config/README.mdpackages/1-framework/1-core/config/src/config-types.tspackages/1-framework/1-core/config/src/config-validation.tspackages/1-framework/1-core/config/test/config-types.test-d.tspackages/1-framework/1-core/config/test/config-validation.test.tspackages/1-framework/3-tooling/cli/src/config-loader.tspackages/1-framework/3-tooling/cli/test/config-loader.test.tspackages/1-framework/3-tooling/cli/test/config-types.test.tspackages/2-mongo-family/2-authoring/contract-psl/src/provider.tspackages/2-mongo-family/2-authoring/contract-psl/test/provider.test.tspackages/2-mongo-family/2-authoring/contract-ts/src/config-types.tspackages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.tspackages/2-sql/2-authoring/contract-psl/src/provider.tspackages/2-sql/2-authoring/contract-psl/test/provider.test.tspackages/2-sql/2-authoring/contract-ts/src/config-types.tspackages/2-sql/2-authoring/contract-ts/test/config-types.test.tspackages/3-extensions/mongo/src/config/define-config.tspackages/3-extensions/mongo/test/config/define-config.test.tspackages/3-extensions/postgres/src/config/define-config.tspackages/3-extensions/postgres/test/config/define-config.test.ts
There was a problem hiding this comment.
I like the direction to make a ContractSourceProvider explicitly return its sources. I don't think the framework should be aware of dev watcher integrations though. Also watchStrategy appears to have no consumer and it's unclear from its doc comment what its future purpose will be. In any case, this doesn't belong in Prisma Next config, it belongs in the watcher integration's config
So I recommend:
- rename the watcher-coupled properties of the contractProvider to be consumer agnostic, eg
watcherInputscould as easily besourcesorsourceFilesetc - move watcher-specific config (
watcherStrategy) to the watcher integration (ie the vite or NextJS integratio)
|
I agree with this review. The current change solves the Vite invalidation problem, but it does it at the wrong boundary: it teaches I think the cleaner model is:
So instead of
That also addresses the “why is this optional?” point. Every provider should declare its authoritative source model explicitly. For built-ins, that means:
Then the Vite plugin can resolve that provider metadata into watched files, filter out emitted artifacts, and handle the partial-coverage warning there. That keeps the fallback behavior we want for custom providers, but avoids encoding it as implicit back-compat logic in the generic config loader. I'll get rid of the retro-compatibility that snuck in. Separately, if any validation remains for this shape, it should live in the Arktype schema rather than in ad hoc manual checks. |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
test/integration/test/cli.emit-command.test.ts (1)
568-570:⚠️ Potential issue | 🟡 MinorStale type annotation for
sourceResult.
typeof providerConfig.contract['source']is now an object (withauthoritativeInputs+load), not a callable, soReturnType<...>on it is invalid. The annotation happens to still resolve (likely tonever/broken inference) but no longer describes the load result. UseReturnType<NonNullable<typeof providerConfig.contract>['source']['load']>instead.Proposed fix
- let sourceResult: Awaited< - ReturnType<NonNullable<typeof providerConfig.contract>['source']> - >; + let sourceResult: Awaited< + ReturnType<NonNullable<typeof providerConfig.contract>['source']['load']> + >;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/integration/test/cli.emit-command.test.ts` around lines 568 - 570, The type annotation for sourceResult is stale because providerConfig.contract['source'] is now an object with a load method; update the declaration to use the load method's return type by replacing ReturnType<NonNullable<typeof providerConfig.contract>['source']> with ReturnType<NonNullable<typeof providerConfig.contract>['source']['load']> (keep the NonNullable wrapper) so sourceResult correctly reflects the load result from providerConfig.contract.source.load.test/integration/test/authoring/cli.emit-parity-fixtures.test.ts (1)
95-98:⚠️ Potential issue | 🟡 MinorUpdate
ReturnType<typeof …source>annotations to target.source.load.Same issue as in
cli.emit-command.test.ts:contract.sourceis now an object, not a function, soReturnType<typeof tsConfig.contract.source>(and the matching psl/diagnostics ones) no longer reflects theload()result type. Point these at.source.loadinstead.Proposed fix
- let tsProviderResultFirst: Awaited<ReturnType<typeof tsConfig.contract.source>>; - let tsProviderResultSecond: Awaited<ReturnType<typeof tsConfig.contract.source>>; - let pslProviderResultFirst: Awaited<ReturnType<typeof pslConfig.contract.source>>; - let pslProviderResultSecond: Awaited<ReturnType<typeof pslConfig.contract.source>>; + let tsProviderResultFirst: Awaited<ReturnType<typeof tsConfig.contract.source.load>>; + let tsProviderResultSecond: Awaited<ReturnType<typeof tsConfig.contract.source.load>>; + let pslProviderResultFirst: Awaited<ReturnType<typeof pslConfig.contract.source.load>>; + let pslProviderResultSecond: Awaited<ReturnType<typeof pslConfig.contract.source.load>>; ... - let sourceResult: Awaited<ReturnType<typeof pslConfig.contract.source>>; + let sourceResult: Awaited<ReturnType<typeof pslConfig.contract.source.load>>;Also applies to: 241-241
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/integration/test/authoring/cli.emit-parity-fixtures.test.ts` around lines 95 - 98, The type aliases for provider result variables use ReturnType<typeof ...contract.source> but contract.source is now an object; change the annotations to target the load method return type instead (e.g., use Awaited<ReturnType<typeof tsConfig.contract.source.load>> for tsProviderResultFirst/Second and similarly use Awaited<ReturnType<typeof pslConfig.contract.source.load>> for pslProviderResultFirst/Second and update any diagnostics-related ReturnType references to point at .source.load as well) so the types reflect the result of calling source.load().
🧹 Nitpick comments (2)
packages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.ts (1)
81-86: Redundant manual validation — already enforced byContractSourceProviderSchema.
loadConfig()runsContractConfigSchemaviavalidateContractConfig, which requirescontract.sourceto be an object withauthoritativeInputsandload: Function. By the time this code runs,contractConfig.source.loadis guaranteed to be a function. Per the PR direction to move provider-shape validation into the Arktype schema, and per guideline to prefer assertions over defensive checks once validated, this block can be dropped.♻️ Proposed cleanup
- // Validate source exists and is callable - if (typeof contractConfig.source?.load !== 'function') { - throw errorContractConfigMissing({ - why: 'Contract config must include a valid source provider object', - }); - } -As per coding guidelines: "Use schema validators (Arktype) for structural validation of required fields, types, and shapes rather than redundant manual checks for these properties."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.ts` around lines 81 - 86, Remove the redundant runtime check for contractConfig.source.load in loadConfig(): since validateContractConfig runs ContractConfigSchema/ContractSourceProviderSchema and guarantees contractConfig.source.load is a Function, delete the if (typeof contractConfig.source?.load !== 'function') { throw ... } block; rely on validateContractConfig/ContractConfigSchema for enforcement and keep the rest of loadConfig() logic intact (referencing symbols: loadConfig, validateContractConfig, ContractConfigSchema, ContractSourceProviderSchema, contractConfig).packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts (1)
152-179: Assert the watcher registration in the moduleGraph case.This test says it registers watchers, but it only verifies
ssrLoadModule(). A regression that loads the module graph but never callswatcher.add()would still pass.🧪 Proposed test assertion
await configureServer(mockServer); expect(mockServer.ssrLoadModule).toHaveBeenCalled(); + expect(mockServer.watcher.add).toHaveBeenCalledWith('/project/prisma-next.config.ts'); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts` around lines 152 - 179, The test currently only asserts ssrLoadModule was called but must also assert the plugin registered file watchers from the module graph; after calling configureServer(mockServer) add an assertion that mockServer.watcher.add was invoked for the module file returned by mockServer.moduleGraph.getModuleById (e.g. '/project/prisma-next.config.ts') — use prismaVitePlugin, configureServer, and the mocked moduleGraph.getModuleById to locate where watcher.add should be called and assert it was called (and optionally called once).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/1-framework/3-tooling/cli/test/config-types.test.ts`:
- Around line 9-12: The default parameter of createSourceProvider is too
narrowly inferred; update its signature to type the authoritativeInputs
parameter as ContractAuthoritativeInputs (imported from
`@prisma-next/config/config-types`) so it accepts all three kinds (e.g.,
'moduleGraph' and 'paths'); change the parameter annotation on
createSourceProvider to use ContractAuthoritativeInputs and add the
corresponding import statement so callers like the one at the failing call
accept the wider union type.
In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts`:
- Around line 1-2: The file imports dirname and resolve from 'node:path' —
replace that import to use 'pathe' instead to ensure
cross-platform/cross-runtime compatibility; update the import that currently
reads the symbols dirname and resolve so they are imported from 'pathe' and
leave all usages of dirname and resolve in this module (plugin.ts) unchanged.
In `@packages/2-sql/2-authoring/contract-psl/src/provider.ts`:
- Around line 35-58: The loader's load function resolves the schemaPath with
resolve(schemaPath) (in load) which is cwd-relative and can differ from the
watcher that resolved authoritativeInputs.paths against the config directory;
change the resolution in load to use the same base (e.g.,
resolve(context.configDir, schemaPath) or equivalent from ContractSourceContext)
before calling readFile so the watcher and loader target the same file, and
propagate the adjusted absolute path into the notOk payload fields
(sourceId/meta.absoluteSchemaPath) so diagnostics and metadata remain
consistent; update references around load, resolve(schemaPath), readFile, and
the notOk return accordingly.
---
Outside diff comments:
In `@test/integration/test/authoring/cli.emit-parity-fixtures.test.ts`:
- Around line 95-98: The type aliases for provider result variables use
ReturnType<typeof ...contract.source> but contract.source is now an object;
change the annotations to target the load method return type instead (e.g., use
Awaited<ReturnType<typeof tsConfig.contract.source.load>> for
tsProviderResultFirst/Second and similarly use Awaited<ReturnType<typeof
pslConfig.contract.source.load>> for pslProviderResultFirst/Second and update
any diagnostics-related ReturnType references to point at .source.load as well)
so the types reflect the result of calling source.load().
In `@test/integration/test/cli.emit-command.test.ts`:
- Around line 568-570: The type annotation for sourceResult is stale because
providerConfig.contract['source'] is now an object with a load method; update
the declaration to use the load method's return type by replacing
ReturnType<NonNullable<typeof providerConfig.contract>['source']> with
ReturnType<NonNullable<typeof providerConfig.contract>['source']['load']> (keep
the NonNullable wrapper) so sourceResult correctly reflects the load result from
providerConfig.contract.source.load.
---
Nitpick comments:
In
`@packages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.ts`:
- Around line 81-86: Remove the redundant runtime check for
contractConfig.source.load in loadConfig(): since validateContractConfig runs
ContractConfigSchema/ContractSourceProviderSchema and guarantees
contractConfig.source.load is a Function, delete the if (typeof
contractConfig.source?.load !== 'function') { throw ... } block; rely on
validateContractConfig/ContractConfigSchema for enforcement and keep the rest of
loadConfig() logic intact (referencing symbols: loadConfig,
validateContractConfig, ContractConfigSchema, ContractSourceProviderSchema,
contractConfig).
In
`@packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts`:
- Around line 152-179: The test currently only asserts ssrLoadModule was called
but must also assert the plugin registered file watchers from the module graph;
after calling configureServer(mockServer) add an assertion that
mockServer.watcher.add was invoked for the module file returned by
mockServer.moduleGraph.getModuleById (e.g. '/project/prisma-next.config.ts') —
use prismaVitePlugin, configureServer, and the mocked moduleGraph.getModuleById
to locate where watcher.add should be called and assert it was called (and
optionally called once).
🪄 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: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: bcabb0ac-ebd7-4a51-ba2a-0bf1b27bfc21
📒 Files selected for processing (57)
docs/architecture docs/adrs/ADR 163 - Provider-invoked source interpretation packages.mdpackages/1-framework/1-core/config/README.mdpackages/1-framework/1-core/config/src/config-types.tspackages/1-framework/1-core/config/src/config-validation.tspackages/1-framework/1-core/config/src/contract-source-types.tspackages/1-framework/1-core/config/src/exports/config-types.tspackages/1-framework/1-core/config/test/config-types.test-d.tspackages/1-framework/1-core/config/test/config-validation.test.tspackages/1-framework/3-tooling/cli/README.mdpackages/1-framework/3-tooling/cli/recordings/fixtures/prisma-next.config.tspackages/1-framework/3-tooling/cli/src/config-loader.tspackages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.tspackages/1-framework/3-tooling/cli/test/config-loader.test.tspackages/1-framework/3-tooling/cli/test/config-types.test.tspackages/1-framework/3-tooling/cli/test/control-api/contract-emit.test.tspackages/1-framework/3-tooling/vite-plugin-contract-emit/README.mdpackages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.tspackages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.tspackages/2-mongo-family/2-authoring/contract-psl/src/provider.tspackages/2-mongo-family/2-authoring/contract-psl/test/provider.test.tspackages/2-mongo-family/2-authoring/contract-ts/src/config-types.tspackages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.tspackages/2-sql/2-authoring/contract-psl/src/provider.tspackages/2-sql/2-authoring/contract-psl/test/provider.test.tspackages/2-sql/2-authoring/contract-ts/src/config-types.tspackages/2-sql/2-authoring/contract-ts/test/config-types.test.tspackages/3-extensions/mongo/src/config/define-config.tspackages/3-extensions/mongo/test/config/define-config.test.tspackages/3-extensions/postgres/src/config/define-config.tspackages/3-extensions/postgres/test/config/define-config.test.tspackages/3-extensions/sql-orm-client/test/fixtures/prisma-next.config.tstest/integration/test/authoring/cli.emit-parity-fixtures.test.tstest/integration/test/authoring/psl.pgvector-dbinit.test.tstest/integration/test/authoring/side-by-side-contracts.test.tstest/integration/test/cli.emit-command.test.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/prisma-next.config.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-init/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-introspect/prisma-next.config.no-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-introspect/prisma-next.config.no-driver.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-introspect/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-sign/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-update-scenarios/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-verify/prisma-next.config.no-driver.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-verify/prisma-next.config.no-verify.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-verify/prisma-next.config.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/db-verify/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/emit/prisma-next.config.emit.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/migration-apply/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/migration-plan/prisma-next.config.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/mongo-db-commands/prisma-next.config.with-db.tstest/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/vite-plugin/prisma-next.config.tstest/integration/test/fixtures/cli/cli-integration-test-app/fixtures/emit-command/prisma-next.config.async-source.tstest/integration/test/fixtures/cli/cli-integration-test-app/fixtures/emit-command/prisma-next.config.mongo-contract-ts.tstest/integration/test/fixtures/prisma-next.config.tstest/integration/test/mongo/fixtures/prisma-next.config.tstest/integration/test/sql-builder/fixtures/prisma-next.config.ts
✅ Files skipped from review due to trivial changes (8)
- docs/architecture docs/adrs/ADR 163 - Provider-invoked source interpretation packages.md
- packages/1-framework/3-tooling/cli/README.md
- packages/1-framework/1-core/config/src/exports/config-types.ts
- packages/3-extensions/postgres/test/config/define-config.test.ts
- packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md
- packages/1-framework/3-tooling/cli/src/config-loader.ts
- packages/3-extensions/mongo/test/config/define-config.test.ts
- packages/1-framework/3-tooling/cli/test/config-loader.test.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
- packages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.ts
- packages/3-extensions/mongo/src/config/define-config.ts
- packages/1-framework/1-core/config/src/config-validation.ts
- packages/2-mongo-family/2-authoring/contract-psl/test/provider.test.ts
- packages/1-framework/1-core/config/test/config-types.test-d.ts
- packages/1-framework/1-core/config/test/config-validation.test.ts
- packages/2-mongo-family/2-authoring/contract-ts/src/config-types.ts
- packages/1-framework/1-core/config/README.md
- packages/2-sql/2-authoring/contract-ts/src/config-types.ts
- packages/2-sql/2-authoring/contract-ts/test/config-types.test.ts
- packages/3-extensions/postgres/src/config/define-config.ts
- packages/2-mongo-family/2-authoring/contract-psl/src/provider.ts
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/1-framework/3-tooling/cli/test/control-api/client.test.ts (1)
467-499:⚠️ Potential issue | 🟡 MinorDuplicate of earlier test.
This test is effectively identical to the
'emits resolveSource and emit spans'case at lines 421-465 — both usecreateSourceProvider()with defaultload(returningok(...)) and assert the sameresolveSourcespan outcome. Since the provider-object shape is already the only supported shape (callable sources were removed), the "when source is a provider object" wording is redundant. Consider removing this test or, if the intent was to exercise a distinct scenario (e.g., differentauthoritativeInputskind), adjust it to cover something not already covered by the first case.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/test/control-api/client.test.ts` around lines 467 - 499, The test "emits resolveSource and emit spans when source is a provider object" duplicates the earlier "emits resolveSource and emit spans" case; remove this redundant test block (the it(...) that uses createSourceProvider() and asserts resolveSource spans) to avoid duplicate coverage, or if you prefer retaining a distinct case replace it with a test that exercises a different provider behavior (e.g., pass a createSourceProvider() that returns authoritativeInputs or a failing load) and assert the corresponding span outcome; locate the duplicate by the test name and the use of createSourceProvider(), client.emit(), and the resolveSource span assertions.
🧹 Nitpick comments (3)
packages/1-framework/1-core/config/src/config-types.ts (1)
89-114: Doc comment placement is now misleading.The JSDoc block at lines 89-92 describes
ContractConfigSchema, but two additional schemas (ContractAuthoritativeInputsSchema,ContractSourceProviderSchema) now sit between the comment andContractConfigSchema. Either move the comment down toContractConfigSchema(line 111) or add a short JSDoc per schema so the mapping is unambiguous.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/config/src/config-types.ts` around lines 89 - 114, The JSDoc currently placed above ContractAuthoritativeInputsSchema is meant for ContractConfigSchema; either move that comment so it immediately precedes ContractConfigSchema or add short JSDoc comments above each schema to clarify intent — specifically update the block so ContractAuthoritativeInputsSchema, ContractSourceProviderSchema and ContractConfigSchema each have unambiguous documentation (or relocate the existing JSDoc directly above the ContractConfigSchema declaration) to resolve the misleading placement.packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts (1)
152-165: Redundant innerSetinfilterOutputArtifacts.
new Set([...new Set(values)].filter(...))wraps values in a Set, spreads to an array for filtering, then re-wraps. The outer Set already dedupes, so the inner one is pointless.- return new Set( - [...new Set(values)].filter((value) => value !== outputJsonPath && value !== outputDtsPath), - ); + return new Set( + values.filter((value) => value !== outputJsonPath && value !== outputDtsPath), + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts` around lines 152 - 165, filterOutputArtifacts currently wraps values in an unnecessary inner Set before filtering; replace the inner dedupe with a direct array filter and then dedupe once when constructing the returned Set. Specifically, inside filterOutputArtifacts (which uses values, contractOutput, DEFAULT_CONTRACT_OUTPUT, absoluteConfigPath, outputJsonPath, outputDtsPath) remove new Set([...new Set(values)].filter(...)) and instead filter values directly (values.filter(...)) and then wrap that filtered array in a single new Set to deduplicate the results.packages/1-framework/1-core/config/test/config-types.test-d.ts (1)
102-123: Type assertions largely restate the interface.Because
result.contract!.sourceis already typed asContractSourceProvider,expectTypeOf(...source.load).toEqualTypeOf<ContractSourceProvider['load']>()and thekindunion assertion are close to tautological: they check each field's declared type against itself rather than behavior ofdefineConfig. Consider instead asserting that the literal narrowing is preserved (e.g., constructingconfigwithas constand assertingresult.contract!.source.authoritativeInputsnarrows to{ kind: 'paths'; paths: ... }), or else asserting the input-shape is assignable toContractSourceProviderviatoExtend— those catch regressions the current assertions cannot.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/config/test/config-types.test-d.ts` around lines 102 - 123, The test's current type assertions merely restate the declared ContractSourceProvider shape and don't verify that defineConfig preserves literal narrowing; update the test to assert narrowing or assignability instead: construct the config.authoritativeInputs with an explicit const assertion (e.g., use `as const` on the authoritativeInputs object) or build the entire config as const, then assert that result.contract!.source.authoritativeInputs has the narrowed literal type (exact `{ kind: 'paths'; paths: string[] }`) or use expectTypeOf(result.contract!.source).toExtend<ContractSourceProvider>() to confirm assignability; modify the assertions around defineConfig and result to use these stricter checks so regressions in defineConfig's type inference are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts`:
- Around line 217-265: resolveWatchedFiles currently omits the config file when
authoritativeInputs.kind === 'paths' and also swallows the fact that loadConfig
failed in the catch; update the 'paths' branch so the returned files Set
includes both the resolved authoritativeInputs.paths (via filterOutputArtifacts)
AND absoluteConfigPath (so edits to the config trigger a re-emit), and change
the catch block to return the PARTIAL_COVERAGE_WARNING (or otherwise a non-null
warning) instead of null while still calling logError; refer to
resolveWatchedFiles, authoritativeInputs.kind === 'paths', absoluteConfigPath,
filterOutputArtifacts, loadConfig, logError, and PARTIAL_COVERAGE_WARNING to
locate where to apply these fixes.
---
Outside diff comments:
In `@packages/1-framework/3-tooling/cli/test/control-api/client.test.ts`:
- Around line 467-499: The test "emits resolveSource and emit spans when source
is a provider object" duplicates the earlier "emits resolveSource and emit
spans" case; remove this redundant test block (the it(...) that uses
createSourceProvider() and asserts resolveSource spans) to avoid duplicate
coverage, or if you prefer retaining a distinct case replace it with a test that
exercises a different provider behavior (e.g., pass a createSourceProvider()
that returns authoritativeInputs or a failing load) and assert the corresponding
span outcome; locate the duplicate by the test name and the use of
createSourceProvider(), client.emit(), and the resolveSource span assertions.
---
Nitpick comments:
In `@packages/1-framework/1-core/config/src/config-types.ts`:
- Around line 89-114: The JSDoc currently placed above
ContractAuthoritativeInputsSchema is meant for ContractConfigSchema; either move
that comment so it immediately precedes ContractConfigSchema or add short JSDoc
comments above each schema to clarify intent — specifically update the block so
ContractAuthoritativeInputsSchema, ContractSourceProviderSchema and
ContractConfigSchema each have unambiguous documentation (or relocate the
existing JSDoc directly above the ContractConfigSchema declaration) to resolve
the misleading placement.
In `@packages/1-framework/1-core/config/test/config-types.test-d.ts`:
- Around line 102-123: The test's current type assertions merely restate the
declared ContractSourceProvider shape and don't verify that defineConfig
preserves literal narrowing; update the test to assert narrowing or
assignability instead: construct the config.authoritativeInputs with an explicit
const assertion (e.g., use `as const` on the authoritativeInputs object) or
build the entire config as const, then assert that
result.contract!.source.authoritativeInputs has the narrowed literal type (exact
`{ kind: 'paths'; paths: string[] }`) or use
expectTypeOf(result.contract!.source).toExtend<ContractSourceProvider>() to
confirm assignability; modify the assertions around defineConfig and result to
use these stricter checks so regressions in defineConfig's type inference are
caught.
In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts`:
- Around line 152-165: filterOutputArtifacts currently wraps values in an
unnecessary inner Set before filtering; replace the inner dedupe with a direct
array filter and then dedupe once when constructing the returned Set.
Specifically, inside filterOutputArtifacts (which uses values, contractOutput,
DEFAULT_CONTRACT_OUTPUT, absoluteConfigPath, outputJsonPath, outputDtsPath)
remove new Set([...new Set(values)].filter(...)) and instead filter values
directly (values.filter(...)) and then wrap that filtered array in a single new
Set to deduplicate the results.
🪄 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: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: eccac6d8-050c-4bc2-8ab7-d7837ce7b8ea
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (22)
packages/1-framework/1-core/config/src/config-types.tspackages/1-framework/1-core/config/src/contract-source-types.tspackages/1-framework/1-core/config/test/config-types.test-d.tspackages/1-framework/3-tooling/cli/src/commands/contract-emit.tspackages/1-framework/3-tooling/cli/src/control-api/client.tspackages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.tspackages/1-framework/3-tooling/cli/src/control-api/types.tspackages/1-framework/3-tooling/cli/test/config-types.test.tspackages/1-framework/3-tooling/cli/test/control-api/client.test.tspackages/1-framework/3-tooling/vite-plugin-contract-emit/package.jsonpackages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.tspackages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.tspackages/2-sql/2-authoring/contract-psl/src/provider.tspackages/2-sql/2-authoring/contract-psl/test/fixtures.tspackages/2-sql/2-authoring/contract-psl/test/provider.test.tspackages/2-sql/2-authoring/contract-ts/test/config-types.test.tspackages/3-extensions/postgres/test/config/define-config.test.tstest/integration/test/authoring/cli.emit-parity-fixtures.test.tstest/integration/test/authoring/psl.pgvector-dbinit.test.tstest/integration/test/authoring/side-by-side-contracts.test.tstest/integration/test/cli.emit-command.test.tstest/integration/test/cli.emit-contract.test.ts
✅ Files skipped from review due to trivial changes (2)
- packages/1-framework/3-tooling/vite-plugin-contract-emit/package.json
- packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- test/integration/test/authoring/side-by-side-contracts.test.ts
- test/integration/test/authoring/psl.pgvector-dbinit.test.ts
- test/integration/test/authoring/cli.emit-parity-fixtures.test.ts
- packages/2-sql/2-authoring/contract-ts/test/config-types.test.ts
- packages/2-sql/2-authoring/contract-psl/src/provider.ts
- packages/1-framework/3-tooling/cli/test/config-types.test.ts
- test/integration/test/cli.emit-command.test.ts
The SQL provider was updated to use context.configDir but the mongo provider was missed, causing watcher/loader path divergence when cwd differs from the config directory.
…onfigDir - Switch config-loader from node:path to pathe for consistency with the rest of the tooling layer. - Resolve .ts contract paths inside load() via context.configDir instead of capturing process.cwd() at config-definition time, so the watcher and loader always reference the same file.
The paths branch omitted the config file from the watch set, so edits to prisma-next.config.ts (e.g. changing paths or swapping provider) would not trigger re-emit. Also surface a partial-coverage warning when loadConfig fails instead of silently falling back.
The PSL and TS-from-path providers used `= schemaPath` / `= contractPath` defaults when destructuring context.resolvedInputs. That silently fell back to the user's relative path when a test harness handed in an empty context, masking the invariant that the CLI loader guarantees resolvedInputs is positional-matched with source.inputs. Drop the fallback in all four providers and throw a clear error naming the provider and the loader contract. Unreachable in production; surfaces test-harness bugs immediately.
Pulls in 72 commits from main, including the new mongo-migration.e2e test file and its fixture (which uses the pre-rework bare-callable source shape and needs updating in a follow-up commit on this branch).
The fixture landed on main after this branch forked and still used the
pre-rework bare-callable source:
contract: {
source: async () => ({ ok: true as const, value: contract }),
output: 'output/contract.json',
types: 'output/contract.d.ts',
}
The new validator requires an object with load, so the 3 mongo
migration e2e tests failed under CI with "contract.source.load must be
a function (was missing)". Update the fixture to match the current
protocol and drop the now-unsupported top-level 'types' field (the
emitter colocates the .d.ts next to the .json automatically).
Verified: all 507 tests across 96 files in the integration suite pass
locally after the merge.
Re-review please, @wmadden — round 3 addresses layering in fullMain branch merged in + 4 follow-up commits addressing your round-2 observations and self-review findings from my own pass. What moved since your round-2 comment
Other structural shifts you haven't seen yet
Design call I should flag explicitly (OQ1)Your rework spec's "assumption unless told otherwise" was option (a) — Follow-ups from my own re-read (all fixed in this round)
Mechanical acceptance-criteria checks
Ready for a round-3 look whenever works. |
b2f135c to
6b128c6
Compare
…rces Validation becomes shape-only; path resolution and cross-field path checks move to the CLI loader (see follow-up commit). `ContractSourceProvider.load` stays a one-argument API; `ContractSourceContext` gains `resolvedInputs` so providers consume absolute paths supplied by the loader. Drops the separate `ContractSourceEnvironment` and `createPathBackedSource` helpers.
`loadConfig()` now owns config-file-relative path resolution for `contract.source.inputs` and `contract.output`, and enforces that no declared input equals an emitted artifact path. Extension facades (postgres, mongo `define-config`) propagate the new context shape to providers; control-api call sites thread resolved inputs through.
Introduces `getEmittedArtifactPaths()` so `contract.json` / `contract.d.ts` paths are derived from `contract.output` in one place. `emit()` takes the output path and uses the helper, replacing the duplicated derivation that had grown across config, CLI, and Vite.
SQL and Mongo PSL providers read absolute paths from `context.resolvedInputs` instead of resolving schema paths themselves; they fail loudly when the list is empty rather than silently defaulting. TypeScript contract facades gain a `typescriptContractFromPath` helper so both families share path handling.
Plugin reads absolute inputs from the loader-finalized config instead of re-resolving them; the config file itself is watched in paths mode and a warning fires on load failure. Hot-update paths are normalized via `pathe` so the plugin stops fabricating default outputs for unrelated files.
…rdening Updates all `prisma-next.config.ts` fixtures under test/integration to the new `contract.source.inputs` shape. Adds the vite-plugin PSL fixture used by the HMR e2e test and makes that test wait until the rewritten `contract.json` is readable before parsing. Raises timeout budgets on DB-backed CLI and sql-builder integration tests that were flaky under full- repo load.
Updates ADR 163 to describe provider-invoked source interpretation with the resolvedInputs I/O boundary, and aligns the config / cli / vite-plugin READMEs with the current `load()` signature and the one-call-site path derivation.
6b128c6 to
9edc5ed
Compare
wmadden
left a comment
There was a problem hiding this comment.
A couple of small comments but this looks good, well done 👏🏻
…ma/prisma-next into tml-2276-authoritative-watch-inputs
- ImportRequirement extension stays as two optional fields (kind + attributes). - Replace the over-specialized copyContractToMigrationDir with a generic copyFilesWithRename helper; callers invoke it once per contract, driven by the emitter files list landing in #356. - Combined named+default import lines deferred to whatever falls out of the renderer implementation. - F02 (e2e un-skip) stays in PR 2, consistent with the PR-2 merge gate. - Follow-up Linear ticket TML-2291 filed for type-level contract-hash enforcement (SqlQueryPlan<C, _Row>).
`migration new` and `migration plan` now copy the destination contract
as `contract.{json,d.ts}` and the source contract (when present) as
`from-contract.{json,d.ts}`, using the prior migration's already-copied
contract files as the source. TODOs flag #356 where the emitter will
own the artifact list.
…ract copies Replace the sibling-.d.ts string-slice expedient in `migration plan` and `migration new` with the emitter-owned `getEmittedArtifactPaths()` API (landed in #356). The destination and prior-migration source contracts are now derived symmetrically through the same helper, centralising the `.json` / `.d.ts` pairing in `@prisma-next/emitter` and removing the TODO(#356) markers.
- ImportRequirement extension stays as two optional fields (kind + attributes). - Replace the over-specialized copyContractToMigrationDir with a generic copyFilesWithRename helper; callers invoke it once per contract, driven by the emitter files list landing in #356. - Combined named+default import lines deferred to whatever falls out of the renderer implementation. - F02 (e2e un-skip) stays in PR 2, consistent with the PR-2 merge gate. - Follow-up Linear ticket TML-2291 filed for type-level contract-hash enforcement (SqlQueryPlan<C, _Row>).
`migration new` and `migration plan` now copy the destination contract
as `contract.{json,d.ts}` and the source contract (when present) as
`from-contract.{json,d.ts}`, using the prior migration's already-copied
contract files as the source. TODOs flag #356 where the emitter will
own the artifact list.
…ract copies Replace the sibling-.d.ts string-slice expedient in `migration plan` and `migration new` with the emitter-owned `getEmittedArtifactPaths()` API (landed in #356). The destination and prior-migration source contracts are now derived symmetrically through the same helper, centralising the `.json` / `.d.ts` pairing in `@prisma-next/emitter` and removing the TODO(#356) markers.
- ImportRequirement extension stays as two optional fields (kind + attributes). - Replace the over-specialized copyContractToMigrationDir with a generic copyFilesWithRename helper; callers invoke it once per contract, driven by the emitter files list landing in #356. - Combined named+default import lines deferred to whatever falls out of the renderer implementation. - F02 (e2e un-skip) stays in PR 2, consistent with the PR-2 merge gate. - Follow-up Linear ticket TML-2291 filed for type-level contract-hash enforcement (SqlQueryPlan<C, _Row>).
`migration new` and `migration plan` now copy the destination contract
as `contract.{json,d.ts}` and the source contract (when present) as
`from-contract.{json,d.ts}`, using the prior migration's already-copied
contract files as the source. TODOs flag #356 where the emitter will
own the artifact list.
…ract copies Replace the sibling-.d.ts string-slice expedient in `migration plan` and `migration new` with the emitter-owned `getEmittedArtifactPaths()` API (landed in #356). The destination and prior-migration source contracts are now derived symmetrically through the same helper, centralising the `.json` / `.d.ts` pairing in `@prisma-next/emitter` and removing the TODO(#356) markers.
## Summary - finalize `contract.output` in the CLI loader for plain-object configs so the Vite plugin always receives resolved absolute paths - make the Vite plugin consume loader-resolved inputs and emitted artifact paths, update watched files as config/module-graph inputs change, and warn once when it must fall back to config-only watching - refresh plugin docs and align integration coverage with the default output behavior ## Testing - pnpm test -- test/plugin.test.ts - pnpm test -- test/config-loader.test.ts - pnpm test -- test/cli.emit-command.test.ts test/vite-plugin.hmr.e2e.test.ts - rg "resolve\(configDir" packages/1-framework/3-tooling/vite-plugin-contract-emit/src/ - rg "slice\(0, -5\)" packages/1-framework/3-tooling/vite-plugin-contract-emit/src/ ## Notes - Stacked on #356 - Replaces the older attempt in #357 - Refs TML-2277 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Contract configs now get a consistent default output path when omitted. * **Bug Fixes** * More precise validation for optional contract fields; clearer errors when modules lack expected exports. * **Improvements** * CLI always finalizes contract output and resolves input paths; Vite plugin watch/emission behavior improved with fallback warnings and fewer redundant emits. * **Tests** * Expanded and reorganized unit and integration tests to cover provider shapes, path resolution, watch fallback, and emit flows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: jkomyno <[email protected]>
Summary
This PR keeps
@prisma-next/configpath-agnostic again.contract.source.inputsstays as the declarative source list, but path resolution and cross-field path validation now happen in the CLI loader, which already owns the authoritative config-file directory. Providers consume absolute paths throughContractSourceContext.resolvedInputs, and emitted artifact path mapping lives in@prisma-next/emitter.Why
The first version of this work introduced the right contract-source shape (
inputs+load) but still left path semantics split across layers:@prisma-next/configimported path utilities and compared pathsconfigDirthroughContractSourceEnvironmentThat made the framework-core config package responsible for I/O-adjacent concerns it should not own.
Main Changes
@prisma-next/config; validation there is shape-only againContractSourceEnvironmentandcreatePathBackedSourceContractSourceProvider.load(context)as a one-argument API and addresolvedInputstoContractSourceContextloadConfig()resolvecontract.source.inputsandcontract.outputto absolute paths once, relative to the config fileoutput ∉ inputscheck into the CLI loadercontract.json/contract.d.tspath derivation ingetEmittedArtifactPaths()inside@prisma-next/emittercontext.resolvedInputsemit()so the emitter-owned artifact-path helper is exercised from the emit path as wellBehavior
loadConfig()now returns absolutecontract.source.inputsand absolutecontract.outputloadConfig()rather thandefineConfig()Test-only Cleanup
contract.jsonis readable before parsing itValidation
pnpm testpnpm typecheckpnpm lint:depsRelated
TML-2276