Skip to content

Screenplay generation: concepts referenced only from child records and read models are dropped, including PII-marked ones #2400

Description

@woksin

Summary

Concepts are only emitted when referenced from positions the generator declares (event/command properties, query parameters and returns). Concepts that are referenced only from inside complex child records or read-model properties are dropped from the document — silently, with no diagnostic. In a real application this includes PII-marked concepts, so the generated document understates the application's PII surface — which cuts directly against Screenplay's "concepts carry compliance" design goal.

Evidence (real application)

Diffing the generated Ada document (105 concepts) against the source (120 Core concept types, counting ConceptAs<T> and EventSourceId<T> derivatives) shows 15 concepts missing, none of which appear as a top-level event/command property type:

Concept PII Where it lives
FirstName yes inside PersonalDetails child record
LastName yes inside PersonalDetails child record
PhoneNumber yes inside PersonalDetails child record
AnswerText yes inside RequirementAnswer child record (carried by events via IEnumerable<RequirementAnswer>)
CriterionNote yes inside evaluation child records
EvaluationScore, SkillName, VoucherLineHours, WebsiteUrl, ActivityFeedKey, MagicLinkRecipientId, TripletexInvoiceId, TripletexPaymentId, TripletexCustomerPaymentId, RequestEmailParserConfigurationId no child records / read-model-only positions

All five PII concepts carry [PII] and validation rules in source (FirstName: NotEmpty().MaximumLength(100), PhoneNumber: Matches(@"^\+?[\d\s\-().]{7,20}$"), …) — none of that reaches the document.

Related: the document does reference the child record types themselves in event property positions, e.g.

event TimesheetMonthApproved
  ...
  days ApprovedDayLine[]

ApprovedDayLine is never declared anywhere in the document — the Screenplay grammar has no complex-type declaration construct (companion language issue filed on Cratis/Screenplay). So today the document both references shapes it cannot define and loses the concepts inside them.

Suggested fix

  1. Emit concepts transitively: when registering a type reference, walk complex record types' members and register the concepts found there. Concepts are declarable today — nothing in the grammar blocks this — and it restores the PII/validation story even while child-record shapes remain undeclarable.
  2. Diagnose the shape loss: when an event/command/read-model property references a complex record type, emit an Information diagnostic that its shape (and any nested compliance annotations) cannot be expressed, so the loss is visible per the generator's nothing-dropped-silently principle.

Environment

  • Cratis.Arc.Screenplay 20.65.0 (Analysis/Types/TypeRegistry.cs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions