Skip to content

Feature documents are keyed on domain and name, discarding their scope #38

Description

@goloroden

What is this bug about?

A feature is about exactly one consistency unit - the given-when-then schema says so outright, and the variant discriminator inside its scope names that unit: an aggregate, a dynamic consistency boundary, a process manager, or a read model.

The resolver ignores all of that. Extension documents are keyed on domain/name, discarding the rest of the scope. Two features named happy-path about two different aggregates are consequently rejected as duplicates:

$ esdm lint
error: esdm/structure/duplicate-name
  at model.esdm.yaml:102:7
  duplicate feature "happy-path"
  note: first defined here (model.esdm.yaml:85:7)

Both features are lint-clean on their own, target different units, and occupy different positions. Nothing about them is duplicate except the truncated key. The practical effect is that the natural naming pattern - one happy-path per unit - is unavailable, and modelers have to disambiguate by hand (order-happy-path, invoice-happy-path).

esdm view truncates the same way: a feature is attached under the domain, as a sibling of subdomains and process managers, even though its scope names a unit two levels deeper.

This is the exact inverse of #19. There, two elements of different kinds at the same position are not recognized as a collision. Here, two elements of the same kind at different positions are merged into one. Both come from the same root cause: the position is not derived from the element's own scope.

domain-story is unaffected - it is genuinely domain-scoped, so domain/name is its correct position.

What needs to be done to fix this bug?

  • Write a failing test: two features with the same name targeting different consistency units must both resolve, and must not produce a duplicate-name diagnostic.
  • Derive the composite key for given-when-then documents from the full scope, including the variant's unit, instead of truncating to domain/name. Leave domain-storytelling documents keyed by domain, which is correct for them.
  • Render a feature under the consistency unit its scope names, rather than under the domain, and move the feat counter from the domain's stats line to the unit's.
  • Check the rules that resolve feature scopes against the model for the same truncation.

What else should we know?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions