Skip to content

[Meta-driven Seed Loader] Engine must support dynamic relationship resolution & dependency ordering for seed data initialization #873

@hotlong

Description

@hotlong

Problem

ObjectStack currently allows objects and their fields to be defined and loaded entirely via metadata, but the engine's seed data loader does not automatically resolve relationships (lookup/master_detail fields) between records during initialization. Instead, it expects either pre-populated IDs, manual foreign-key mapping, or a fully correct insert order.

This makes onboarding, demo, and config scenarios fragile, and does not meet the self-driving data onboarding expectation of metadata-driven platforms.

Detail Checklist

  • Engine seed loader must, during insert/upsert of seed data, automatically resolve lookup/master_detail references using target object's externalId (usually 'name'). This should happen if the field value is not already an internal ID, but is a string matching a unique key in the referenced object.
  • Topological sort must be performed to determine import order based on object dependency graph, so parent objects are inserted before child objects that reference them.
  • If circular or delayed references exist, loader must perform a second pass to fill unresolved relationships after all records are inserted.
  • Engine should respect DatasetSchema's mode: upsert, not just blindly insert objects; upsert logic should be honored based on externalId for idempotency.
  • Any reference resolution failure should generate actionable error messages with: field name, target object, externalId, attempted value, and possible missing referent.
  • Loader should support dry-run for validation (check relationships before write) to surface broken references before failures.
  • All logic should be metadata-driven and use SchemaRegistry, supporting hot-reload and dynamic object changes.

Acceptance Criteria

  • Seed data can be written entirely using references via externalId (natural key).
  • Demo and onboarding environments require no manual ID prep or table pre-sorting.
  • All new objects with relationships work immediately from metadata alone, regardless of schema changes.
  • Error handling and reporting matches the ease-of-use of platforms like Salesforce, Airtable, ServiceNow, etc.

Impact

This makes ObjectStack truly declarative, metadata-first for data onboarding, and closes a gap in platform intelligence compared to major low-code engines.

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions