Skip to content

query: distinguish observable (live) queries from one-shot queries #37

Description

@woksin

Summary

A query declaration cannot state whether the query is observable/live (a subscription pushing updates) or one-shot (request/response). Arc distinguishes these structurally (ISubject<T> vs Task<T>/IEnumerable<T> returns), the framework's guidance favors reactive queries, and screens behave differently depending on which they bind — but the document flattens both into the same shape.

Evidence (real application)

In Ada, 39 of 64 query-bearing read models expose observable (ISubject) queries; the rest are one-shot lookups. The generated document (Cratis.Arc.Screenplay 20.65.0) renders both identically:

query All => AdvisorInvoicePreparationQueue[]
  authorize CustomerAdvisor
    or FinanceOfficer

Whether a screen bound to this query renders live data (and whether Stage must maintain a subscription) is unknowable from the document.

Suggested direction

A one-word marker, e.g.:

query All => AdvisorInvoicePreparationQueue[] observable

or an indented observable directive in the query body. Default (unmarked) = one-shot, so existing documents keep their meaning.

Context

Found while validating a generated 5,348-line document from a production Arc application against its source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions