Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

# The gate on every push but main's and on every pull request, on a clean Linux machine of a fixed release: the browser module's tests, the build with no warnings, the library's tests and the format check. A push to
# candidate runs the full gate, which packs the package and checks its files, and keeps the package for the release to publish.
on:
push:
branches-ignore: [main]
pull_request:

permissions:
contents: read

# A newer push to a pull request supersedes the older run; every commit on a branch keeps its own result.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# DOMQL.NET tests against a DOMQL checkout beside its own, formaui-net.DOMQL beside formaui-net.DOMQL.NET, at the release its package depends on.
defaults:
run:
working-directory: formaui-net.DOMQL.NET

# Each action is pinned to the commit of the release named in its comment.
jobs:
gate:
name: Gate
runs-on: ubuntu-24.04
env:
CANDIDATE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/candidate' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: formaui-net.DOMQL.NET

# The tag of the DOMQL release the package depends on.
- name: Read the DOMQL release
id: domql
run: echo "tag=v$(grep -oP 'Include="formaui-net.DOMQL" Version="\K[^"]+' src/Forma.DOMQL.NET/Forma.DOMQL.NET.csproj)" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FormaUI/DOMQL
ref: ${{ steps.domql.outputs.tag }}
path: formaui-net.DOMQL

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
cache-dependency-path: |
formaui-net.DOMQL.NET/tests/scripts/package-lock.json
formaui-net.DOMQL/package-lock.json

# The SDK global.json pins, which the build requires exactly.
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: formaui-net.DOMQL.NET/global.json

- name: Gate
if: env.CANDIDATE != 'true'
shell: pwsh
run: ./build.ps1

- name: Full gate
if: env.CANDIDATE == 'true'
shell: pwsh
run: ./build.ps1 -Full

# The package the full gate built and checked, under the name a release reads it by, kept as long as GitHub allows.
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: env.CANDIDATE == 'true'
with:
name: packages
path: |
formaui-net.DOMQL.NET/artifacts/*.nupkg
formaui-net.DOMQL.NET/artifacts/*.snupkg
if-no-files-found: error
retention-days: 90
31 changes: 31 additions & 0 deletions .github/workflows/promotion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Promotion

# The promotion check on every pull request into main, from the FormaUI Versioning release DOMQL.NET follows: it comes from candidate, ci.yml's full gate passed on its head commit and kept the package, its
# version is higher than every release's and on no feed, and its changelog entry is dated.
on:
pull_request:
branches: [main]
types: [opened, edited, reopened, synchronize]

permissions:
contents: read
actions: read
pull-requests: read

# Each action is pinned to the commit of the release named in its comment.
jobs:
promotion:
name: Promotion
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}

# The version the package project declares, which the package carries.
- uses: FormaUI/Versioning/actions/promotion-check@68ff74cadbe94084384d29be93466713fd989b53 # v1.0.0-preview.1
with:
gate-workflow: ci.yml
version-command: >-
[regex]::Match((Get-Content src/Forma.DOMQL.NET/Forma.DOMQL.NET.csproj -Raw), '<Version>([^<]+)</Version>').Groups[1].Value
packages-artifact: packages
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

# A release tag's push: the release check of the FormaUI Versioning release DOMQL.NET follows, then the package and its symbols the candidate's full gate built, attached to the tag's GitHub release with
# their digests, and published from there to nuget.org through trusted publishing. A run that fails runs again for the same tag, publishing what the feed lacks.
on:
push:
tags: ['v*']

permissions:
contents: read

# Each action is pinned to the commit of the release named in its comment.
jobs:
release:
name: Release
runs-on: ubuntu-24.04
# Only a v* tag deploys to the release environment, and the feed's trusted-publishing policy names it, so only a release tag's run publishes.
environment: release
permissions:
contents: write
actions: read
pull-requests: read
id-token: write
steps:
# The whole history, so the check finds the tag's commit in main's.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

# The version the package project declares, which the package carries.
- id: check
uses: FormaUI/Versioning/actions/release-check@68ff74cadbe94084384d29be93466713fd989b53 # v1.0.0-preview.1
with:
gate-workflow: ci.yml
version-command: >-
[regex]::Match((Get-Content src/Forma.DOMQL.NET/Forma.DOMQL.NET.csproj -Raw), '<Version>([^<]+)</Version>').Groups[1].Value
packages-artifact: packages

- id: packages
uses: FormaUI/Versioning/actions/release-packages@68ff74cadbe94084384d29be93466713fd989b53 # v1.0.0-preview.1
with:
gate-run-id: ${{ steps.check.outputs.gate-run-id }}
packages-artifact: packages
name: DOMQL.NET

- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: global.json

# A short-lived nuget.org key, for the account NUGET_USER names, whose trusted-publishing policy names this workflow.
- id: nuget
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
with:
user: ${{ vars.NUGET_USER }}

# The package and its symbols, past a version nuget.org holds already.
- name: Publish to nuget.org
shell: pwsh
env:
NUGET_API_KEY: ${{ steps.nuget.outputs.NUGET_API_KEY }}
PACKAGES: ${{ steps.packages.outputs.directory }}
VERSION: ${{ steps.check.outputs.version }}
run: |
dotnet nuget push (Join-Path $env:PACKAGES "formaui-net.DOMQL.NET.$env:VERSION.nupkg") --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
if ($LASTEXITCODE -ne 0) {
throw 'Publishing to nuget.org failed.'
}
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Each release of DOMQL.NET's package, `formaui-net.DOMQL.NET`, newest first, with

## `1.0.0-preview.1`

*Unreleased · DOMQL `1.0.0-preview.4`*
*December 3, 2026 · DOMQL `1.0.0-preview.5`*

- The first preview: DOMQL from a .NET application, over DOMQL's connection. `services.AddDomql()` registers a `DomqlConnection` for each browser runtime. Owners end every operation they started in one call. Watches keep a copy of their result by change sets, mapped onto a type. Subscriptions hand each event to a handler that may answer it, and executions run once or continuously. The operations one turn starts cross in one call.
- The package serves its browser module at `_content/domql.net/domql.dotnet.js`, beside DOMQL's bundle, and references Microsoft.JSInterop.
- A watch whose options set `WaitForAcknowledgment = false` has each change cross with the browser task it happened in, in order with the events after it.
- Deliveries are taken in the order they crossed, a batch that crosses as a stream read before any after it is taken. Each is taken at its place, a watch's change applied and an event's handler started, and none waits for a handler to complete, so a handler finds the state before its event, and a handler that awaits a dialog holds no change that crossed after it.
- The package serves its browser module at `_content/domql.net/domql.dotnet.js`, beside DOMQL's bundle, and depends on `formaui-net.DOMQL` `1.0.0-preview.5`, which serves that bundle, and on Microsoft.JSInterop.
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Working on DOMQL.NET

DOMQL.NET is DOMQL from a .NET application: a C# library over [DOMQL's connection](https://github.com/FormaUI/DOMQL/blob/v1.0.0-preview.4/spec/connections.md), and the browser module that opens it. It ships as the NuGet package `formaui-net.DOMQL.NET`.
DOMQL.NET is DOMQL from a .NET application: a C# library over [DOMQL's connection](https://github.com/FormaUI/DOMQL/blob/v1.0.0-preview.5/spec/connections.md), and the browser module that opens it. It ships as the NuGet package `formaui-net.DOMQL.NET`.

DOMQL.NET follows [FormaUI Versioning `v1.0.0-preview.1`](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/README.md) for its [stages](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/versions.md#stages), [branches](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/branches.md), [commits](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/commits.md), [releases](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/releases.md) and [packages](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/packages.md).

Expand All @@ -10,7 +10,7 @@ Read the documents that govern the affected contract:

| Document | Authority |
| --- | --- |
| [DOMQL's specification](https://github.com/FormaUI/DOMQL/blob/v1.0.0-preview.4/spec/README.md) | What a query means, and the connection DOMQL.NET speaks, at the DOMQL release DOMQL.NET builds against |
| [DOMQL's specification](https://github.com/FormaUI/DOMQL/blob/v1.0.0-preview.5/spec/README.md) | What a query means, and the connection DOMQL.NET speaks, at the DOMQL release DOMQL.NET builds against |
| [Specification](spec/README.md) | DOMQL.NET's API |
| [Design](docs/design.md) | How DOMQL.NET is built |
| [Status](docs/features-status.md) | What is implemented, and what remains |
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,17 @@ In your pull request, explain the problem, the resulting behavior and how you ve
## Commit messages

Commits follow [FormaUI Versioning's commits](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/commits.md), with the scope `domql-net`: a title under 50 characters, lowercase and imperative, one purpose per commit.

<a id="cut-a-release"></a>

## Cut a release

A release is a candidate that passed its full gate, promoted to `main` and tagged there, as [FormaUI Versioning's releases](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/releases.md) set out. Publishing its package is the step after it.

1. **Set the release on `dev`.** Pause merges unrelated to it, as [stabilizing a candidate](https://github.com/FormaUI/Versioning/blob/v1.0.0-preview.1/docs/branches.md#stabilizing-a-candidate) sets out. Check that the package project declares the release's version, `<Version>`, and the DOMQL release it depends on, with DOMQL's documents linked at that release, and date the changelog's newest entry by the day of the release.
2. **Select the candidate.** Fast-forward `candidate` to `dev`'s tip, `git push origin dev:candidate`. `ci.yml` runs the full gate on it, against DOMQL checked out at the release the package depends on, and keeps the package. A fix lands on `dev`, and `candidate` moves to the corrected tip.
3. **Promote it.** Open a pull request from `candidate` into `main`, which `promotion.yml` checks. Once the check passes, a release signer fast-forwards `main` to it, `git push origin candidate:main`.
4. **Tag it.** A release signer tags `main`'s commit with an annotated, signed tag, `git tag -s v1.0.0-preview.1 -m "DOMQL.NET 1.0.0-preview.1"`, and pushes it, `git push origin v1.0.0-preview.1`. A pushed tag is never moved or deleted.
5. **Publish it.** The tag's push runs `release.yml`, which publishes the package and its symbols to nuget.org through trusted publishing. A run that fails runs again for the same tag, and publishes what the feed lacks.

After a release, the next change a caller can notice opens the changelog's next entry.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DOMQL.NET runs [DOMQL](https://github.com/FormaUI/DOMQL) queries from a .NET application. It watches the DOM, subscribes to its events and carries out executions in the browser, and keeps a typed copy of each result in .NET. It is published by FormaUI, beside DOMQL and Forma.

> **Preview, unreleased.** DOMQL.NET's first preview, `1.0.0-preview.1`, waits for DOMQL's release `1.0.0-preview.4`, which brings the connection it runs over. See [the status](docs/features-status.md).
> **Preview.** DOMQL.NET's first preview, `1.0.0-preview.1`, is published to NuGet. It runs over DOMQL's connection, and its package depends on DOMQL's release `1.0.0-preview.5`. See [the status](https://github.com/FormaUI/DOMQL.NET/blob/main/docs/features-status.md).

```csharp
builder.Services.AddDomql();
Expand All @@ -25,20 +25,28 @@ await owner.DisposeAsync(); // Ends every operation the owner started, in one ca
- **A watch keeps a copy.** Each change arrives as a change set, applied to the watch's copy before the browser sends the next.
- **Events arrive as they happen,** and a subscription's handler can answer one.

## Install

```sh
dotnet add package formaui-net.DOMQL.NET --prerelease
```

It brings DOMQL's package, `formaui-net.DOMQL`, whose bundle it serves beside its own browser module. A page needs no script of its own: `AddDomql` registers the connection, and its first request imports the module.

## Documents

| Document | What it holds |
| --- | --- |
| [Specification](spec/README.md) | DOMQL.NET's API: its connection, queries and their types, owners, watches, subscriptions, executions, crossings and failures |
| [Design](docs/design.md) | How DOMQL.NET is built |
| [Status](docs/features-status.md) | What is implemented, and what remains |
| [Decisions](docs/decisions.md) | Each decision, with why and what was declined |
| [Changelog](CHANGELOG.md) | Each release of the package |
| [Contributing](CONTRIBUTING.md) | Building and testing DOMQL.NET |
| [Specification](https://github.com/FormaUI/DOMQL.NET/blob/main/spec/README.md) | DOMQL.NET's API: its connection, queries and their types, owners, watches, subscriptions, executions, crossings and failures |
| [Design](https://github.com/FormaUI/DOMQL.NET/blob/main/docs/design.md) | How DOMQL.NET is built |
| [Status](https://github.com/FormaUI/DOMQL.NET/blob/main/docs/features-status.md) | What is implemented, and what remains |
| [Decisions](https://github.com/FormaUI/DOMQL.NET/blob/main/docs/decisions.md) | Each decision, with why and what was declined |
| [Changelog](https://github.com/FormaUI/DOMQL.NET/blob/main/CHANGELOG.md) | Each release of the package |
| [Contributing](https://github.com/FormaUI/DOMQL.NET/blob/main/CONTRIBUTING.md) | Building and testing DOMQL.NET |

## Build and try it

DOMQL.NET builds and tests against a DOMQL checkout beside it, as [contributing](CONTRIBUTING.md) sets out:
DOMQL.NET builds and tests against a DOMQL checkout beside it, as [contributing](https://github.com/FormaUI/DOMQL.NET/blob/main/CONTRIBUTING.md) sets out:

```powershell
git clone https://github.com/FormaUI/DOMQL.git formaui-net.DOMQL
Expand All @@ -49,4 +57,4 @@ cd formaui-net.DOMQL.NET

## License

Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
Apache License 2.0. See [LICENSE](https://github.com/FormaUI/DOMQL.NET/blob/main/LICENSE) and [NOTICE](https://github.com/FormaUI/DOMQL.NET/blob/main/NOTICE).
Loading