Skip to content

Fix constraint validator order-dependence and dedupe, broaden typing coverage, widen 30/36/37/38 scope#14

Merged
amateescu merged 1 commit into
mainfrom
constraint-validator-fixes
Jun 12, 2026
Merged

Fix constraint validator order-dependence and dedupe, broaden typing coverage, widen 30/36/37/38 scope#14
amateescu merged 1 commit into
mainfrom
constraint-validator-fixes

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Changes

  • Rewrite constraint 30 (start-precedes-end) to fold each activity's own startTime/endTime into the start/end event-time sets and compare max(starts) against min(ends), so a start that follows any end is caught regardless of record order. Own times are aggregated per URI (a restated activity declaration reports once), anonymous activities are checked against their own times inline, and referenced-but-undeclared activities are ordered by their start/end events.
  • Add RelationMetadata::TYPING_ROLES (class => [property => entity|activity|agent]) and drive constraint 50 off it, replacing the hand-written instanceof branches. Invalidation, Start/End trigger/starter/ender, Derivation, Association's activity, Attribution's entity, Specialization/Alternate/Membership/Mention, and the dictionary relations now contribute element roles, and the validator also walks dictionary keyEntityPairs (an array-typed formal the table cannot express) for their member entities, so clashes like wasInvalidatedBy(entity: x) + used(activity: x) are detected.
  • Rewrite constraints 36/37/38 to iterate RecordIndex::getEntityUrisWithEvents() (the union of generation/usage/invalidation entity keys): referenced-but-undeclared entities are now checked, a restated entity declaration no longer double-reports, and each entity is reported once per constraint via max-vs-min instead of O(G×U) pairwise violation objects.
  • Document the constraint-23 deferral at the ??= event-time site in collectUniqueEventGroup and at the last-wins assignments in constraints 39/40.
  • Add tests for the constraint 30 event-fallback, reorder-stability, anonymous own-times, restated-activity and undeclared-activity scope; the newly-covered typing clashes (including a dictionary key-entity pair); undeclared-entity scope, restated-declaration and per-entity dedupe for 36/37/38; and generation/usage/invalidation simultaneity boundaries.

@amateescu amateescu merged commit 24f5814 into main Jun 12, 2026
7 checks passed
@amateescu amateescu deleted the constraint-validator-fixes branch June 12, 2026 23:39
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