Skip to content

Add provide: named values on $context, declared down the model tree - #1304

Merged
einari merged 11 commits into
mainfrom
feature/availability-provide
Nov 12, 2026
Merged

einari merged 11 commits into
mainfrom
feature/availability-provide

Conversation

@einari

@einari einari commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

A provide line adds a named value to $context, declared once at the application, a module, a feature or a slice and read as $context.<name> beneath it.

Added

  • provide <name> <Type> [optional] from query <Query> [by <expression>, ...], from host, from <literal or $context expression>, or a file reference or inline code block beneath it, at the application, module, feature and slice levels. The nearest declaration wins and an override keeps the type (Context values: provide at application, module, feature and slice #1300)
  • Diagnostics PLAY1119 to PLAY1129 for malformed, duplicate, reserved-name, mistyped, unknown-query, observable-query and cyclic provides
  • A Values property and ValuesAs<T>() on CommandContext, QueryContext, RuleContext, PolicyContext and the new ProvideContext, so code reads provided values by name
  • provide support in both compilers, the printer, Monaco (completion, hover, validation), the VS Code grammar and the MCP authoring index, with documentation and a multi-file fixture

Changed

  • Provided names and $context.audiences no longer raise PLAY0153 as unknown context paths
  • A model that uses provide in executable form reports PLAY0268 until a later release admits it; it is a preview construct

@einari einari added the minor New features, non-breaking additions label Nov 12, 2026
@einari einari self-assigned this Nov 12, 2026
@einari

einari commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Reviewer notes for #1300.

Verified locally on the final head:

  • dotnet: Screenplay.Specs 17,6xx passed (incl. for_Samples, for_Documentation), Mcp 3604, ContractCatalog 43, Matching 11, CanonicalVectors 786; Release build with warnings as errors clean.
  • TypeScript: Compiler 9692 tests, coverage gate at 99% (main is 99.00%), compile and lint clean; Monaco 1383; EventModels 396; VS Code extension 1044; McpApp 133; builds clean.
  • provide is a preview construct (executable use reports PLAY0268), so it is not in Samples/Invoicing. It is held by Documentation/screenplay/fixtures/provide.play and the multi-file Documentation/screenplay/fixtures/provide-composition/ (module-level value, slice-level override), pinned by when_compiling_the_provide_composition_fixture.

Not done:

  • Renaming a provide name through $context.<name> paths is not wired.
  • .cratis/ai/rules/project/samples.md could name the composition fixture; that file is a protected project rule and was not edited here.

Corpus impact: Cratis/AI#1144 tracks the skill corpus.

@einari

einari commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

AI corpus tracking: Cratis/AI#1144

@einari einari added the ai-corpus: tracked Language change; the AI corpus update is tracked in a linked Cratis/AI issue or PR label Nov 12, 2026
@einari
einari merged commit d5f839d into main Nov 12, 2026
54 checks passed
@einari
einari deleted the feature/availability-provide branch November 12, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-corpus: tracked Language change; the AI corpus update is tracked in a linked Cratis/AI issue or PR minor New features, non-breaking additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant