feat(data): add Seed Loader Protocol for relationship resolution & dependency ordering#875
Draft
feat(data): add Seed Loader Protocol for relationship resolution & dependency ordering#875
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ependency ordering Add seed-loader.zod.ts with Zod schemas for: - ReferenceResolutionSchema: field reference resolution via externalId - ObjectDependencyNodeSchema/GraphSchema: topological sort for insert order - ReferenceResolutionErrorSchema: actionable error reporting - SeedLoaderConfigSchema: dry-run, multi-pass, batch, transaction config - DatasetLoadResultSchema: per-object load statistics - SeedLoaderResultSchema: complete load result with summary - SeedLoaderRequestSchema: request combining datasets + config Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add dynamic relationship resolution for seed data initialization
feat(data): add Seed Loader Protocol for relationship resolution & dependency ordering
Mar 5, 2026
Contributor
|
@copilot 我是想实现API和运行时环境,评估这个协议是否有必要 |
Contributor
Author
这个协议对API和运行时实现是有价值的,但不是必须先行的。主要作用:
但如果你更倾向于在实现过程中迭代定义协议(而非先定义后实现),我可以revert这些schema,让你在runtime包中边实现边定义。这取决于你更偏好 spec-first 还是 implementation-first 的工作流。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The engine's seed data loader has no protocol for automatically resolving lookup/master_detail references via externalId, determining insert order from object dependencies, or handling circular references with multi-pass loading. This makes seed/demo/config scenarios fragile and manual.
New schemas (
seed-loader.zod.ts)ReferenceResolutionSchema— maps a lookup/master_detail field to its target object and match fieldObjectDependencyNodeSchema/ObjectDependencyGraphSchema— object dependency graph with topological insert order and circular dependency detectionReferenceResolutionErrorSchema— actionable error: source object, field, target object, target field, attempted value, record index, messageSeedLoaderConfigSchema—dryRun,haltOnError,multiPass,defaultMode,batchSize,transaction,envDatasetLoadResultSchema— per-object stats: inserted/updated/skipped/errored, references resolved/deferredSeedLoaderResultSchema— aggregated result with dependency graph, per-object results, errors, summarySeedLoaderRequestSchema— combinesDatasetSchema[]with loader configUsage
Notes
z.preprocessfor the nested config field — Zod's.default({})does not apply inner field defaultsDatasetSchema/DatasetMode; exported fromdata/index.tsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.