From 2261e35144dde0f6a3c60771345b45c93788c019 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 10:56:19 +0100 Subject: [PATCH 01/18] docs(decisions): accept ADR-0003 - Accept ADR-0003 by the maintainers' decision of 2026-11-19: dotnet/ keeps one solution with src/, tests/ and samples/, and a second NuGet package puts its version.json in its project folder. - Point its references to the rule "each package has one NBGV version.json at its toolchain root" at ADR-0004, which supersedes ADR-0002 and states that rule word for word. - Word its consequence for an accepted record: a second NuGet package needs a record that supersedes that rule of ADR-0004. - AGENTS.md: the rule for a new package's version.json no longer calls the question open; it names both records. --- AGENTS.md | 2 +- ...0003-keep-one-net-solution-with-role-folders.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d716904..56c179a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,7 @@ There is no build at the root: each language builds and tests from its own folde - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. - A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`-ci.yml`, `-release-.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language (`dotnet-build-and-test`), so that each pull request check, named after its job, is unique across workflows; update [`docs/guides/release.md`](docs/guides/release.md); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. -- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md); where a second NuGet package's goes is still open, see the proposed [ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)); its release workflow `-release-.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md); the release guide. +- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `-release-.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md); the release guide. - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md); a release step → [`docs/guides/release.md`](docs/guides/release.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. - How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), which are maintained outside this repository; this repository only links them. diff --git a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md index d8c40ce..71bd482 100644 --- a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md +++ b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md @@ -1,6 +1,6 @@ --- -status: proposed -date: 2026-11-17 +status: accepted +date: 2026-11-19 decision-makers: Alberto Spelta, Marco Russo --- @@ -8,7 +8,7 @@ decision-makers: Alberto Spelta, Marco Russo ## Context and Problem Statement -[ADR-0001](0001-organize-the-repository-by-language.md) makes `dotnet/` the .NET toolchain root, with projects under `src/`, `tests/` and `samples/`, but it doesn't weigh that layout against others. Today `dotnet/` holds one NuGet package, `Dax.Formatter`: the library in `src/Dax.Formatter`, its tests in `tests/Dax.Formatter.Tests`, both in `Dax.Formatter.sln`, and a getting-started sample in `samples/GettingStarted` with a solution of its own, which builds against the published package. A second NuGet package would have to fit in. Should `dotnet/` keep one solution with folders by role, or give each package a folder with its own source, tests and samples? And where would a second package's NBGV `version.json` go, since [ADR-0002](0002-version-and-tag-each-package-independently.md) gives each package its own version? +[ADR-0001](0001-organize-the-repository-by-language.md) makes `dotnet/` the .NET toolchain root, with projects under `src/`, `tests/` and `samples/`, but it doesn't weigh that layout against others. Today `dotnet/` holds one NuGet package, `Dax.Formatter`: the library in `src/Dax.Formatter`, its tests in `tests/Dax.Formatter.Tests`, both in `Dax.Formatter.sln`, and a getting-started sample in `samples/GettingStarted` with a solution of its own, which builds against the published package. A second NuGet package would have to fit in. Should `dotnet/` keep one solution with folders by role, or give each package a folder with its own source, tests and samples? And where would a second package's NBGV `version.json` go, since [ADR-0004](0004-version-tag-and-release-each-package-independently.md) gives each package its own version? ## Considered Options @@ -29,7 +29,7 @@ Chosen option: "One solution with role folders", because one package, its tests * Good, because `dotnet build`, `dotnet test` and `dotnet pack` from `dotnet/` cover every .NET package, and CI builds the same solution; only its test and pack steps, which name their projects, change for a new package. * Good, because shared build settings stay in one `Directory.Build.props`, and the solution shows every library and test project together. -* Bad, because a second package's `version.json` sits in its project folder, not at the toolchain root: the rule of ADR-0002 that "each package has one NBGV `version.json` at its toolchain root" would then hold for `Dax.Formatter` only. Accepting this record means that rule needs a record that supersedes it when a second NuGet package arrives. +* Bad, because a second package's `version.json` sits in its project folder, not at the toolchain root: the rule of ADR-0004 that "each package has one NBGV `version.json` at its toolchain root" then holds for `Dax.Formatter` only, so a second NuGet package needs a record that supersedes that rule. * Bad, because a change to the shared build settings rebuilds and retests every package, and path filters must list the shared files each package builds from if such changes are to raise its version. * Neutral, because the precedents with role folders share one version prefix across their packages: independent versions inside role folders rest on NBGV alone. @@ -51,7 +51,7 @@ Chosen option: "One solution with role folders", because one package, its tests ### One folder per package: `dotnet//` with its own `src/`, `tests/` and `samples/` -* Good, because everything about a package is in one folder, and its `version.json` sits at the package's folder, close to ADR-0002's wording. +* Good, because everything about a package is in one folder, and its `version.json` sits at the package's folder, close to ADR-0004's wording. * Good, because it is the layout of Azure/azure-sdk-for-net, which versions each package on its own (`sdk///`). * Bad, because `global.json`, `nuget.config` and the shared build settings stay in `dotnet/`, so a package folder is not a toolchain root either. * Bad, because one package gains a level of folders and a solution, or the repository needs one solution per package plus one for all of them. @@ -65,7 +65,7 @@ Chosen option: "One solution with role folders", because one package, its tests ## More Information -- The layout this record refines: [ADR-0001](0001-organize-the-repository-by-language.md); versions and tags per package: [ADR-0002](0002-version-and-tag-each-package-independently.md). +- The layout this record refines: [ADR-0001](0001-organize-the-repository-by-language.md); versions and tags per package: [ADR-0004](0004-version-tag-and-release-each-package-independently.md). - No Microsoft documentation prescribes a folder layout for a .NET repository. The closest, the tutorial [Organizing and testing projects with the .NET CLI](https://learn.microsoft.com/dotnet/core/tutorials/testing-with-cli), puts the application under `src/` and the tests under `test/`, and notes that some developers keep them in the same folder. - Precedents, checked on 2026-11-17 with the GitHub contents API: - [microsoft/agent-framework](https://github.com/microsoft/agent-framework), `dotnet/`: `src/`, `tests/`, `samples/`, one solution `agent-framework-dotnet.slnx`, a shared `VersionPrefix` in `nuget/nuget-package.props`. @@ -73,4 +73,4 @@ Chosen option: "One solution with role folders", because one package, its tests - [modelcontextprotocol/csharp-sdk](https://github.com/modelcontextprotocol/csharp-sdk): `src/` with several packages (`ModelContextProtocol`, `ModelContextProtocol.Core`, `ModelContextProtocol.AspNetCore` and others), `tests/`, `samples/`, one solution `ModelContextProtocol.slnx`, a shared `VersionPrefix` in `src/Directory.Build.props`. - [Azure/azure-sdk-for-net](https://github.com/Azure/azure-sdk-for-net), `sdk///` with `src/`, `tests/` and `samples/` per package, for example `sdk/storage/Azure.Storage.Blobs/`, a `` in each package's project file, and solutions per service such as `sdk/storage/Azure.Storage.sln`. - NBGV: [`version.json`](https://dotnet.github.io/Nerdbank.GitVersioning/docs/versionJson.html), including secondary files in project folders, and [path filters](https://dotnet.github.io/Nerdbank.GitVersioning/docs/path-filters.html), relative to the `version.json` that declares them. -- Revisit when a second NuGet package is planned, together with the rule of ADR-0002 on where its `version.json` goes, or if the packages start to need separate build settings. +- Revisit when a second NuGet package is planned, together with the rule of ADR-0004 on where its `version.json` goes, or if the packages start to need separate build settings. From 6559001c5238cdc14912863bb8f7033b108f2709 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 10:57:39 +0100 Subject: [PATCH 02/18] docs: move the release and CI notes of the layout plan - Architecture: say why the release workflows read the version from the NBGV copy that stamps the package. Two NBGV versions can count different heights for the same commit, so another copy, such as the nbgv action, could push or tag a version other than the packed one. - Architecture: a continuous integration section says when the CI workflows run and why their job ids carry the language, and that a required check of a workflow skipped by its path filter blocks merging; a check can be required only if its job runs on every pull request, as a gate job in a workflow without path filters does. - Release guide: the tag ruleset a maintainer sets up once, with its rules and why "Restrict creations" is left out. - Release guide: what to do if the MCP release fails at npm ci because setup-node v7 no longer sets a placeholder NODE_AUTH_TOKEN. - AGENTS.md: the rule on CI job ids links its reason in the architecture instead of restating it. - These lived only in the language-first layout plan, which closes. --- AGENTS.md | 2 +- docs/design/architecture.md | 8 +++++++- docs/guides/release.md | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 56c179a..0c6645c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,7 +23,7 @@ There is no build at the root: each language builds and tests from its own folde ## When you change X, update Y - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. -- A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`-ci.yml`, `-release-.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language (`dotnet-build-and-test`), so that each pull request check, named after its job, is unique across workflows; update [`docs/guides/release.md`](docs/guides/release.md); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. +- A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`-ci.yml`, `-release-.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); update [`docs/guides/release.md`](docs/guides/release.md); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. - A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `-release-.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md); the release guide. - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md); a release step → [`docs/guides/release.md`](docs/guides/release.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. diff --git a/docs/design/architecture.md b/docs/design/architecture.md index e6a8891..955e678 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -85,6 +85,12 @@ Each package has its own version, tags and release workflow ([ADR-0004](../decis | CI | `dotnet-ci.yml` | `typescript-ci.yml` | | Release | `dotnet-release-dax-formatter.yml`, to nuget.org with Trusted Publishing; the assembly is strong-named with a key that the workflow writes from a secret | `typescript-release-daxformatter-mcp.yml`, to npm with provenance | -Both release workflows read the version from the same NBGV copy that stamps the package, run only from `master`, and create a draft GitHub release. +Both release workflows read the version from the same NBGV copy that stamps the package, run only from `master`, and create a draft GitHub release. Two NBGV versions can compute different heights for the same commit: on a simulated move of [ADR-0001](../decisions/0001-organize-the-repository-by-language.md), the nbgv CLI 3.10.94 counted the rename commit and the `Nerdbank.GitVersioning` 3.9.50 MSBuild task didn't. Reading the version from another copy, such as the nbgv GitHub action, which installs the latest stable nbgv CLI by default, could push or tag a version other than the packed one. `dotnet/version.json` must never have the same content as the root `version.json` of the commits before the move ([ADR-0001](../decisions/0001-organize-the-repository-by-language.md)), whose path filter was `src/Dax.Formatter`. While the two files are identical, NBGV resolves the relative path filter from the old root location, so commits under `dotnet/src/Dax.Formatter` don't raise the version height and the computed version is 1.2.2, already published on nuget.org (seen with the nbgv CLI 3.7.112, 3.9.50 and 3.10.94 and the `Nerdbank.GitVersioning` 3.9.50 MSBuild task). Once the content differs, the filter resolves under `dotnet/` and the height continues from the 1.2 history. Hence the filter is written `./src/Dax.Formatter`: written as `src/Dax.Formatter`, it would make the files identical again. + +## Continuous integration + +Each CI workflow runs on pull requests and pushes to `master` that change its language folder or its own workflow file, and can also be run by hand. Its job id starts with the language, `dotnet-build-and-test` and `typescript-build-and-test`, so each check, named after its job, is unique across workflows. + +A required check of a workflow that its path filter skips stays pending and blocks merging, and GitHub advises against requiring workflows that can be skipped ([Troubleshooting required status checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks)). A check can be required only if its job runs on every pull request: for example, one workflow without path filters, whose build jobs are skipped by job conditions when their folder hasn't changed, since a job skipped by a condition reports success, and a gate job that needs them as the only required check. That page documents these pieces, not the whole pattern. diff --git a/docs/guides/release.md b/docs/guides/release.md index a5773e0..3169efe 100644 --- a/docs/guides/release.md +++ b/docs/guides/release.md @@ -18,6 +18,7 @@ Publish a new version of `Dax.Formatter` to nuget.org or of `@sqlbi/daxformatter - Set up once by a maintainer: - .NET: on nuget.org, a Trusted Publishing policy for this repository and the workflow file `dotnet-release-dax-formatter.yml`; the repository secrets `NUGET_USER`, the nuget.org user name (profile name, not the email address) that `NuGet/login` signs in with, and `SIGNING_KEY`, the strong-name key in base64. - MCP server: the repository secret `NPM_TOKEN`, an npm token that can publish `@sqlbi/daxformatter-mcp`. + - Tags: one tag ruleset targeting `*-v*`, `v*` and `DaxFormatter_MCP_v*`, with "Restrict updates", "Restrict deletions" and "Block force pushes". Not "Restrict creations": GitHub doesn't document whether publishing a draft, or `gh release create` with the workflow's `GITHUB_TOKEN`, would then need a bypass. | Package | Workflow file | Tag | Release title | Release flags | |---|---|---|---|---| @@ -53,6 +54,7 @@ Actions shows each workflow under its file name without `.yml`. - "Releases run only from refs/heads/master": run the workflow again with branch `master`. - "The SIGNING_KEY secret is missing or empty": a maintainer sets the secret, then run again. - The nuget.org sign-in fails: the Trusted Publishing policy must name `dotnet-release-dax-formatter.yml` and this repository. +- The MCP release fails at `npm ci` with an authentication error or one about `NODE_AUTH_TOKEN`: nothing is published yet. The `.npmrc` that setup-node writes reads the token from `NODE_AUTH_TOKEN`, which only the publish step sets, and since v7 setup-node no longer sets a placeholder, without which older Node.js and npm versions may fail ([README](https://github.com/actions/setup-node)). In a pull request, give the install step a placeholder `NODE_AUTH_TOKEN`, not the `NPM_TOKEN` secret, which the install scripts of the dependencies would see; then run again. - `dotnet nuget push` or `npm publish` fails because the version exists: no commit has touched the package's path filter since the last release. Merge the change to release first. - The package is published but the GitHub release is missing: create the draft by hand on the commit the workflow ran on, with the tag, title and flags of the table; then continue from step 2. If GitHub rejects `--latest` on a draft, run the command without it: step 3 sets it at publish. ```bash From 313afc698ebb9e97b2d9b5e3d02361d6b0ed6051 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 10:57:59 +0100 Subject: [PATCH 03/18] docs(agents): add the workflow, signing key and samples rules - AGENTS.md: workflows follow GitHub's secure use reference, as all four already do: actions pinned to full commit SHAs with the version in a comment, which Dependabot updates; contents: read at the top and write permissions on the job; expressions reach scripts through env. Every checkout sets persist-credentials: false. - AGENTS.md: the .snk path in dotnet/Directory.Build.props and the path where the release workflow writes the key change together, because the build signs only when the file exists and a mismatch builds an unsigned package without an error. The rule is at the root, because it spans dotnet/ and .github/workflows/. - dotnet/AGENTS.md: never delete samples/Directory.Build.props or .targets, which keep the samples off the build settings of dotnet/; an empty file fails with MSB4024. - These rules lived only in the language-first layout plan, which closes. --- AGENTS.md | 2 ++ dotnet/AGENTS.md | 1 + 2 files changed, 3 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 0c6645c..d592a35 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,10 +28,12 @@ There is no build at the root: each language builds and tests from its own folde - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md); a release step → [`docs/guides/release.md`](docs/guides/release.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. - How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), which are maintained outside this repository; this repository only links them. +- The `.snk` path in `dotnet/Directory.Build.props` → the path where `dotnet-release-dax-formatter.yml` writes the key from `SIGNING_KEY`, and the other way round: the build signs only when the file exists, so a mismatch builds an unsigned package without an error. - Work planned, open decisions, known debt → [`docs/backlog.md`](docs/backlog.md); a large piece of work in progress → its plan in `docs/plans/`, with its Progress updated in every pull request. ## Conventions - Accepted records in [`docs/decisions/`](docs/decisions/README.md) are binding: when a change contradicts one, stop and ask. Proposed records are context. - Commits and pull requests follow [`CONTRIBUTING.md`](CONTRIBUTING.md#commits-and-pull-requests). +- Workflows follow GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use): actions pinned to a full commit SHA with the version in a comment on the same line, which [Dependabot updates](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#github-actions) with the SHA; `permissions: contents: read` at the top, and write permissions only on the job that needs them; expressions passed to scripts through `env`, never written into `run`. Every checkout also sets `persist-credentials: false`. - Documents are in plain English, describe the present, and link within the repository with relative links. Package READMEs are written for their registry, with only what a package user needs: the npm README uses absolute URLs only. diff --git a/dotnet/AGENTS.md b/dotnet/AGENTS.md index e2c8802..2e22618 100644 --- a/dotnet/AGENTS.md +++ b/dotnet/AGENTS.md @@ -24,6 +24,7 @@ dotnet build ./samples/GettingStarted/getting-started.sln - Ask first: changes to `Directory.Build.props`, package references, target frameworks, or the public API of `Dax.Formatter`, which is a published package. - Never: edit `global.json` or `nuget.config` to make a build pass. - Never: commit `src/Dax.Formatter/DaxFormatter.snk`, the strong-name key that the release workflow writes from a secret; `.gitignore` ignores it. +- Never: delete `samples/Directory.Build.props` or `samples/Directory.Build.targets`. They contain only ``, so the samples don't inherit the build settings of `dotnet/`; an empty file fails with MSB4024. - Never: run `dotnet format`, lower `AnalysisMode` or `AnalysisLevel`, or add a broad `NoWarn` to get a clean build. - Always: follow the root `.editorconfig` (C# style, indentation, encoding) in the lines you change; don't reformat the rest of a file. From 953ce4b104a5b6fdad8d4b216085de3e2f801db2 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 10:58:50 +0100 Subject: [PATCH 04/18] docs(backlog): record the follow-ups of the layout plan - Next, first: run the MCP server's workflows on a supported Node.js LTS, since both set Node.js 20, which reached end of life on 2026-04-30; npm trusted publishing needs Node.js 22.14 or later, so it comes after. - Later: a timeout for the dotnet-ci job, which runs up to GitHub's default of 360 minutes against the live service, and a concurrency group that cancels superseded pull request runs in both CI workflows. - Known debt: releases are tied to master only by the branch guard in each workflow file, and the nuget.org policy for the pre-move release.yml, which no workflow on master uses any more, is to be removed; a GitHub environment limited to master, named in the nuget.org policy, repays the rest. - Known debt: the .NET files whose byte order mark, final newline, trailing whitespace or indentation contradicts .editorconfig, listed so that one commit can normalize them. - Also: the npm trusted publishing item names its dependency on the Node.js item, and the null formatted item drops a clause that restated its cost. --- docs/backlog.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/backlog.md b/docs/backlog.md index 42495b6..2a98034 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -6,7 +6,8 @@ Reports and requests from users stay in [GitHub Issues](https://github.com/sql-b Reorganizing the repository by language and releasing each package with its own version and tags: [`plans/language-first-layout.md`](plans/language-first-layout.md). ## Next -- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml` (so after the move), the release job runs on Node 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and the Maintainer deletes the token. +- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, and Node.js 20 reached end of life on 2026-04-30; the LTS majors on 2026-11-19 are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it; `CONTRIBUTING.md` needs no change, since it points to the major that `typescript-ci.yml` sets. What stays out: the `engines` field of `package.json`, a change to the published package that needs asking first. +- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml` (so after the move), the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. It depends on the Node.js LTS item above. - MCP registry entry for the stdio server: AI clients that browse the registry find it there. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and the release guide says how to update the entry. ## Later @@ -14,10 +15,14 @@ Reorganizing the repository by language and releasing each package with its own - TypeScript client library in `typescript/packages/daxformatter`, extracted from the port inside the MCP package and used by it. - npm workspaces rooted at `typescript/`, so the npm packages share one lockfile and one install; needed once there are two npm packages. - Python client in `python/`. +- `timeout-minutes` for the job of `dotnet-ci.yml`, whose tests call the live service: it has none, so a stuck run lasts up to GitHub's default of 360 minutes ([workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)). +- `concurrency` groups in both CI workflows, so that a newer push to a pull request cancels its older run. ## Known debt - Enum wire format diverges between the clients: the .NET client sends `ServerMode`, `ServerEdition` and `ServerLocation` as numbers (System.Text.Json web defaults, no converter), while the TypeScript port sends them as strings; `ServerType` is a string in both (`EnumMember` values through `JsonEnumMemberConverter` in .NET). Cost: the service receives two forms of the same fields, and a new client has no rule to follow; changing the .NET form changes the wire format of a published package. Repay with the OpenAPI contract, which fixes one form for every client. - The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool for the options it exposes. Cost: every contract change touches each copy, and the copies already drift (the enum wire format above). Repay with the OpenAPI contract and its shared test vectors. - The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install today. Repay in the next change to the sample. - The .NET tests call the live service: `DaxFormatterClientTests` uses a real `DaxFormatterClient`, so .NET CI depends on the service and the network, and an outage fails unrelated pull requests. The MCP tests inject a mock `fetch` and run offline. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. -- The MCP server says that `formatted` is null for invalid DAX: the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` ("Invalid DAX: `formatted` is null") and the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description checks for null and misses the empty string. Repay with a change to the tool description and the type comment, outside the language-first layout plan: AI clients read the tool description, and the change raises the MCP server's version. +- The MCP server says that `formatted` is null for invalid DAX: the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` ("Invalid DAX: `formatted` is null") and the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description checks for null and misses the empty string. Repay with a change to the tool description and the type comment, outside the language-first layout plan, which raises the MCP server's version. +- Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy of a release workflow drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow before the [move](../CONTRIBUTING.md#reading-history-across-the-move), which no workflow on `master` uses any more; run each release job in a GitHub environment that only `master` can deploy to, with the release secrets moved into it and the environment named in the nuget.org policy ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). +- Some files under `dotnet/` don't follow `.editorconfig`. Byte order mark: `src/Dax.Formatter/AssemblyInfo.cs`, `src/Dax.Formatter/Client/Http/DaxFormatterHttpClient.cs` and `tests/Dax.Formatter.Tests/DaxFormatterClientTests.cs` lack the one it asks for in `*.cs`; `samples/GettingStarted/BasicFormatter.csproj` and `tests/Dax.Formatter.Tests/Dax.Formatter.Tests.csproj` have one, which it rules out in project files. Final newline: `global.json`, `nuget.config`, `BasicFormatter.csproj`, `src/Dax.Formatter/IDaxFormatterClient.cs` and `src/Dax.Formatter/Client/Http/IDaxFormatterHttpClient.cs` have none. Trailing whitespace: `README.md`, `BasicFormatter.csproj`, `samples/GettingStarted/Program.cs`, and `Models/DaxFormatterRequest.cs`, `Models/DaxFormatterMultipleRequest.cs`, `Security/SecurityHelpers.cs` and `Serialization/JsonEnumMemberConverter.cs` under `src/Dax.Formatter/`. Tabs: `src/Dax.Formatter/AnalysisServices/ServerLocation.cs` and `ServerMode.cs`, and the two `.sln` files, which Visual Studio writes with tabs while `[*]` asks for spaces. Cost: saving one in an editor that applies `.editorconfig` changes its byte order mark or whitespace, so the diff shows changes unrelated to the edit. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`. From 40cd92ce7b7085f688003b44f017cdc9f20edd8f Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 11:27:26 +0100 Subject: [PATCH 05/18] docs(decisions): allow link and typo fixes in any record - docs/decisions/README.md said that an accepted record is not rewritten, with no exception, while this pull request fixes the links of ADR-0001, ADR-0002 and ADR-0004 to the deleted plan. - A typo or a broken link fixed is not a change of decision, so it is allowed in any record and leaves its status and date as they are: MADR's date is when the decision was last updated. --- docs/decisions/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/decisions/README.md b/docs/decisions/README.md index ad0b5a2..f18d2dc 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -4,4 +4,5 @@ Architectural decision records in [MADR 4.0.0](https://github.com/adr/madr/tree/ - Accepted records bind the code: a change that contradicts one starts with a new record that supersedes it. - An accepted record is not rewritten; when superseded, only its status and date change. +- Fixing a typo or a broken link is not a change of decision: it is allowed in any record and leaves its status and date as they are. - Numbers are never reused; when two branches take the same number, the record merged second takes the next free one. From 727f50c1b324975df2ce7f5740fb6c01b18bd9f8 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 10:59:05 +0100 Subject: [PATCH 06/18] docs: delete the language-first layout plan - Delete docs/plans/language-first-layout.md: the work it planned is merged, and what lasts now lives in the records, the architecture, the release guide, the AGENTS.md files and the backlog. - Backlog: Now says no plan is open; drop the phrases that pointed at the plan or at the move as future work. - ADR-0001, ADR-0002 and ADR-0004 link the plan at its last version, commit 4928eac, so the link keeps working; only the URL changes, not the decisions or their dates. --- docs/backlog.md | 6 +- ...001-organize-the-repository-by-language.md | 2 +- ...sion-and-tag-each-package-independently.md | 2 +- ...-and-release-each-package-independently.md | 2 +- docs/plans/language-first-layout.md | 151 ------------------ 5 files changed, 6 insertions(+), 157 deletions(-) delete mode 100644 docs/plans/language-first-layout.md diff --git a/docs/backlog.md b/docs/backlog.md index 2a98034..f5e0d3a 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -3,11 +3,11 @@ Reports and requests from users stay in [GitHub Issues](https://github.com/sql-bi/DaxFormatter/issues); an item here links its issue instead of copying it. ## Now -Reorganizing the repository by language and releasing each package with its own version and tags: [`plans/language-first-layout.md`](plans/language-first-layout.md). +As of 2026-11-19: no plan open. ## Next - The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, and Node.js 20 reached end of life on 2026-04-30; the LTS majors on 2026-11-19 are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it; `CONTRIBUTING.md` needs no change, since it points to the major that `typescript-ci.yml` sets. What stays out: the `engines` field of `package.json`, a change to the published package that needs asking first. -- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml` (so after the move), the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. It depends on the Node.js LTS item above. +- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. It depends on the Node.js LTS item above. - MCP registry entry for the stdio server: AI clients that browse the registry find it there. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and the release guide says how to update the entry. ## Later @@ -23,6 +23,6 @@ Reorganizing the repository by language and releasing each package with its own - The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool for the options it exposes. Cost: every contract change touches each copy, and the copies already drift (the enum wire format above). Repay with the OpenAPI contract and its shared test vectors. - The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install today. Repay in the next change to the sample. - The .NET tests call the live service: `DaxFormatterClientTests` uses a real `DaxFormatterClient`, so .NET CI depends on the service and the network, and an outage fails unrelated pull requests. The MCP tests inject a mock `fetch` and run offline. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. -- The MCP server says that `formatted` is null for invalid DAX: the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` ("Invalid DAX: `formatted` is null") and the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description checks for null and misses the empty string. Repay with a change to the tool description and the type comment, outside the language-first layout plan, which raises the MCP server's version. +- The MCP server says that `formatted` is null for invalid DAX: the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` ("Invalid DAX: `formatted` is null") and the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description checks for null and misses the empty string. Repay with a change to the tool description and the type comment, which raises the MCP server's version. - Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy of a release workflow drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow before the [move](../CONTRIBUTING.md#reading-history-across-the-move), which no workflow on `master` uses any more; run each release job in a GitHub environment that only `master` can deploy to, with the release secrets moved into it and the environment named in the nuget.org policy ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). - Some files under `dotnet/` don't follow `.editorconfig`. Byte order mark: `src/Dax.Formatter/AssemblyInfo.cs`, `src/Dax.Formatter/Client/Http/DaxFormatterHttpClient.cs` and `tests/Dax.Formatter.Tests/DaxFormatterClientTests.cs` lack the one it asks for in `*.cs`; `samples/GettingStarted/BasicFormatter.csproj` and `tests/Dax.Formatter.Tests/Dax.Formatter.Tests.csproj` have one, which it rules out in project files. Final newline: `global.json`, `nuget.config`, `BasicFormatter.csproj`, `src/Dax.Formatter/IDaxFormatterClient.cs` and `src/Dax.Formatter/Client/Http/IDaxFormatterHttpClient.cs` have none. Trailing whitespace: `README.md`, `BasicFormatter.csproj`, `samples/GettingStarted/Program.cs`, and `Models/DaxFormatterRequest.cs`, `Models/DaxFormatterMultipleRequest.cs`, `Security/SecurityHelpers.cs` and `Serialization/JsonEnumMemberConverter.cs` under `src/Dax.Formatter/`. Tabs: `src/Dax.Formatter/AnalysisServices/ServerLocation.cs` and `ServerMode.cs`, and the two `.sln` files, which Visual Studio writes with tabs while `[*]` asks for spaces. Cost: saving one in an editor that applies `.editorconfig` changes its byte order mark or whitespace, so the diff shows changes unrelated to the edit. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`. diff --git a/docs/decisions/0001-organize-the-repository-by-language.md b/docs/decisions/0001-organize-the-repository-by-language.md index c3f31e5..4d69750 100644 --- a/docs/decisions/0001-organize-the-repository-by-language.md +++ b/docs/decisions/0001-organize-the-repository-by-language.md @@ -8,7 +8,7 @@ decision-makers: Alberto Spelta, Marco Russo ## Context and Problem Statement -The repository publishes two packages built with different toolchains: the .NET client `Dax.Formatter` on NuGet, whose solution and build settings sit in `src/` and whose SDK pin, package sources, version file, icon and readme sit at the repository root; and the MCP server `@sqlbi/daxformatter-mcp` on npm, in `mcp/`, which carries its own TypeScript port of the client. A TypeScript client library and a Python client are planned, and the repository is meant to be the public reference for DAX Formatter users. The root is today both the .NET toolchain root and the repository's front page, so a new language or package has no clear place. How should the repository be laid out so that each package builds, versions and releases on its own? The restructuring is planned in [`language-first-layout.md`](../plans/language-first-layout.md). +The repository publishes two packages built with different toolchains: the .NET client `Dax.Formatter` on NuGet, whose solution and build settings sit in `src/` and whose SDK pin, package sources, version file, icon and readme sit at the repository root; and the MCP server `@sqlbi/daxformatter-mcp` on npm, in `mcp/`, which carries its own TypeScript port of the client. A TypeScript client library and a Python client are planned, and the repository is meant to be the public reference for DAX Formatter users. The root is today both the .NET toolchain root and the repository's front page, so a new language or package has no clear place. How should the repository be laid out so that each package builds, versions and releases on its own? The restructuring is planned in [`language-first-layout.md`](https://github.com/sql-bi/DaxFormatter/blob/4928eacfedfcd2be7a0f7807162b505f8242af11/docs/plans/language-first-layout.md). ## Considered Options diff --git a/docs/decisions/0002-version-and-tag-each-package-independently.md b/docs/decisions/0002-version-and-tag-each-package-independently.md index 4231f42..daa511a 100644 --- a/docs/decisions/0002-version-and-tag-each-package-independently.md +++ b/docs/decisions/0002-version-and-tag-each-package-independently.md @@ -8,7 +8,7 @@ decision-makers: Alberto Spelta, Marco Russo ## Context and Problem Statement -The two packages release on different channels and at different maturity: `Dax.Formatter` on NuGet in the stable 1.2 line, `@sqlbi/daxformatter-mcp` on npm in the 0.1 beta line. Each already gets its version from its own Nerdbank.GitVersioning (NBGV) `version.json` with path filters, but the tags follow two ad-hoc formats: `v` for .NET (`v1.0.0-preview4` to `v1.2.2`, the format `release.yml` creates) and `DaxFormatter_MCP_v` for the MCP server (`DaxFormatter_MCP_v0.1.3-beta` and `DaxFormatter_MCP_v0.1.4-beta`, created by `publish-mcp.yml`). More packages are planned ([ADR-0001](0001-organize-the-repository-by-language.md)). How should each package be versioned, tagged and released, so that a tag names its package, the "Latest" GitHub release stays the stable .NET client, and release notes start from the package's own previous release? The change is planned in [`language-first-layout.md`](../plans/language-first-layout.md). +The two packages release on different channels and at different maturity: `Dax.Formatter` on NuGet in the stable 1.2 line, `@sqlbi/daxformatter-mcp` on npm in the 0.1 beta line. Each already gets its version from its own Nerdbank.GitVersioning (NBGV) `version.json` with path filters, but the tags follow two ad-hoc formats: `v` for .NET (`v1.0.0-preview4` to `v1.2.2`, the format `release.yml` creates) and `DaxFormatter_MCP_v` for the MCP server (`DaxFormatter_MCP_v0.1.3-beta` and `DaxFormatter_MCP_v0.1.4-beta`, created by `publish-mcp.yml`). More packages are planned ([ADR-0001](0001-organize-the-repository-by-language.md)). How should each package be versioned, tagged and released, so that a tag names its package, the "Latest" GitHub release stays the stable .NET client, and release notes start from the package's own previous release? The change is planned in [`language-first-layout.md`](https://github.com/sql-bi/DaxFormatter/blob/4928eacfedfcd2be7a0f7807162b505f8242af11/docs/plans/language-first-layout.md). ## Considered Options diff --git a/docs/decisions/0004-version-tag-and-release-each-package-independently.md b/docs/decisions/0004-version-tag-and-release-each-package-independently.md index bad17f7..db1aa2a 100644 --- a/docs/decisions/0004-version-tag-and-release-each-package-independently.md +++ b/docs/decisions/0004-version-tag-and-release-each-package-independently.md @@ -8,7 +8,7 @@ decision-makers: Alberto Spelta ## Context and Problem Statement -[ADR-0002](0002-version-and-tag-each-package-independently.md) gave each package its own NBGV version and `-v` tags, and had each release pass `--notes-start-tag` with the package's previous tag, confirmed by a dry-run release. Putting it into the release workflows ([`language-first-layout.md`](../plans/language-first-layout.md), PR 4) showed three things. Generated release notes list every pull request merged since their starting point, of any package, so a maintainer edits them in the draft release anyway. Finding the previous tag takes `git describe` with a tag pattern per package, the full history and a special case for a package's first release. And GitHub doesn't document whether a draft keeps the Latest flag passed when it is created. The maintainers also removed the release dry run. Keeping the versions and tags of ADR-0002, how should a release set its notes and its flags? +[ADR-0002](0002-version-and-tag-each-package-independently.md) gave each package its own NBGV version and `-v` tags, and had each release pass `--notes-start-tag` with the package's previous tag, confirmed by a dry-run release. Putting it into the release workflows ([`language-first-layout.md`](https://github.com/sql-bi/DaxFormatter/blob/4928eacfedfcd2be7a0f7807162b505f8242af11/docs/plans/language-first-layout.md), PR 4) showed three things. Generated release notes list every pull request merged since their starting point, of any package, so a maintainer edits them in the draft release anyway. Finding the previous tag takes `git describe` with a tag pattern per package, the full history and a special case for a package's first release. And GitHub doesn't document whether a draft keeps the Latest flag passed when it is created. The maintainers also removed the release dry run. Keeping the versions and tags of ADR-0002, how should a release set its notes and its flags? ## Considered Options diff --git a/docs/plans/language-first-layout.md b/docs/plans/language-first-layout.md deleted file mode 100644 index 576897d..0000000 --- a/docs/plans/language-first-layout.md +++ /dev/null @@ -1,151 +0,0 @@ -# Language-first layout - -## Goal - -Reorganize the repository by language ([ADR-0001](../decisions/0001-organize-the-repository-by-language.md)) and version, tag and release each package on its own ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md), which supersedes [ADR-0002](../decisions/0002-version-and-tag-each-package-independently.md)), so that the repository becomes the public reference for DAX Formatter users and every package builds, tests, packs and releases as it does today. - -Done when all of these hold: - -- History: on `master`, `git log --follow --format='%h %ad' --date=short -- ` reaches the history before the move: for `dotnet/src/Dax.Formatter/DaxFormatterClient.cs` and `dotnet/src/Dax.Formatter/Dax.Formatter.csproj` back to `d9c11c8` (2021-01-30), for `typescript/packages/daxformatter-mcp/package.json` back to `b9e65a3` (2026-06-22). -- .NET client: from `dotnet/`, `dotnet build`, `dotnet test` and `dotnet pack` succeed; the `.nupkg` holds the readme, icon, license and `lib/{netstandard2.0,net8.0,net10.0}`, with the same file list as the published 1.2.2; the sample builds with the same warnings as before the move; `nbgv get-version -p dotnet` continues the 1.2 line above 1.2.2 (no exact patch number: every commit under the path filter adds to the height). -- MCP server: in `typescript/packages/daxformatter-mcp`, `npm ci`, `npm run typecheck`, `npm run build` and `npm test` succeed; `npm pack --dry-run` lists only `dist/**`, `README.md` and `package.json`; `nbgv get-version -p typescript/packages/daxformatter-mcp` gives 0.2.x-beta. -- CI and releases: `actionlint` reports nothing; pull request CI is green; the next release of each package from `master` succeeds, with `NuGet/login` validating the Trusted Publishing policy for `dotnet-release-dax-formatter.yml`; Dependabot reports no errors on the new paths; GitHub shows `CODEOWNERS` as valid; `gh release list` still shows the latest .NET release as "Latest". -- Documentation: every relative link in the Markdown files resolves (`lychee --offline` on `*.md`); each `AGENTS.md` is under 200 lines and each `CLAUDE.md` contains only `@AGENTS.md`; each record has valid front matter, numbering is continuous from `0001`, and `docs/decisions/README.md` has no index; no fact has two homes (the REST contract only in `docs/design/rest-api.md`; the MCP client setup only on docs.sqlbi.com, linked from the root `README.md` and the MCP package README); at the end `docs/plans/` is empty and the backlog has no stale `Now`. - -## Non-goals - -- No application change: code, public API, wire format and behaviour stay as they are, including the enum divergence recorded in the [backlog](../backlog.md). -- No new packages and no OpenAPI contract yet: they are backlog items. -- No history rewrite: files move with `git mv` only. -- No change to the package ids `Dax.Formatter` and `@sqlbi/daxformatter-mcp`, to existing tags, or to the default branch `master`. - -## Approach - -- Plan before code: this plan and the two records, in `status: proposed`, are reviewed before any file moves; PR 2 accepts the records. -- Guard the releases first (PR 1), so that a wrong path after the move fails a release instead of publishing a misversioned package. -- Move in one rename-only commit, then fix paths in separate commits, and merge PR 2 with "Rebase and merge": the rename-only commit reaches `master` as it is, so git detects every rename at 100% and `git log --follow` reaches each file's earlier history. A squash merge would fold renames and edits into one commit. PR 2 was squashed after all; history stays reachable with `git log --follow` (Decision log, 2026-11-17). -- Write the documentation and community files after the move (PR 3), so they describe the final paths; change the release conventions last (PR 4), because they change how releases are tagged. -- Set aside: rewriting history so that files appear at their new paths in old commits. It changes every commit id of a public repository, which breaks forks, clones and the commit ids recorded in published packages. The layout and versioning alternatives are in the two records. - -## Steps - -- [x] PR 0, plan (`docs/language-first-layout-plan`): `docs/README.md`, `docs/decisions/README.md`, ADR-0001 and ADR-0002 in `status: proposed`, `docs/backlog.md` and this plan. Verify: relative links resolve (`lychee --offline` on `*.md`); the records have valid front matter; review approved. -- [x] PR 1, release guards (`ci/release-guards`). Verify: `actionlint`; after the merge, a run of each release workflow with `dry_run=true` from `master` passes every guard and publishes nothing, and a run from a branch created from `master` after the merge stops at the branch guard (Discoveries). - - Before PR 2: close or merge the open Dependabot pull requests, and park the other open branches that touch files being moved. - - In `release.yml` and `publish-mcp.yml` (now `dotnet-release-dax-formatter.yml` and `typescript-release-daxformatter-mcp.yml`): a `dry_run` input that skips publishing and the GitHub release; run only from `refs/heads/master`; read the version from the NBGV copy that stamps the package, the `Nerdbank.GitVersioning` MSBuild task and the `nbgv` CLI of the `nerdbank-gitversioning` npm package, instead of the nbgv action, so the tag and the pushed file can't differ from the packed version (Discoveries); follow GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use): actions pinned to full commit SHAs, `contents: read` by default and the write permissions on the job, no persisted git credentials, expressions passed to scripts through `env`, one run at a time with later runs queued. - - In `release.yml`: fail if the signing key secret is missing or empty, or the `.snk` can't be written from it. - - Maintainer: on nuget.org, add a Trusted Publishing policy for `dotnet-release-dax-formatter.yml`, since a policy names the workflow file; remove the `release.yml` policy after the first release from `dotnet-release-dax-formatter.yml`. - - Maintainer: enable "Allow rebase merging", for PR 2 only. -- [x] PR 2, move (`refactor/language-first-layout`), five commits, squashed into `6df1bf0` at the merge instead of "Rebase and merge" (Decision log, 2026-11-17). Verify: the Goal checks for history, the .NET client and the MCP server; in the .NET check, the version of the packed `.nupkg` equals `nbgv get-version -p dotnet` (with the nbgv CLI at the version of the `Nerdbank.GitVersioning` package), and a scratch commit under `dotnet/src/Dax.Formatter` raises it; a new file created in the MCP package shows in `git status`; `actionlint`; pull request CI green. - - [x] `refactor: move to language-first layout`, only `git mv`: `src/Dax.Formatter` to `dotnet/src/Dax.Formatter`, `src/Dax.Formatter.Tests` to `dotnet/tests/Dax.Formatter.Tests`, `samples/getting-started` to `dotnet/samples/GettingStarted`; `src/Dax.Formatter.sln`, `src/Directory.Build.props`, `version.json`, `global.json`, `nuget.config`, `package-icon.png` and `README.md` to `dotnet/`; `mcp` to `typescript/packages/daxformatter-mcp`; the workflows `ci.yml` to `dotnet-ci.yml`, `release.yml` to `dotnet-release-dax-formatter.yml`, `ci-mcp.yml` to `typescript-ci.yml`, `publish-mcp.yml` to `typescript-release-daxformatter-mcp.yml`. Verify: `git diff -M --summary` of the commit shows only `rename (100%)` (held for `dc92319`, which the squash folded into `6df1bf0`; it stays at `refs/pull/53/head`). - - [x] `build: update paths after move`: every row of the table under Path-dependent settings, plus `dotnet/samples/Directory.Build.props` and `dotnet/samples/Directory.Build.targets` containing only `` (a 0-byte file fails with MSB4024): today the sample inherits no build settings, and without them it would inherit `dotnet/Directory.Build.props`. Verify: from `dotnet/`, `dotnet build`, `dotnet test`, `dotnet pack`; the sample builds with the same warnings as before. - - [x] `build(mcp): bump version to 0.2-beta` in the MCP package's `version.json`, because the move restarts its NBGV height (ADR-0002). Verify: `nbgv get-version -p typescript/packages/daxformatter-mcp` gives 0.2.x-beta. - - [x] `docs: accept layout decisions`: ADR-0001 and ADR-0002 to `status: accepted` with the new `date`; Progress of this plan; a short root `README.md` that links `dotnet/README.md` and the MCP package README until PR 3, because without a root README GitHub shows `docs/README.md` as the repository's front page. Verify: the records have valid front matter; the repository page shows the short README. - - [x] `ci(dependabot): use conventional commit messages`: each entry of `dependabot.yml` gets a `commit-message` with `include: "scope"` and the prefix `build` for NuGet and npm, `ci` for GitHub Actions, so Dependabot titles read `build(deps): `, `build(deps-dev): ` and `ci(deps): `. Verify: the next Dependabot pull requests carry these prefixes. - - Maintainer: restore squash-only merging after the merge (PR 2 itself was squashed). -- [x] PR 3, documentation and community files (`docs/repository-landing`), merged as `335bcf3` (#59). Verify: `lychee --offline` on `*.md`; the `AGENTS.md` and `CLAUDE.md` checks of the Goal; no fact in two homes. - - Root `README.md` as a landing page, replacing PR 2's short one: what DAX Formatter is, a package table linking `dotnet/README.md` and the MCP package README, documentation, support, license. The documentation link goes to the user documentation on [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/), as in PR 2's README, not to `docs/`, which is for maintainers. - - `dotnet/README.md` stays the NuGet package readme; fix its sentence on endpoint resolution (Discoveries). - - `docs/design/architecture.md`: the client packages, the service they call, how each package is versioned and released, including why `dotnet/version.json` must stay different from the old root `version.json` (Discoveries). - - `docs/design/rest-api.md`, the only home of the public REST contract: endpoints, request and response fields, enums, errors, hashing of server and database names, caller identity; written from the .NET and TypeScript models. - - MCP client setup: docs.sqlbi.com stays its only home, for the [remote](https://docs.sqlbi.com/dax-formatter/mcp-http) and the [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio) server, so `docs/guides/connect-mcp-clients.md` is not created (Decision log, 2026-11-17). The MCP package README keeps what an npm user needs to start (the package, the command that runs it, the tool, privacy, license) and links both pages with absolute URLs; the root `README.md` links them too. - - [ADR-0003](../decisions/0003-keep-one-net-solution-with-role-folders.md) in `status: proposed`: why `dotnet/` keeps one solution with `src/`, `tests/` and `samples/` rather than one folder per package, and where a second NuGet package's `version.json` would go. - - `docs/guides/release.md`: how to release each package. - - `CONTRIBUTING.md` (where code goes, build and test per language, tags, how to read history across the move), `SECURITY.md`; no `CODE_OF_CONDUCT.md` (Decision log). Maintainer, before the merge, so that the channel `SECURITY.md` names exists when it is published: enable private vulnerability reporting. - - Issue forms with a component dropdown: .NET client, MCP server, formatting result (the service); a pull request template; `CODEOWNERS` keeps its single catch-all entry (Decision log). - - `AGENTS.md`, with a `CLAUDE.md` that contains only `@AGENTS.md`, at the root, in `dotnet/` and in `typescript/`, each `AGENTS.md` under 200 lines. - - `.editorconfig`: the maintainers' standard one, based on the one of dotnet/runtime (Decision log, Discoveries); an explicit `.gitattributes` replacing today's Visual Studio template: `* text=auto` as today, `*.png` and `*.snk` binary, `package-lock.json` `linguist-generated`. - - Move the Visual Studio `.gitignore` to `dotnet/.gitignore` and keep at the root only editor and OS entries (such as `.vs/` and `.idea/`), plus `*.snk`, `*.pfx` and `node_modules/`, which stay ignored anywhere (Decision log), so its .NET rules (`**/[Pp]ackages/*`, `[Dd]ebug/`, `[Rr]elease/`, `[Ll]og/`) stop matching under `typescript/`; the negation added in PR 2 goes with it (Discoveries). - - `docs/README.md` gains the rows for `design/` and `guides/`; `docs/design/README.md` lists the design documents. -- [ ] PR 4, release conventions (`ci/release-conventions`). Verify: the Goal checks for CI and releases; the first release of each package creates a draft with the new tag and the flags below; once it is published, `gh release list` shows its flags. - - In both release workflows: tags `-v`; `gh release create` with `--latest` for .NET and `--prerelease --latest=false` for the MCP server, still `--draft`; no `--notes-start-tag`, because the maintainer edits the generated notes in the draft, and no `dry_run` input any more (Decision log, 2026-11-19). - - In the CI workflows: `permissions: contents: read`; actions pinned to full commit SHAs and no persisted git credentials, as in the release workflows; a `push` trigger on `master`; unique job ids `dotnet-build-and-test` and `typescript-build-and-test`. - - In all four workflows: a `name:` equal to the file name without `.yml`, because PR 2 renames only the files, so the Actions page still shows `ci`, `release`, `ci-mcp` and `publish-mcp`. - - No gate job, because no check is known to be required (Decision log, 2026-11-17). - - [ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md) supersedes ADR-0002: the same versions and tags, no `--notes-start-tag` and no dry run (Decision log, 2026-11-19); the current references to ADR-0002 point to it. - - Remove the pull request template of PR 3 (Decision log, 2026-11-19). - - Update `docs/guides/release.md`, `AGENTS.md` (workflow names and job ids), `CONTRIBUTING.md` (CI on `master`); add to the backlog's Known debt the MCP tool description that calls `formatted` null for invalid DAX, found while checking the docs. - - Maintainer, after the merge: add one tag ruleset targeting `*-v*`, `v*` and `DaxFormatter_MCP_v*`, with "Restrict updates", "Restrict deletions" and "Block force pushes", not "Restrict creations" (Decision log, 2026-11-17); if a branch rule requires a check named `build-and-test`, replace it with `dotnet-build-and-test` and `typescript-build-and-test`. -- [ ] PR 5, closing. Verify: `docs/plans/` is empty; the backlog has no stale `Now`; `lychee --offline` on `*.md`. - - Move what lasts: decisions to records, design to `docs/design/`, leftovers to the backlog. - - Accept or reject the proposed [ADR-0003](../decisions/0003-keep-one-net-solution-with-role-folders.md); it still cites ADR-0002's rule on where a `version.json` goes, which ADR-0004 keeps. - - Delete this plan and remove its link from `Now`; point the records' links to this plan at its last version on GitHub. - -### Path-dependent settings - -Every row is part of PR 2's second commit. Paths are the ones after the move. - -| File | From | To | -|---|---|---| -| `dotnet/Dax.Formatter.sln` | project paths `Dax.Formatter\...`, `Dax.Formatter.Tests\...` | `src\Dax.Formatter\...`, `tests\Dax.Formatter.Tests\...` | -| `dotnet/src/Dax.Formatter/Dax.Formatter.csproj` | `..\..\LICENSE.md` | `..\..\..\LICENSE.md`; the README and icon paths stay as they are | -| `dotnet/tests/Dax.Formatter.Tests/Dax.Formatter.Tests.csproj` | `..\Dax.Formatter\Dax.Formatter.csproj` | `..\..\src\Dax.Formatter\Dax.Formatter.csproj` | -| `dotnet/Directory.Build.props` | `Condition` and `AssemblyOriginatorKeyFile` of the `.snk`: `$(MSBuildThisFileDirectory)Dax.Formatter\DaxFormatter.snk` | `$(MSBuildThisFileDirectory)src\Dax.Formatter\DaxFormatter.snk`. If wrong, the build comes out unsigned without errors, because the condition is only `Exists` | -| `dotnet/version.json` | path filter `src/Dax.Formatter` | `./src/Dax.Formatter`: the same folder, written so that the file is no longer identical to the old root `version.json` (Discoveries) | -| `.gitignore` | `**/[Pp]ackages/*` also ignores new files under `typescript/packages/` | add `!/typescript/packages/*/` after that rule. `*.snk` and `artifacts/` match at any depth and need no change | -| `typescript/packages/daxformatter-mcp/package.json` | `homepage` `.../tree/master/mcp`; `repository.directory` `mcp` | `https://github.com/sql-bi/DaxFormatter/tree/master/typescript/packages/daxformatter-mcp`; `typescript/packages/daxformatter-mcp` | -| `dotnet/README.md` | CI badge of `ci.yml` | `dotnet-ci.yml` | -| `.github/workflows/dotnet-ci.yml` | `paths` `src/**`; `global-json-file: global.json`; build, test and pack paths under `./src/` | `paths` `dotnet/**` and the workflow file; `global-json-file: dotnet/global.json` (relative to the workspace root); `defaults.run.working-directory: dotnet`, with the paths relative to it | -| `.github/workflows/dotnet-release-dax-formatter.yml` | `global-json-file: global.json`; the `.snk` written to `src/Dax.Formatter/DaxFormatter.snk`; version, build, test and pack paths under `./src/` | `global-json-file: dotnet/global.json`; `defaults.run.working-directory: dotnet`, with the paths relative to it, so the `.snk` path stays `src/Dax.Formatter/DaxFormatter.snk` and the file lands in `dotnet/src/Dax.Formatter/`; the branch guard, which runs before checkout, sets `working-directory: .`, because a step can't start in a `dotnet/` that doesn't exist yet | -| `.github/workflows/typescript-ci.yml` | `paths` `mcp/**`; `cache-dependency-path` and `working-directory` under `mcp` | `paths` `typescript/**` and the workflow file; the package path | -| `.github/workflows/typescript-release-daxformatter-mcp.yml` | `working-directory` under `mcp` | the package path | -| `.github/dependabot.yml` | nuget `/`; npm `/mcp` | `/dotnet`; `/typescript/packages/daxformatter-mcp`; github-actions `/` stays | - -## Progress - -- 2026-11-16: PR 0 opened; next, PR 1. -- 2026-11-16: PR 0 merged as `67dec46` (#48); PR 1 opened. -- 2026-11-17: PR 1 merged as `7809009` (#49). Not confirmed yet: its post-merge dry runs, and the Maintainer steps (the nuget.org Trusted Publishing policy for `dotnet-release-dax-formatter.yml`, "Allow rebase merging"). -- 2026-11-17: Dependabot: `actions/checkout` 7 (#31), `actions/setup-dotnet` 6 (#41) and `actions/setup-node` 7 (#42) merged; the npm pull requests closed without merging, so the MCP version on `master` stays 0.1.4-beta; the `dotnet/nbgv` 0.5 pull request is still to be closed, since the workflows no longer use the action. -- 2026-11-17: PR 2 opened. -- 2026-11-17: PR 2 merged as `6df1bf0` (#53), squashed: one commit with 55 renames at 100%, 11 renames at 55% to 96% (the four workflows, `Dax.Formatter.sln`, `Directory.Build.props`, both `.csproj` files, both `version.json` files and the MCP `package.json`) and 3 new files (`dotnet/README.md`, `dotnet/samples/Directory.Build.props` and `.targets`). The five commits of the branch stay at `refs/pull/53/head` (`ae20325`); the rename-only one is `dc92319`. Versions on `master`: .NET 1.2.3, MCP 0.2.1-beta; nothing released since the move. Not confirmed yet: the nuget.org Trusted Publishing policy for `dotnet-release-dax-formatter.yml`, squash-only merging restored, the dry runs of both release workflows from `master`, and closing the `dotnet/nbgv` 0.5 Dependabot pull request. -- 2026-11-17: PR 3 opened. -- 2026-11-17: PR 3 merged as `335bcf3` (#59). Not confirmed yet: the nuget.org Trusted Publishing policy for `dotnet-release-dax-formatter.yml`, squash-only merging restored, the dry runs of both release workflows from `master`, private vulnerability reporting, and closing the `dotnet/nbgv` 0.5 Dependabot pull request. -- 2026-11-17: PR 4 opened. -- 2026-11-19: by the maintainers' choice, PR 4 also removes the `dry_run` input of the release workflows, so the post-merge dry runs listed above as not confirmed are no longer due, and the lookup of each package's previous tag. -- 2026-11-19: PR 4 adds ADR-0004, which supersedes ADR-0002, and removes the pull request template of PR 3. - -## Discoveries - -- `.gitignore`: the Visual Studio rule `**/[Pp]ackages/*` matches `typescript/packages/`: after the move git silently ignores new files in the MCP package, while files already tracked are unaffected (checked with `git check-ignore` on a simulated move). The negation in the settings table fixes it; the package's own `.gitignore` still ignores `node_modules/` and `dist/`. Other Visual Studio rules, such as `[Dd]ebug/`, `[Rr]elease/` and `[Ll]og/`, would still match folders under `typescript/`, hence the split in PR 3. -- The client setup of the remote and stdio MCP servers, for VS Code, Claude and Codex, is already published on docs.sqlbi.com ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)) and in the MCP package README, so a guide in this repository would be a third copy. -- NBGV and the moved `dotnet/version.json`: on a simulated move, while `dotnet/version.json` is identical to the old root file, NBGV keeps resolving its relative path filter at the old root location, so commits under `dotnet/src/Dax.Formatter` don't raise the height and the version stays at 1.2.2, the published one (nbgv CLI 3.7.112 and 3.10.94, `Nerdbank.GitVersioning` 3.9.50 MSBuild task). Once the file's content changes, the filter resolves under `dotnet/` and the height continues from the 1.2 history. The file must stay different for good: on the PR 2 branch, writing the filter back as `src/Dax.Formatter` made it identical again, and a later commit under `dotnet/src/Dax.Formatter` no longer raised the version (nbgv CLI 3.9.50), so the next release would compute a version already on nuget.org. -- NBGV versions disagree after the move: on the simulated move, the nbgv CLI 3.10.94 counts the rename commit and the 3.9.50 MSBuild task doesn't, so their versions differ by one; the same NBGV version (3.10.94 for both) agrees. The nbgv action installs the latest CLI unless `toolVersion` is set, while the package version comes from the `Nerdbank.GitVersioning` package (.NET) and the `nerdbank-gitversioning` npm package (MCP). On a mismatch the .NET push looks for a `.nupkg` name that doesn't exist, and the MCP release would tag a version other than the one published to npm. Hence PR 1 reads the version from the copy that stamps each package and drops the nbgv action; `v0.4` of the action also runs whatever `nbgv` is on the `PATH` when the requested version can't be installed. -- The copies that stamp the packages also report the version: `dotnet msbuild -restore -target:GetBuildVersion -getProperty:NuGetPackageVersion` prints it, and the `nerdbank-gitversioning` npm package exposes the `nbgv` CLI next to `nbgv-setversion`, so `npx --no nbgv get-version --variable ` runs the CLI that stamps `package.json`. Dependabot bumps each copy with its package. -- The GitHub-hosted runner images ship .NET 8 to 11 and the nbgv CLI 3.10.94 ([Ubuntu 24.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md), [Windows Server 2025](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md)). The CLI in the npm package sets `rollForwardOnNoCandidateFx: 2` (major roll forward), so it runs on the runner's .NET and the MCP release needs no setup-dotnet. -- On a simulated `master` run, the .NET read gives `1.2.2` and the MCP read gives `0.1.4-beta`; on a branch, both carry a `-g` suffix. Both versions are already published, since no later commit touches the path filters, so a real release now fails at `dotnet nuget push` or `npm publish`; merging a Dependabot pull request under `mcp/` raises the MCP one. -- Dependabot updates actions pinned to a commit SHA, and the version comment on the same line ([supported ecosystems](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#github-actions)). -- The Dependabot majors, `actions/checkout` v7, `actions/setup-dotnet` v6 and `actions/setup-node` v7, already run on Node 24 and keep the inputs used here; the only change that affects these workflows is that setup-node v7 no longer exports a dummy `NODE_AUTH_TOKEN` when `registry-url` is set. The publish step sets its own token and `npm pack --dry-run` worked without one (npm 11, locally), but setup-node's README warns that older npm versions may fail without it and the MCP release runs `npm ci` with that `.npmrc`: the first MCP release after that bump shows it, and `npm ci` fails, if it does, before anything is published. -- A workflow run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), and `workflow_dispatch` runs on the last commit of the selected branch. The branch guard therefore stops only runs from branches that contain it: an older branch still runs its unguarded release workflow with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Parking the old branches narrows this. A release job in an environment limited to `master` would close it, with the secrets in that environment and the environment named in the nuget.org policy ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing)), because `NuGet/login` uses the job's OIDC token, not a secret. -- The legacy MCP tags `DaxFormatter_MCP_v*` match neither `*-v*` nor `v*`, so the ruleset covers them with a pattern of their own (Decision log, 2026-11-17). -- Before PR 4, both release workflows created draft releases (`--draft`) without the Latest or prerelease flags; the published MCP releases are marked prerelease, set when each draft was published. Whether the flags passed at creation hold when a draft is published is not documented (next bullet), so PR 4 passes them at creation and the release guide sets them again at publish (Decision log, 2026-11-17). -- GitHub's documentation doesn't say whether a draft keeps the Latest flag passed at creation. In the REST API, the `make_latest` field of [Create a release](https://docs.github.com/en/rest/releases/releases#create-a-release) reads "Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases.", and no page says whether a `make_latest` sent with a draft is kept until the draft is published. `prerelease` is a field of the release, separate from `draft` ([Update a release](https://docs.github.com/en/rest/releases/releases#update-a-release)), so a draft presumably keeps it (inferred, not stated). When a draft is published in the UI and "Set as latest release" is left unselected, GitHub assigns the Latest label by semantic versioning ([Managing releases in a repository](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)). In the gh source ([`pkg/cmd/release/create/`](https://github.com/cli/cli/tree/trunk/pkg/cmd/release/create)), `--latest` sends `make_latest` as `"true"` or `"false"`, with nothing different for drafts; with `--notes-start-tag`, gh calls the generate-notes endpoint with `previous_tag_name` and, on a 404 from it, silently leaves the notes empty ([`gh release create`](https://cli.github.com/manual/gh_release_create)). No page says whether a draft's tag is created when the draft is created or when it is published. -- Tag ruleset patterns use `fnmatch` with `File::FNM_PATHNAME`, so `*` doesn't match `/` but matches `.` ([Creating rulesets for a repository](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository)): `*-v*` matches `Dax.Formatter-v1.2.3` and `daxformatter-mcp-v0.2.1-beta` (inferred from the stated rule). The tag rules are "Restrict creations", "Restrict updates", "Restrict deletions" and "Block force pushes"; with "Restrict creations" only bypass actors can create matching tags, and no page says whether publishing a draft, or `gh release create` with the workflow's `GITHUB_TOKEN`, counts as a creation ([Available rules for rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets)). -- A required check of a workflow skipped by its path filter stays "Pending" and blocks merging; GitHub's only documented fix is "Avoid requiring workflows that can be skipped." A job skipped by a condition reports success, which is what an always-running gate job relies on; the gate pattern itself is not in GitHub's documentation ([Troubleshooting required status checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks)). -- Before PR 4, `ci.yml` had no `permissions` block, and `ci-mcp.yml` already had `contents: read`. -- The NuGet readme says the client resolves the server endpoint once and reuses it; the client calls fixed endpoint URLs. PR 3 fixes the sentence. -- The release workflows run only on `workflow_dispatch` and have no path filters; only the CI workflows do. -- The `dotnet` CLI looks for `global.json` from the current directory upward, not from the project's folder ([global.json overview](https://learn.microsoft.com/dotnet/core/tools/global-json)): run from the repository root, it ignores `dotnet/global.json` and uses the latest installed SDK. Hence the .NET workflows run in `dotnet/`, and the build instructions of PR 3 run from `dotnet/` too. -- Tracked files mix byte order marks: 26 of the 29 `.cs` files, 2 of the 3 `.csproj` files, both `.sln` files and `nuget.config` start with a UTF-8 BOM, and no other tracked text file does. The `.editorconfig` asks for a BOM in `.cs` files and for none in `.csproj` files, so saving one of the files that differ (three `.cs`, two `.csproj`) adds or removes its BOM; they are left as they are until they are edited. `ServerLocation.cs` and `ServerMode.cs` are indented with tabs, as are the `.sln` files, which Visual Studio writes that way. - -## Decision log - -- 2026-11-16: PR 2 also changes `dotnet/version.json` and `.gitignore`, and PR 1 pins and checks the nbgv CLI version, after the simulated move showed the problems under Discoveries. -- 2026-11-16: after review, squash-only merging comes back right after PR 2 instead of after PR 4, so PR 3 and PR 4 can't be rebase-merged by mistake; PR 2 adds a short root `README.md` until PR 3; PR 3 splits `.gitignore` and picks one home for the MCP client setup. -- 2026-11-16: `dry_run` defaults to `false`, so the one-click release stays as it is. A dry run still runs `NuGet/login`, because it validates the Trusted Publishing policy. The MCP dry run lists the package with `npm pack --dry-run`, which npm documents for that purpose and which needs no registry, token or provenance, rather than `npm publish --dry-run`. -- 2026-11-16: the guards are failing steps, the branch guard first, not job conditions, so a run from another branch shows as failed instead of skipped. -- 2026-11-17: after review, PR 1 reads the version from the NBGV copy that stamps each package instead of pinning the nbgv action's `toolVersion` to that copy and checking that the two agree: one copy can't disagree with itself, and the lock file parsing, the pin and the check go away. The MCP release drops setup-dotnet and the npm cache: the runner images ship .NET, and a release installs only what the lock file names. The release workflows follow GitHub's secure use reference; the CI workflows follow in PR 4. No public key token check, to keep the workflow simple: a wrong `.snk` path in `Directory.Build.props` after PR 2 builds an unsigned package without errors (Path-dependent settings), and no step of the release catches it. No `PublicRelease` check: the branch guard already requires `master`, the only ref in `publicReleaseRefSpec`. No check that the version is new: without `--skip-duplicate`, `dotnet nuget push` and `npm publish` fail on a version already published, before the GitHub release. `concurrency` uses `queue: max`, because the default queue cancels a pending release when another run is dispatched. -- 2026-11-17: after review, every release workflow names its package, `-release-.yml` (ADR-0001), not only the TypeScript one: ADR-0002 already gives each package its own release workflow, and a second NuGet package would have made `dotnet-release.yml` ambiguous. Set aside: one release workflow per language with a `package` input, which moves each package's paths and tag into inputs and mixes the packages' runs. The CI workflows stay one per language. The nuget.org policy names the workflow file, so it is added for `dotnet-release-dax-formatter.yml`; npm configures a trusted publisher per package anyway. -- 2026-11-17: PR 2 gets a fifth commit, which gives Dependabot's commits Conventional Commits prefixes, because the move already edits `dependabot.yml`; it stays a commit of its own so that the path commit holds only paths. Without `commit-message`, Dependabot copies the patterns it detects in the history ([options reference](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#commit-message--)), hence the plain "Bump ..." titles of #31, #41 and #42. The types follow [Angular's commit guidelines](https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md), the convention Conventional Commits builds on: `build` for external dependencies, `ci` for the CI configuration; `include: "scope"` adds `(deps)` or `(deps-dev)`. -- 2026-11-17: PR 2 was merged by squash, not with "Rebase and merge": `6df1bf0` holds the renames and the path edits in one commit, so 11 files show as renames below 100%, 3 as new files, and `git diff -M --summary` of the move no longer shows only `rename (100%)`. The history before the move stays reachable with `git log --follow`, so the Goal now checks that instead of the rename-only commit, which stays readable as `dc92319` at `refs/pull/53/head`. The commits are not restored, because that would rewrite `master` (Non-goals). -- 2026-11-17: the MCP client setup has one home, docs.sqlbi.com ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)): its pages already cover VS Code, Claude, Codex and any other client for both servers, and the remote server is not in this repository. PR 3 creates no `docs/guides/connect-mcp-clients.md`; the MCP package README drops its per-client sections and links both pages with absolute URLs, because npm shows it outside GitHub; the root `README.md` links them too. -- 2026-11-17: after review, the root `.gitignore` also ignores `*.snk`, `*.pfx` and `node_modules/` anywhere: the split left them ignored only in their toolchain folders (`dotnet/.gitignore`, the MCP package's `.gitignore`), so a key copied outside `dotnet/` could be committed to this public repository, and an `npm install` run outside the package folder would show thousands of untracked files. Build output stays in each toolchain folder's own `.gitignore`. -- 2026-11-17: by the maintainers' choice, PR 3 adds no `CODE_OF_CONDUCT.md`; `CODEOWNERS` keeps its single catch-all entry, because entries by path are equivalent while every path has the same owner; `.editorconfig` is the maintainers' standard one, based on the one of dotnet/runtime, instead of one with only the indentation style and the charset. It sets no analyzer severities, so the build output doesn't change, and the project doesn't set `EnforceCodeStyleInBuild`, so its code style rules show only in the editor. -- 2026-11-17: the releases stay drafts, because step 2 of the release guide edits the generated notes, which also list the other package's pull requests. The ADR-0002 flags are passed at creation anyway, and the guide's publish step sets them again and its Check verifies them, since GitHub doesn't document whether a draft keeps `make_latest` (Discoveries). Whether the API keeps `make_latest` on a draft is confirmed by the first release of each package. -- 2026-11-17: the CI workflows get the hardening of the release workflows (`contents: read`, actions pinned to full commit SHAs, no persisted git credentials) and a `push` trigger on `master` with the same paths, so that a break caused only by two pull requests merged one after the other, each tested on an older `master`, shows right after the merge, and the CI badge in `dotnet/README.md`, which shows the default branch, reflects `master` instead of the most recent pull request ([Adding a workflow status badge](https://docs.github.com/en/actions/how-tos/monitor-workflows/add-a-status-badge)). The trigger doesn't run for pushes to a pull request's branch, so each merge adds one run. Every workflow's `name:` is its file name without `.yml`, and the CI job ids are `dotnet-build-and-test` and `typescript-build-and-test`, because a check is named after its job and two jobs named `build-and-test` give two checks with the same name. -- 2026-11-17: ruleset recommendation, a Maintainer action after the merge: one tag ruleset targeting `*-v*`, `v*` and the legacy `DaxFormatter_MCP_v*`, because the legacy MCP tags mark published npm versions, and ADR-0002 names a pattern of their own as the way to cover them. Rules: "Restrict updates", "Restrict deletions", "Block force pushes"; not "Restrict creations", because GitHub doesn't document whether publishing a draft or the workflow's `GITHUB_TOKEN` would then need a bypass (Discoveries). -- 2026-11-17: no gate job in PR 4, because no check is known to be required. If the Maintainers make checks required, either they require none of the path-filtered workflows, GitHub's documented advice, or a gate job that always runs is added and is the only required check (Discoveries). A branch rule that already requires a check named `build-and-test` must name the new job ids instead, or merges wait for it forever. -- 2026-11-19: by the maintainers' choice, the release workflows no longer have the `dry_run` input of PR 1 (Decision log, 2026-11-16). Every check of a release runs before its first step that can't be undone, `dotnet nuget push` or `npm publish`: the branch guard, the version, the signing key, build, tests, pack, and the nuget.org sign-in, which checks the Trusted Publishing policy. A run that fails there publishes nothing, as a dry run did, and the version it would publish can be read beforehand with the commands of the release guide. What a dry run gave beyond that: checking the policy, the secrets and the npm package contents on a run that can't publish, before the first release after the move; now that first release checks them, and stops before the push if they fail. A dry run never called `gh release create`, so the step that can fail after publishing is checked by a real release either way. [ADR-0002](../decisions/0002-version-and-tag-each-package-independently.md) named a dry-run release under Confirmation; in [ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md), which supersedes it, the first release of each package confirms the tags and flags instead. -- 2026-11-19: by the maintainers' choice, the release workflows pass no `--notes-start-tag` and no longer look up the package's previous tag, which PR 4 had done with `git describe` on the package's new and legacy tag patterns. The lookup needed the tags fetched with the full history, a pattern per package that no other package's tags may match, and a special case for a package's first release, while the maintainer edits the generated notes in the draft before publishing anyway. GitHub then chooses where the notes start, which its documentation doesn't describe ([Automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes)), and step 2 of the release guide trims them to the package's changes since its previous release. The check that stopped a run whose version is already tagged goes with the lookup: such a run fails at `dotnet nuget push` or `npm publish`, before the GitHub release, as before PR 4. This departs from [ADR-0002](../decisions/0002-version-and-tag-each-package-independently.md), which passes `--notes-start-tag` with the package's previous tag, so [ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md) supersedes it. -- 2026-11-19: by the maintainers' choice, PR 4 brings the record in line with the release workflows. ADR-0002 is accepted, and an accepted record is not rewritten ([`decisions/README.md`](../decisions/README.md)), so ADR-0004 supersedes it and ADR-0002 changes only its status and date. ADR-0004 keeps ADR-0002's versions and tags, adds the legacy `DaxFormatter_MCP_v*` to the tag ruleset (Decision log, 2026-11-17), and replaces `--notes-start-tag` and the dry run with drafts whose notes the maintainer edits. ADR-0001 keeps its links to ADR-0002, since it is accepted too, and the proposed ADR-0003 is settled in PR 5. -- 2026-11-19: by the maintainers' choice, PR 4 removes the pull request template that PR 3 added. `CONTRIBUTING.md` keeps what it asked for: a Conventional Commits title, a plain-text description with `-` bullets, and the build, the tests and the documents of each change. From 55c4f0c6d03e550e47dd5623450111898cb2d2a0 Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Thu, 19 Nov 2026 14:25:03 +0100 Subject: [PATCH 07/18] docs: replace the release guide with the version commands - Delete docs/guides/release.md: the release workflows hold the steps, and ADR-0004 and the workflows hold the tags, titles and flags. - Add to dotnet/AGENTS.md and typescript/AGENTS.md the one-line command that prints the version a release would publish, noting that only an up-to-date master gives the release version. - Drop the links to the guide from the root AGENTS.md, dotnet/AGENTS.md, the architecture, CONTRIBUTING.md, docs/README.md and the backlog's MCP registry item. --- AGENTS.md | 6 ++-- CONTRIBUTING.md | 2 +- docs/README.md | 1 - docs/backlog.md | 2 +- docs/design/architecture.md | 2 +- docs/guides/release.md | 63 ------------------------------------- dotnet/AGENTS.md | 4 ++- typescript/AGENTS.md | 3 ++ 8 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 docs/guides/release.md diff --git a/AGENTS.md b/AGENTS.md index d592a35..0e6cf51 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,9 +23,9 @@ There is no build at the root: each language builds and tests from its own folde ## When you change X, update Y - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. -- A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`-ci.yml`, `-release-.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); update [`docs/guides/release.md`](docs/guides/release.md); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. -- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `-release-.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md); the release guide. -- How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md); a release step → [`docs/guides/release.md`](docs/guides/release.md). +- A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`-ci.yml`, `-release-.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. +- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `-release-.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). +- How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. - How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), which are maintained outside this repository; this repository only links them. - The `.snk` path in `dotnet/Directory.Build.props` → the path where `dotnet-release-dax-formatter.yml` writes the key from `SIGNING_KEY`, and the other way round: the build signs only when the file exists, so a mismatch builds an unsigned package without an error. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 340d4df..09b157f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,7 +58,7 @@ The tests replace `fetch` with a mock and run offline. Build and test with a cur ## Versions, tags and releases - Each package gets its version from Nerdbank.GitVersioning and its own `version.json` ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)): don't set versions in project files or in `package.json`. -- The maintainers release each package with its release workflow; the [release guide](docs/guides/release.md) gives the steps and the tags. +- The maintainers release each package with its release workflow. ## Reading history across the move diff --git a/docs/README.md b/docs/README.md index 8c85af1..7d26f19 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,4 +8,3 @@ Each fact has one home; other documents link to it. This folder is for maintaine | [`decisions/`](decisions/README.md) | Why: architectural decision records | | [`backlog.md`](backlog.md) | What comes next: next work, open decisions, known debt | | `plans/` | Large work in progress, one file per piece of work; open plans are linked from `backlog.md` | -| [`guides/`](guides/) | How to: release | diff --git a/docs/backlog.md b/docs/backlog.md index f5e0d3a..c1ee940 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -8,7 +8,7 @@ As of 2026-11-19: no plan open. ## Next - The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, and Node.js 20 reached end of life on 2026-04-30; the LTS majors on 2026-11-19 are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it; `CONTRIBUTING.md` needs no change, since it points to the major that `typescript-ci.yml` sets. What stays out: the `engines` field of `package.json`, a change to the published package that needs asking first. - npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. It depends on the Node.js LTS item above. -- MCP registry entry for the stdio server: AI clients that browse the registry find it there. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and the release guide says how to update the entry. +- MCP registry entry for the stdio server: AI clients that browse the registry find it there. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. ## Later - OpenAPI contract in `spec/`, with test vectors shared by all clients: one definition of the REST contract (see Known debt). diff --git a/docs/design/architecture.md b/docs/design/architecture.md index 955e678..f4f9f66 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -76,7 +76,7 @@ Formatting from an AI client through the stdio server: ## Versions and releases -Each package has its own version, tags and release workflow ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)). Nerdbank.GitVersioning (NBGV) computes the version from the package's `version.json`: the version height counts the commits that touch the file's path filters, and a build of `master` gets a version without the commit suffix. How to release is in the [release guide](../guides/release.md). +Each package has its own version, tags and release workflow ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)). Nerdbank.GitVersioning (NBGV) computes the version from the package's `version.json`: the version height counts the commits that touch the file's path filters, and a build of `master` gets a version without the commit suffix. | | `Dax.Formatter` | `@sqlbi/daxformatter-mcp` | |---|---|---| diff --git a/docs/guides/release.md b/docs/guides/release.md deleted file mode 100644 index 3169efe..0000000 --- a/docs/guides/release.md +++ /dev/null @@ -1,63 +0,0 @@ -# How to release a package - -Publish a new version of `Dax.Formatter` to nuget.org or of `@sqlbi/daxformatter-mcp` to npm. Each package releases on its own, from its own workflow ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)); how versions are computed is in the [architecture](../design/architecture.md#versions-and-releases). - -## Before you start - -- You can run workflows in this repository. -- The change to release is merged into `master`, the only branch a release runs from. -- The version is new. NBGV raises it with every commit under the package's path filter, so there is nothing to bump for a patch; to change the major, minor or prerelease part, change `version` in the package's `version.json` in a pull request. To see the version a release would publish, on an up-to-date `master`: - - .NET, from `dotnet/`: - ```bash - dotnet msbuild ./src/Dax.Formatter/Dax.Formatter.csproj -restore -target:GetBuildVersion -getProperty:NuGetPackageVersion - ``` - - MCP server, from `typescript/packages/daxformatter-mcp/`, after `npm ci`, with .NET on the `PATH`, which the nbgv CLI runs on: - ```bash - npx --no nbgv get-version --variable NpmPackageVersion - ``` -- Set up once by a maintainer: - - .NET: on nuget.org, a Trusted Publishing policy for this repository and the workflow file `dotnet-release-dax-formatter.yml`; the repository secrets `NUGET_USER`, the nuget.org user name (profile name, not the email address) that `NuGet/login` signs in with, and `SIGNING_KEY`, the strong-name key in base64. - - MCP server: the repository secret `NPM_TOKEN`, an npm token that can publish `@sqlbi/daxformatter-mcp`. - - Tags: one tag ruleset targeting `*-v*`, `v*` and `DaxFormatter_MCP_v*`, with "Restrict updates", "Restrict deletions" and "Block force pushes". Not "Restrict creations": GitHub doesn't document whether publishing a draft, or `gh release create` with the workflow's `GITHUB_TOKEN`, would then need a bypass. - -| Package | Workflow file | Tag | Release title | Release flags | -|---|---|---|---|---| -| `Dax.Formatter` | `dotnet-release-dax-formatter.yml` | `Dax.Formatter-v` | `DaxFormatter v` | `--latest` | -| `@sqlbi/daxformatter-mcp` | `typescript-release-daxformatter-mcp.yml` | `daxformatter-mcp-v` | the tag | `--prerelease --latest=false` | - -Actions shows each workflow under its file name without `.yml`. - -## Steps - -1. Run the package's release workflow from `master`: in GitHub, Actions, the workflow, "Run workflow", branch `master`. From a terminal with the GitHub CLI: - ```bash - gh workflow run dotnet-release-dax-formatter.yml --ref master - gh workflow run typescript-release-daxformatter-mcp.yml --ref master - ``` - The workflow: - - .NET: reads the version, writes the signing key from `SIGNING_KEY` and fails if it is missing, builds, runs the tests against the live service, packs, signs in to nuget.org, pushes `Dax.Formatter..nupkg`, and creates the GitHub release. - - MCP server: installs with `npm ci`, reads the version, builds, tests, writes the version into `package.json` with `nbgv-setversion`, runs `npm publish --provenance --access public`, and creates the GitHub release. - - Every check runs before the push to nuget.org or npm: a run that stops at a check publishes nothing, so fix the cause and run it again. - - The GitHub release is a draft with the tag, title and flags of the table, on the commit the workflow ran on, and notes that GitHub generates from the merged pull requests. -2. In GitHub, Releases, open the draft and edit its notes. GitHub chooses where they start, so they can begin at a release of the other package and include its pull requests: keep only this package's changes since its previous release, whose tag is in the form of the table or, before the first one, in the package's legacy form ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)). -3. Publish the draft. The workflow already set the flags, but GitHub doesn't document that a draft keeps them, so set them again: - - .NET: check "Set as the latest release". - - MCP server: check "Set as a pre-release" and leave "Set as the latest release" unchecked, so that "Latest" stays on the .NET client. - -## Check - -- The version is on [nuget.org](https://www.nuget.org/packages/Dax.Formatter) or [npm](https://www.npmjs.com/package/@sqlbi/daxformatter-mcp); `npm view @sqlbi/daxformatter-mcp version` prints it. nuget.org may take a few minutes to index a new version. -- `gh release list` shows the release, published with the tag of the table; the latest .NET release is "Latest", and the MCP releases are "Pre-release". If "Latest" is on another release, run `gh release edit Dax.Formatter-v --latest` with the latest .NET version; if an MCP release is not a pre-release, run `gh release edit daxformatter-mcp-v --prerelease`. - -## If something goes wrong - -- "Releases run only from refs/heads/master": run the workflow again with branch `master`. -- "The SIGNING_KEY secret is missing or empty": a maintainer sets the secret, then run again. -- The nuget.org sign-in fails: the Trusted Publishing policy must name `dotnet-release-dax-formatter.yml` and this repository. -- The MCP release fails at `npm ci` with an authentication error or one about `NODE_AUTH_TOKEN`: nothing is published yet. The `.npmrc` that setup-node writes reads the token from `NODE_AUTH_TOKEN`, which only the publish step sets, and since v7 setup-node no longer sets a placeholder, without which older Node.js and npm versions may fail ([README](https://github.com/actions/setup-node)). In a pull request, give the install step a placeholder `NODE_AUTH_TOKEN`, not the `NPM_TOKEN` secret, which the install scripts of the dependencies would see; then run again. -- `dotnet nuget push` or `npm publish` fails because the version exists: no commit has touched the package's path filter since the last release. Merge the change to release first. -- The package is published but the GitHub release is missing: create the draft by hand on the commit the workflow ran on, with the tag, title and flags of the table; then continue from step 2. If GitHub rejects `--latest` on a draft, run the command without it: step 3 sets it at publish. - ```bash - gh release create "" --title "" --target <commit> --generate-notes <flags> --draft - ``` -- A published version can't be replaced: on nuget.org it can only be unlisted. Fix the problem and release the next version. diff --git a/dotnet/AGENTS.md b/dotnet/AGENTS.md index 2e22618..fed1893 100644 --- a/dotnet/AGENTS.md +++ b/dotnet/AGENTS.md @@ -10,6 +10,8 @@ Run from `dotnet/`, never from the repository root ([why](../CONTRIBUTING.md#net dotnet build ./Dax.Formatter.sln --configuration Release dotnet test ./tests/Dax.Formatter.Tests/Dax.Formatter.Tests.csproj --configuration Release dotnet pack ./src/Dax.Formatter/Dax.Formatter.csproj --configuration Release +# the version a release would publish, when run on an up-to-date master; elsewhere it has a commit suffix +dotnet msbuild ./src/Dax.Formatter/Dax.Formatter.csproj -restore -target:GetBuildVersion -getProperty:NuGetPackageVersion # the sample, against the package on nuget.org and without the build settings of dotnet/ dotnet build ./samples/GettingStarted/getting-started.sln ``` @@ -30,7 +32,7 @@ dotnet build ./samples/GettingStarted/getting-started.sln ## When you change X, update Y -- `version.json` → read the [NBGV caveat](../docs/design/architecture.md#versions-and-releases) first; after the change, check with the version command of the [release guide](../docs/guides/release.md#before-you-start) that a commit under `src/Dax.Formatter` still raises the version. +- `version.json` → read the [NBGV caveat](../docs/design/architecture.md#versions-and-releases) first; after the change, check with the version command above that a commit under `src/Dax.Formatter` still raises the version. - The public API or the behavior of the client → `README.md` in this folder, the NuGet package readme, written for package users and packed into the package. - A new project → `src/`, `tests/` or `samples/` ([ADR-0001](../docs/decisions/0001-organize-the-repository-by-language.md), [ADR-0003](../docs/decisions/0003-keep-one-net-solution-with-role-folders.md)); libraries and tests go into `Dax.Formatter.sln`. A new test project also goes into the test step of `dotnet-ci.yml` and of the release workflow, which name the test project they run. diff --git a/typescript/AGENTS.md b/typescript/AGENTS.md index 8c23263..743792e 100644 --- a/typescript/AGENTS.md +++ b/typescript/AGENTS.md @@ -13,6 +13,9 @@ npm run typecheck npm run build npm test npm pack --dry-run +# the version a release would publish, when run on an up-to-date master; elsewhere it has a commit suffix +# (the nbgv CLI runs on .NET, which must be on the PATH) +npx --no nbgv get-version --variable NpmPackageVersion ``` ## Done means From eab714028be5c8239fd86aaf81bff4803742f873 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:25:24 +0100 Subject: [PATCH 08/18] docs: move the documentation map into AGENTS.md - Delete docs/README.md and give the root AGENTS.md a Documentation section with one line per home in use, design, decisions and backlog, saying when to read it: agents load AGENTS.md in every session, so docs/ needs no index of its own. - Point the root AGENTS.md and CONTRIBUTING.md to that section, and the contributors line of README.md to CONTRIBUTING.md. --- AGENTS.md | 10 ++++++++-- CONTRIBUTING.md | 2 +- README.md | 2 +- docs/README.md | 10 ---------- 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 docs/README.md diff --git a/AGENTS.md b/AGENTS.md index 0e6cf51..b0e5bcb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # AGENTS.md -Client packages for the DAX Formatter service, organized by language: the .NET client library `Dax.Formatter` (NuGet) in `dotnet/`, and the MCP server `@sqlbi/daxformatter-mcp` (npm), which carries its own TypeScript port of the client, in `typescript/packages/daxformatter-mcp/`. The service, its REST API and its remote MCP server are maintained outside this repository. Documentation map: [`docs/README.md`](docs/README.md). +Client packages for the DAX Formatter service, organized by language: the .NET client library `Dax.Formatter` (NuGet) in `dotnet/`, and the MCP server `@sqlbi/daxformatter-mcp` (npm), which carries its own TypeScript port of the client, in `typescript/packages/daxformatter-mcp/`. The service, its REST API and its remote MCP server are maintained outside this repository. ## Commands @@ -15,7 +15,7 @@ There is no build at the root: each language builds and tests from its own folde ## Boundaries -- Always: work on a branch, never on `master`; one logical change per commit; keep each fact in one home and link to it ([`docs/README.md`](docs/README.md)). +- Always: work on a branch, never on `master`; one logical change per commit; keep each fact in one home ([Documentation](#documentation)) and link to it. - Ask first: changes to `.github/workflows/`, `.github/dependabot.yml` or `.github/CODEOWNERS`; any `version.json`; package ids, tags or release conventions; the wire format of a request or response; a new dependency. - Never: commit secrets, tokens or signing keys; rewrite published history (force-push `master`, move or delete tags); run a release workflow without being asked. - Never, because this repository is public: name private repositories, internal hosts, cloud resources, private package feeds or secret values in any file, commit message or pull request. @@ -37,3 +37,9 @@ There is no build at the root: each language builds and tests from its own folde - Commits and pull requests follow [`CONTRIBUTING.md`](CONTRIBUTING.md#commits-and-pull-requests). - Workflows follow GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use): actions pinned to a full commit SHA with the version in a comment on the same line, which [Dependabot updates](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#github-actions) with the SHA; `permissions: contents: read` at the top, and write permissions only on the job that needs them; expressions passed to scripts through `env`, never written into `run`. Every checkout also sets `persist-credentials: false`. - Documents are in plain English, describe the present, and link within the repository with relative links. Package READMEs are written for their registry, with only what a package user needs: the npm README uses absolute URLs only. + +## Documentation + +- [`docs/design/`](docs/design/README.md): how the packages work, call the service, version and release. Read before changing a package's boundaries, the REST contract, a `version.json` or a workflow. +- [`docs/decisions/`](docs/decisions/README.md): why it is so, one record per decision. Read the titles before proposing a design choice. +- [`docs/backlog.md`](docs/backlog.md): what comes next, open decisions and known debt. Read before picking up work. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09b157f..e80bf4e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ The repository is organized by language ([ADR-0001](docs/decisions/0001-organize - `dotnet/`: the .NET client library `Dax.Formatter`, its tests and samples ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)). - `typescript/packages/daxformatter-mcp/`: the MCP server `@sqlbi/daxformatter-mcp`, with its own TypeScript port of the client. -- `docs/`: documentation for contributors and maintainers; [`docs/README.md`](docs/README.md) says where each kind of fact lives. The user documentation is on [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). +- `docs/`: documentation for contributors and maintainers; [`AGENTS.md`](AGENTS.md#documentation) says where each kind of fact lives. The user documentation is on [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). ## Build and test diff --git a/README.md b/README.md index b7e81cb..b9b0b50 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The service also hosts a remote MCP server, which needs nothing installed. - User documentation: [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). - Connecting an AI client: to the [remote MCP server](https://docs.sqlbi.com/dax-formatter/mcp-http) or to the [stdio MCP server](https://docs.sqlbi.com/dax-formatter/mcp-stdio). -- For contributors and maintainers: [`docs/`](docs/README.md). +- For contributors and maintainers: [`CONTRIBUTING.md`](CONTRIBUTING.md). ## Support diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 7d26f19..0000000 --- a/docs/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Documentation - -Each fact has one home; other documents link to it. This folder is for maintainers and contributors; the user documentation is on [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). - -| Where | What lives there | -|---|---| -| [`design/`](design/README.md) | How the system works today | -| [`decisions/`](decisions/README.md) | Why: architectural decision records | -| [`backlog.md`](backlog.md) | What comes next: next work, open decisions, known debt | -| `plans/` | Large work in progress, one file per piece of work; open plans are linked from `backlog.md` | From db3421b0844c93313a6dff8a6a95021fad0311d0 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:25:59 +0100 Subject: [PATCH 09/18] docs(agents): rule out plans and tighten the root AGENTS.md - Add the boundary "Never: add docs/plans/": the state of work in progress stays outside this repository, so drop the rule that kept a plan's Progress current. - Tighten the wording of the workflow, AI client and secure-use rules without dropping any of them; the sections already follow the template order, with no Pitfalls at the root. --- AGENTS.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b0e5bcb..6293556 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ Client packages for the DAX Formatter service, organized by language: the .NET c ## Commands -There is no build at the root: each language builds and tests from its own folder, with the commands and rules in [`dotnet/AGENTS.md`](dotnet/AGENTS.md) and [`typescript/AGENTS.md`](typescript/AGENTS.md). +There is no build at the root: each language folder builds and tests on its own, with the commands and rules in [`dotnet/AGENTS.md`](dotnet/AGENTS.md) and [`typescript/AGENTS.md`](typescript/AGENTS.md). ## Done means @@ -18,24 +18,25 @@ There is no build at the root: each language builds and tests from its own folde - Always: work on a branch, never on `master`; one logical change per commit; keep each fact in one home ([Documentation](#documentation)) and link to it. - Ask first: changes to `.github/workflows/`, `.github/dependabot.yml` or `.github/CODEOWNERS`; any `version.json`; package ids, tags or release conventions; the wire format of a request or response; a new dependency. - Never: commit secrets, tokens or signing keys; rewrite published history (force-push `master`, move or delete tags); run a release workflow without being asked. +- Never: add `docs/plans/`; the state of work in progress stays outside this repository. - Never, because this repository is public: name private repositories, internal hosts, cloud resources, private package feeds or secret values in any file, commit message or pull request. ## When you change X, update Y - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. -- A workflow file renamed or added → follow the naming rule of [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`<language>-ci.yml`, `<language>-release-<package>.yml`), with a `name:` equal to the file name without `.yml`, and CI job ids prefixed with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. -- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `<language>-release-<package>.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of the root `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). +- A workflow file renamed or added → its file name follows [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`<language>-ci.yml`, `<language>-release-<package>.yml`), its `name:` is the file name without `.yml`, and its CI job ids start with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. +- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `<language>-release-<package>.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. -- How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), which are maintained outside this repository; this repository only links them. +- How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), maintained outside this repository, which only links them. - The `.snk` path in `dotnet/Directory.Build.props` → the path where `dotnet-release-dax-formatter.yml` writes the key from `SIGNING_KEY`, and the other way round: the build signs only when the file exists, so a mismatch builds an unsigned package without an error. -- Work planned, open decisions, known debt → [`docs/backlog.md`](docs/backlog.md); a large piece of work in progress → its plan in `docs/plans/`, with its Progress updated in every pull request. +- Work planned, open decisions, known debt → [`docs/backlog.md`](docs/backlog.md). ## Conventions - Accepted records in [`docs/decisions/`](docs/decisions/README.md) are binding: when a change contradicts one, stop and ask. Proposed records are context. - Commits and pull requests follow [`CONTRIBUTING.md`](CONTRIBUTING.md#commits-and-pull-requests). -- Workflows follow GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use): actions pinned to a full commit SHA with the version in a comment on the same line, which [Dependabot updates](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#github-actions) with the SHA; `permissions: contents: read` at the top, and write permissions only on the job that needs them; expressions passed to scripts through `env`, never written into `run`. Every checkout also sets `persist-credentials: false`. +- Workflows follow GitHub's [secure use reference](https://docs.github.com/en/actions/reference/security/secure-use): actions pinned to a full commit SHA with the version in a comment on the same line, which [Dependabot updates](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#github-actions) with the SHA; `permissions: contents: read` at the top, and write permissions only on the job that needs them; expressions passed to scripts through `env`, never written into `run`; `persist-credentials: false` on every checkout. - Documents are in plain English, describe the present, and link within the repository with relative links. Package READMEs are written for their registry, with only what a package user needs: the npm README uses absolute URLs only. ## Documentation From 996dd526efcb9d96712758ddfbf06af8b95eaf76 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:26:50 +0100 Subject: [PATCH 10/18] docs(agents): move build notes and the NBGV rule to language folders - dotnet/AGENTS.md takes from CONTRIBUTING.md why the commands run from dotnet/, that net472 tests run only on Windows, and that local builds are not strong-named, stated once with the condition in Directory.Build.props. - The .snk path rule moves from the root AGENTS.md to dotnet/AGENTS.md and refers to that condition instead of restating it. - The NBGV rule on dotnet/version.json becomes a Pitfall of dotnet/AGENTS.md, without the versions tried, and leaves the architecture, so it has one home; the version.json update rule points to it. - typescript/AGENTS.md names the Node.js major of typescript-ci.yml and why, instead of linking CONTRIBUTING.md. - CONTRIBUTING.md keeps one line on build and test that links both files. - ADR-0003 links the NBGV caveat through a permalink to the architecture that held it, a link fix its README allows. --- AGENTS.md | 1 - CONTRIBUTING.md | 29 +------------------ ...keep-one-net-solution-with-role-folders.md | 2 +- docs/design/architecture.md | 2 -- dotnet/AGENTS.md | 14 +++++++-- typescript/AGENTS.md | 2 +- 6 files changed, 14 insertions(+), 36 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 6293556..649e9a0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,6 @@ There is no build at the root: each language folder builds and tests on its own, - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. - How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), maintained outside this repository, which only links them. -- The `.snk` path in `dotnet/Directory.Build.props` → the path where `dotnet-release-dax-formatter.yml` writes the key from `SIGNING_KEY`, and the other way round: the build signs only when the file exists, so a mismatch builds an unsigned package without an error. - Work planned, open decisions, known debt → [`docs/backlog.md`](docs/backlog.md). ## Conventions diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e80bf4e..2e92ef6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,34 +18,7 @@ The repository is organized by language ([ADR-0001](docs/decisions/0001-organize ## Build and test -### .NET - -Run the commands from `dotnet/`: the `dotnet` CLI looks for `global.json` from the current folder upward, so only there does it use the SDK that `dotnet/global.json` pins. - -```bash -cd dotnet -dotnet build -dotnet test -dotnet pack -``` - -- The tests call the live DAX Formatter service: they need network access, and they fail when the service is unreachable. -- The test project also targets .NET Framework 4.7.2, which runs only on Windows, where CI runs; on other systems, run `dotnet test --framework net10.0`. -- Local builds are not strong-named: the signing key exists only in the release workflow. - -### TypeScript - -Run the commands from the package folder; each npm package has its own lockfile. - -```bash -cd typescript/packages/daxformatter-mcp -npm ci -npm run typecheck -npm run build -npm test -``` - -The tests replace `fetch` with a mock and run offline. Build and test with a current release of the Node.js major version that `.github/workflows/typescript-ci.yml` sets: the build and test tools need a newer Node.js than the published package, which supports the versions in the `engines` field of `package.json`. +Each language folder builds and tests on its own: the commands and their requirements are in [`dotnet/AGENTS.md`](dotnet/AGENTS.md) and [`typescript/AGENTS.md`](typescript/AGENTS.md). ## Commits and pull requests diff --git a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md index 71bd482..3e78492 100644 --- a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md +++ b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md @@ -23,7 +23,7 @@ Chosen option: "One solution with role folders", because one package, its tests - `Dax.Formatter.sln` holds the libraries under `src/` and the test projects under `tests/`; `Directory.Build.props` in `dotnet/` applies to both. - Samples under `samples/` show how users consume a published package: each has its own solution, references the package from nuget.org, and inherits no build settings from `dotnet/`. - A second NuGet package adds its project under `src/` and its tests under `tests/`, in the same solution, and a release workflow of its own, `dotnet-release-<package>.yml` ([ADR-0001](0001-organize-the-repository-by-language.md)). -- A second NuGet package puts its own `version.json` in its project folder, `src/<Package>/version.json`, with path filters that cover that folder and whatever it builds from. NBGV uses the `version.json` in the project's folder or its nearest ancestor, and its documentation shows a secondary `version.json` in a project folder ([`version.json`](https://dotnet.github.io/Nerdbank.GitVersioning/docs/versionJson.html)). `dotnet/version.json` stays the version file of `Dax.Formatter`: its path filter names `src/Dax.Formatter`, and moving it has an NBGV caveat ([architecture](../design/architecture.md#versions-and-releases)). Checked on a scratch repository with the nbgv CLI 3.7.112: a project under a folder with its own `version.json` gets that file's version and height, and commits there don't raise the version of a project under `dotnet/version.json`. +- A second NuGet package puts its own `version.json` in its project folder, `src/<Package>/version.json`, with path filters that cover that folder and whatever it builds from. NBGV uses the `version.json` in the project's folder or its nearest ancestor, and its documentation shows a secondary `version.json` in a project folder ([`version.json`](https://dotnet.github.io/Nerdbank.GitVersioning/docs/versionJson.html)). `dotnet/version.json` stays the version file of `Dax.Formatter`: its path filter names `src/Dax.Formatter`, and moving it has an NBGV caveat ([architecture](https://github.com/sql-bi/DaxFormatter/blob/4928eacfedfcd2be7a0f7807162b505f8242af11/docs/design/architecture.md#versions-and-releases)). Checked on a scratch repository with the nbgv CLI 3.7.112: a project under a folder with its own `version.json` gets that file's version and height, and commits there don't raise the version of a project under `dotnet/version.json`. ### Consequences diff --git a/docs/design/architecture.md b/docs/design/architecture.md index f4f9f66..4e6b98f 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -87,8 +87,6 @@ Each package has its own version, tags and release workflow ([ADR-0004](../decis Both release workflows read the version from the same NBGV copy that stamps the package, run only from `master`, and create a draft GitHub release. Two NBGV versions can compute different heights for the same commit: on a simulated move of [ADR-0001](../decisions/0001-organize-the-repository-by-language.md), the nbgv CLI 3.10.94 counted the rename commit and the `Nerdbank.GitVersioning` 3.9.50 MSBuild task didn't. Reading the version from another copy, such as the nbgv GitHub action, which installs the latest stable nbgv CLI by default, could push or tag a version other than the packed one. -`dotnet/version.json` must never have the same content as the root `version.json` of the commits before the move ([ADR-0001](../decisions/0001-organize-the-repository-by-language.md)), whose path filter was `src/Dax.Formatter`. While the two files are identical, NBGV resolves the relative path filter from the old root location, so commits under `dotnet/src/Dax.Formatter` don't raise the version height and the computed version is 1.2.2, already published on nuget.org (seen with the nbgv CLI 3.7.112, 3.9.50 and 3.10.94 and the `Nerdbank.GitVersioning` 3.9.50 MSBuild task). Once the content differs, the filter resolves under `dotnet/` and the height continues from the 1.2 history. Hence the filter is written `./src/Dax.Formatter`: written as `src/Dax.Formatter`, it would make the files identical again. - ## Continuous integration Each CI workflow runs on pull requests and pushes to `master` that change its language folder or its own workflow file, and can also be run by hand. Its job id starts with the language, `dotnet-build-and-test` and `typescript-build-and-test`, so each check, named after its job, is unique across workflows. diff --git a/dotnet/AGENTS.md b/dotnet/AGENTS.md index fed1893..3f775cd 100644 --- a/dotnet/AGENTS.md +++ b/dotnet/AGENTS.md @@ -4,7 +4,7 @@ The .NET client library `Dax.Formatter`, published on NuGet, with its tests and ## Commands -Run from `dotnet/`, never from the repository root ([why](../CONTRIBUTING.md#net)). +Run from `dotnet/`, never from the repository root: the `dotnet` CLI looks for `global.json` from the current folder upward, so only there does it use the SDK that `dotnet/global.json` pins. ```bash dotnet build ./Dax.Formatter.sln --configuration Release @@ -16,6 +16,9 @@ dotnet msbuild ./src/Dax.Formatter/Dax.Formatter.csproj -restore -target:GetBuil dotnet build ./samples/GettingStarted/getting-started.sln ``` +- The test project also targets `net472`, which runs only on Windows; elsewhere, add `--framework net10.0` to `dotnet test`. +- Local builds are not strong-named: the build signs only when `src/Dax.Formatter/DaxFormatter.snk` exists (`Directory.Build.props`), and only `dotnet-release-dax-formatter.yml` writes it, from the `SIGNING_KEY` secret. + ## Done means - Build, tests and pack succeed from `dotnet/`, with no new warnings. @@ -25,17 +28,22 @@ dotnet build ./samples/GettingStarted/getting-started.sln - Ask first: changes to `Directory.Build.props`, package references, target frameworks, or the public API of `Dax.Formatter`, which is a published package. - Never: edit `global.json` or `nuget.config` to make a build pass. -- Never: commit `src/Dax.Formatter/DaxFormatter.snk`, the strong-name key that the release workflow writes from a secret; `.gitignore` ignores it. +- Never: commit the strong-name key `src/Dax.Formatter/DaxFormatter.snk`; `.gitignore` ignores it. - Never: delete `samples/Directory.Build.props` or `samples/Directory.Build.targets`. They contain only `<Project />`, so the samples don't inherit the build settings of `dotnet/`; an empty file fails with MSB4024. - Never: run `dotnet format`, lower `AnalysisMode` or `AnalysisLevel`, or add a broad `NoWarn` to get a clean build. - Always: follow the root `.editorconfig` (C# style, indentation, encoding) in the lines you change; don't reformat the rest of a file. ## When you change X, update Y -- `version.json` → read the [NBGV caveat](../docs/design/architecture.md#versions-and-releases) first; after the change, check with the version command above that a commit under `src/Dax.Formatter` still raises the version. +- `version.json` → read the [pitfall](#pitfalls) below first; after the change, check with the version command above that a commit under `src/Dax.Formatter` still raises the version. +- The `.snk` path in `Directory.Build.props` → the path where `dotnet-release-dax-formatter.yml` writes the key, and the other way round: a mismatch builds an unsigned package without an error. - The public API or the behavior of the client → `README.md` in this folder, the NuGet package readme, written for package users and packed into the package. - A new project → `src/`, `tests/` or `samples/` ([ADR-0001](../docs/decisions/0001-organize-the-repository-by-language.md), [ADR-0003](../docs/decisions/0003-keep-one-net-solution-with-role-folders.md)); libraries and tests go into `Dax.Formatter.sln`. A new test project also goes into the test step of `dotnet-ci.yml` and of the release workflow, which name the test project they run. +## Pitfalls + +- `version.json` must never have the same content as `git show 6df1bf0^:version.json`, the root `version.json` before the move to `dotnet/`, whose path filter is `src/Dax.Formatter`. While the two are identical, NBGV resolves the path filter from the old root: commits under `dotnet/src/Dax.Formatter` don't raise the version, and the computed version is one already published on nuget.org. The two differ only in how the filter is written, so it stays `./src/Dax.Formatter`. + ## Conventions - A new test that doesn't need the service doesn't call it. diff --git a/typescript/AGENTS.md b/typescript/AGENTS.md index 743792e..8ec958a 100644 --- a/typescript/AGENTS.md +++ b/typescript/AGENTS.md @@ -20,7 +20,7 @@ npx --no nbgv get-version --variable NpmPackageVersion ## Done means -- `npm run typecheck`, `npm run build` and `npm test` pass, on the Node.js version that [`CONTRIBUTING.md`](../CONTRIBUTING.md#typescript) names; the code keeps working on the versions in `engines`. +- `npm run typecheck`, `npm run build` and `npm test` pass on a current release of the Node.js major that `.github/workflows/typescript-ci.yml` sets: the build and test tools need a newer Node.js than the published package, which keeps working on the versions in `engines`. - `npm pack --dry-run` still lists only `dist/**`, `README.md` and `package.json`. ## Boundaries From 46a18466178865069de2bfd5655de4ee23b1f01d Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:27:40 +0100 Subject: [PATCH 11/18] docs(design): keep only what the code doesn't show in the architecture - Follow the sections of the design template: Context, Building blocks, Cross-cutting rules, Deployment; drop Key flows, which the code shows, and both Mermaid diagrams. - Turn the version table into one bullet per package with its version file, path filter, stamping, release workflow and registry, and merge Versions and releases with Continuous integration into Deployment. - Keep why the release workflows read the version from the NBGV copy that stamps the package, and why a path-filtered check can't be required, without the versions tried on a simulated move. - Say in docs/design/README.md when to read each document, and point the root and typescript AGENTS.md to the Deployment section. --- AGENTS.md | 2 +- docs/design/README.md | 4 +- docs/design/architecture.md | 90 ++++++------------------------------- typescript/AGENTS.md | 2 +- 4 files changed, 17 insertions(+), 81 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 649e9a0..9175b4f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,7 @@ There is no build at the root: each language folder builds and tests on its own, ## When you change X, update Y - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. -- A workflow file renamed or added → its file name follows [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`<language>-ci.yml`, `<language>-release-<package>.yml`), its `name:` is the file name without `.yml`, and its CI job ids start with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#continuous-integration)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. +- A workflow file renamed or added → its file name follows [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`<language>-ci.yml`, `<language>-release-<package>.yml`), its `name:` is the file name without `.yml`, and its CI job ids start with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#deployment)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. - A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `<language>-release-<package>.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. diff --git a/docs/design/README.md b/docs/design/README.md index c4c86c8..9bf0ba9 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -2,5 +2,5 @@ How the system works today. A design document changes in the same pull request as what it describes. -- [`architecture.md`](architecture.md): the packages, the service they call, and how each package is versioned and released. -- [`rest-api.md`](rest-api.md): the REST contract of the DAX Formatter service, as the clients use it. +- [`architecture.md`](architecture.md): the packages, the service they call, the rules they share, and how each is versioned, released and built by CI. Read before changing a package's boundaries, a `version.json` or a workflow. +- [`rest-api.md`](rest-api.md): the REST contract of the DAX Formatter service, as the clients use it. Read before changing a request, a response or how a client calls the service. diff --git a/docs/design/architecture.md b/docs/design/architecture.md index 4e6b98f..b319065 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -2,93 +2,29 @@ ## Context -DAX Formatter is a service that formats DAX expressions and reports their syntax errors. This repository holds two client packages that call it: a .NET client library that applications embed, and an MCP server that AI clients start on the user's machine. The service, its REST API and its remote MCP server are maintained outside this repository and are treated here as an external system, known only through its public endpoints ([REST API](rest-api.md)). - -```mermaid -flowchart LR - app[".NET application"] - ai["AI client<br/>(VS Code, Claude, Codex, ...)"] - - subgraph repo["This repository"] - lib["Dax.Formatter<br/>.NET client library, on NuGet"] - mcp["@sqlbi/daxformatter-mcp<br/>stdio MCP server, on npm"] - end - - subgraph ext["DAX Formatter service (external)"] - api["REST API<br/>api.daxformatter.com"] - remote["Remote MCP server"] - end - - app -- "calls in process" --> lib - ai -- "starts it, MCP over stdio" --> mcp - ai -.->|MCP over HTTP| remote - lib -- "HTTPS, JSON" --> api - mcp -- "HTTPS, JSON" --> api -``` - -- A .NET developer adds `Dax.Formatter` to an application, which formats DAX through the REST API. -- A user of an AI client adds the stdio MCP server, which the client starts with `npx` and which formats DAX through the same REST API. -- The same user can instead connect the AI client to the remote MCP server hosted by the service, with nothing to run locally. How to connect each client to either server is documented only on SQLBI Docs: [remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio). +DAX Formatter is a service that formats DAX expressions and reports their syntax errors. This repository holds two clients of its REST API ([`rest-api.md`](rest-api.md)): a .NET client library that applications embed, and a stdio MCP server that AI clients start on the user's machine with `npx`. The service, its REST API and its remote MCP server are maintained outside this repository; how to connect an AI client to either MCP server is documented only on SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)). ## Building blocks Each package lives in its language folder and builds with its own toolchain ([ADR-0001](../decisions/0001-organize-the-repository-by-language.md)). -```mermaid -flowchart TB - subgraph dotnet["dotnet/: inside the .NET application's process"] - client["DaxFormatterClient<br/>public API"] --> models["Request models<br/>hashing, JSON serialization"] - client --> http["DaxFormatterHttpClient<br/>one HttpClient per client instance"] - end - - subgraph ts["typescript/packages/daxformatter-mcp/: a Node.js process started by the AI client"] - server["MCP server<br/>tool format_dax"] --> port["TypeScript port of the client<br/>src/daxformatter"] - end - - http -- "POST daxtextformat, daxtextformatmulti" --> api["DAX Formatter REST API (external)"] - port -- "POST daxtextformatmulti" --> api -``` - -- `Dax.Formatter` targets `netstandard2.0`, `net8.0` and `net10.0`. `DaxFormatterClient` formats one expression or many in one call; each instance keeps one `HttpClient` for its lifetime, so reusing an instance reuses its connections. One solution holds the library and its tests; samples build against the published package ([ADR-0003](../decisions/0003-keep-one-net-solution-with-role-folders.md)). -- `@sqlbi/daxformatter-mcp` is an MCP server over stdio, built on the MCP TypeScript SDK, with one read-only tool, `format_dax`, whose input and output are validated with zod. It carries its own TypeScript port of the client, which is not published on its own (see the [backlog](../backlog.md)). +- `Dax.Formatter`, in `dotnet/`: `DaxFormatterClient` formats one expression or many in one call; each instance keeps one `HttpClient` for its lifetime, so reusing an instance reuses its connections. One solution holds the library and its tests; samples build against the published package ([ADR-0003](../decisions/0003-keep-one-net-solution-with-role-folders.md)). +- `@sqlbi/daxformatter-mcp`, in `typescript/packages/daxformatter-mcp/`: one read-only tool, `format_dax`, which sends every expression in one request to the multiple endpoint, through the package's own TypeScript port of the client in `src/daxformatter/`, not published on its own. - The REST contract is implemented twice, once per client; [`rest-api.md`](rest-api.md) is its only description, and the [backlog](../backlog.md#known-debt) records where the two implementations differ. -## Key flows - -Formatting from a .NET application: +## Cross-cutting rules -1. The application creates a `DaxFormatterClient`, which sets the [caller identity](rest-api.md#caller-identity) of every request. -2. It calls `FormatAsync` with one expression, a list, or a request object that also carries formatting options and the model's metadata. -3. The client posts the request as JSON to the single or the multiple endpoint and deserializes the result. - -Formatting from an AI client through the stdio server: - -1. The AI client starts `npx -y @sqlbi/daxformatter-mcp` and initializes the MCP session, which tells the server the client's name and version. -2. The model calls `format_dax` with every expression in one array. -3. The server sends one request to the multiple endpoint, with a caller identity that includes the client's name and version, and returns one result per expression, as structured content and as text. - -## Cross-cutting concerns - -- Privacy: the DAX text goes to the service, where the formatting happens. Server and database names are hashed by the client before they leave it ([hashing](rest-api.md#hashing-of-server-and-database-names)). -- Caller identity: each request names the calling application and its version, for usage statistics ([caller identity](rest-api.md#caller-identity)). +- Privacy: the DAX text goes to the service, where the formatting happens; server and database names are hashed by the client before they leave it ([hashing](rest-api.md#hashing-of-server-and-database-names)). +- Caller identity: each request names the calling application and its version, for usage statistics; the MCP server adds the AI client's name and version ([caller identity](rest-api.md#caller-identity)). - Errors: DAX syntax errors are normal results; only transport failures, timeouts and non-success HTTP statuses are errors ([errors](rest-api.md#errors)). - Tests: the .NET tests call the live service, while the MCP tests replace `fetch` and run offline ([backlog](../backlog.md#known-debt)). -## Versions and releases - -Each package has its own version, tags and release workflow ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)). Nerdbank.GitVersioning (NBGV) computes the version from the package's `version.json`: the version height counts the commits that touch the file's path filters, and a build of `master` gets a version without the commit suffix. - -| | `Dax.Formatter` | `@sqlbi/daxformatter-mcp` | -|---|---|---| -| Version file | `dotnet/version.json`, path filter `./src/Dax.Formatter` | `typescript/packages/daxformatter-mcp/version.json`, path filter `.`: any change in the package folder, its README included, raises the version | -| Stamped by | the `Nerdbank.GitVersioning` MSBuild package, referenced by `dotnet/Directory.Build.props` | the `nerdbank-gitversioning` npm package: `nbgv-setversion` writes the version into `package.json` at release; the committed `package.json` holds a placeholder | -| CI | `dotnet-ci.yml` | `typescript-ci.yml` | -| Release | `dotnet-release-dax-formatter.yml`, to nuget.org with Trusted Publishing; the assembly is strong-named with a key that the workflow writes from a secret | `typescript-release-daxformatter-mcp.yml`, to npm with provenance | - -Both release workflows read the version from the same NBGV copy that stamps the package, run only from `master`, and create a draft GitHub release. Two NBGV versions can compute different heights for the same commit: on a simulated move of [ADR-0001](../decisions/0001-organize-the-repository-by-language.md), the nbgv CLI 3.10.94 counted the rename commit and the `Nerdbank.GitVersioning` 3.9.50 MSBuild task didn't. Reading the version from another copy, such as the nbgv GitHub action, which installs the latest stable nbgv CLI by default, could push or tag a version other than the packed one. - -## Continuous integration +## Deployment -Each CI workflow runs on pull requests and pushes to `master` that change its language folder or its own workflow file, and can also be run by hand. Its job id starts with the language, `dotnet-build-and-test` and `typescript-build-and-test`, so each check, named after its job, is unique across workflows. +Each package has its own version, tags and release workflow ([ADR-0004](../decisions/0004-version-tag-and-release-each-package-independently.md)). Nerdbank.GitVersioning (NBGV) computes the version from the package's `version.json`: the height counts the commits that touch its path filters, and only `master` gets a version without a commit suffix. -A required check of a workflow that its path filter skips stays pending and blocks merging, and GitHub advises against requiring workflows that can be skipped ([Troubleshooting required status checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks)). A check can be required only if its job runs on every pull request: for example, one workflow without path filters, whose build jobs are skipped by job conditions when their folder hasn't changed, since a job skipped by a condition reports success, and a gate job that needs them as the only required check. That page documents these pieces, not the whole pattern. +- `Dax.Formatter`: `dotnet/version.json`, path filter `./src/Dax.Formatter`; stamped by the `Nerdbank.GitVersioning` MSBuild package that `dotnet/Directory.Build.props` references; released by `dotnet-release-dax-formatter.yml` to nuget.org, with Trusted Publishing. +- `@sqlbi/daxformatter-mcp`: `typescript/packages/daxformatter-mcp/version.json`, path filter `.`, so any change in the package folder, its README included, raises the version; stamped by the `nerdbank-gitversioning` npm package, whose `nbgv-setversion` writes the version into `package.json` at release over the committed placeholder; released by `typescript-release-daxformatter-mcp.yml` to npm, with provenance. +- Both release workflows read the version from the same NBGV copy that stamps the package: two NBGV versions can compute different heights for the same commit, so another copy could tag or push a version other than the packed one. They run only from `master` and create a draft GitHub release. +- `dotnet-ci.yml` and `typescript-ci.yml` run on pull requests and pushes to `master` that change their language folder or their own file, and by hand. Their job ids start with the language, so each check, named after its job, is unique across workflows. +- A required check that a path filter skips stays pending and blocks merging ([Troubleshooting required status checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks)), so neither CI check can be required: a required check needs a job that runs on every pull request, such as a gate job in a workflow without path filters. diff --git a/typescript/AGENTS.md b/typescript/AGENTS.md index 8ec958a..6d42339 100644 --- a/typescript/AGENTS.md +++ b/typescript/AGENTS.md @@ -32,5 +32,5 @@ npx --no nbgv get-version --variable NpmPackageVersion ## When you change X, update Y -- The package README → the root rules on package READMEs and on AI client setup apply; like any change in the package folder, it raises the package's version ([architecture](../docs/design/architecture.md#versions-and-releases)). +- The package README → the root rules on package READMEs and on AI client setup apply; like any change in the package folder, it raises the package's version ([architecture](../docs/design/architecture.md#deployment)). - A second npm package → its own folder under `packages/`, then the root rule for a new package; npm workspaces rooted at `typescript/` are a backlog item. From cedc67b7a163b4ad5401ad5ed18317c3319a4159 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:28:19 +0100 Subject: [PATCH 12/18] docs(backlog): shorten the items and drop Now - Drop the Now section: nothing is in progress, and plans no longer live in this repository. - Keep every item, each cut to its outcome, why and done-when, or for known debt to what, cost and repay; the .editorconfig item names the kinds of mismatch instead of every file. - Name release.yml by the move commit 6df1bf0 instead of linking the history section of CONTRIBUTING.md, and drop the clause on CONTRIBUTING.md from the Node.js item. --- docs/backlog.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/backlog.md b/docs/backlog.md index c1ee940..686e287 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -2,27 +2,24 @@ Reports and requests from users stay in [GitHub Issues](https://github.com/sql-bi/DaxFormatter/issues); an item here links its issue instead of copying it. -## Now -As of 2026-11-19: no plan open. - ## Next -- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, and Node.js 20 reached end of life on 2026-04-30; the LTS majors on 2026-11-19 are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it; `CONTRIBUTING.md` needs no change, since it points to the major that `typescript-ci.yml` sets. What stays out: the `engines` field of `package.json`, a change to the published package that needs asking first. -- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and must be rotated by hand; with trusted publishing npm issues a short-lived credential to the workflow and adds provenance on its own. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. It depends on the Node.js LTS item above. -- MCP registry entry for the stdio server: AI clients that browse the registry find it there. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. +- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, which reached end of life on 2026-04-30; on 2026-11-19 the LTS majors are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it. `engines` in `package.json` stays out: changing it changes the published package. +- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and is rotated by hand. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. Depends on the Node.js item above. +- MCP registry entry for the stdio server, so that AI clients that browse the registry find it. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. ## Later - OpenAPI contract in `spec/`, with test vectors shared by all clients: one definition of the REST contract (see Known debt). - TypeScript client library in `typescript/packages/daxformatter`, extracted from the port inside the MCP package and used by it. - npm workspaces rooted at `typescript/`, so the npm packages share one lockfile and one install; needed once there are two npm packages. - Python client in `python/`. -- `timeout-minutes` for the job of `dotnet-ci.yml`, whose tests call the live service: it has none, so a stuck run lasts up to GitHub's default of 360 minutes ([workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)). +- `timeout-minutes` for the job of `dotnet-ci.yml`, whose tests call the live service: without it, a stuck run lasts up to GitHub's default of 360 minutes ([workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)). - `concurrency` groups in both CI workflows, so that a newer push to a pull request cancels its older run. ## Known debt -- Enum wire format diverges between the clients: the .NET client sends `ServerMode`, `ServerEdition` and `ServerLocation` as numbers (System.Text.Json web defaults, no converter), while the TypeScript port sends them as strings; `ServerType` is a string in both (`EnumMember` values through `JsonEnumMemberConverter` in .NET). Cost: the service receives two forms of the same fields, and a new client has no rule to follow; changing the .NET form changes the wire format of a published package. Repay with the OpenAPI contract, which fixes one form for every client. -- The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool for the options it exposes. Cost: every contract change touches each copy, and the copies already drift (the enum wire format above). Repay with the OpenAPI contract and its shared test vectors. -- The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install today. Repay in the next change to the sample. -- The .NET tests call the live service: `DaxFormatterClientTests` uses a real `DaxFormatterClient`, so .NET CI depends on the service and the network, and an outage fails unrelated pull requests. The MCP tests inject a mock `fetch` and run offline. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. -- The MCP server says that `formatted` is null for invalid DAX: the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` ("Invalid DAX: `formatted` is null") and the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description checks for null and misses the empty string. Repay with a change to the tool description and the type comment, which raises the MCP server's version. -- Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy of a release workflow drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow before the [move](../CONTRIBUTING.md#reading-history-across-the-move), which no workflow on `master` uses any more; run each release job in a GitHub environment that only `master` can deploy to, with the release secrets moved into it and the environment named in the nuget.org policy ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). -- Some files under `dotnet/` don't follow `.editorconfig`. Byte order mark: `src/Dax.Formatter/AssemblyInfo.cs`, `src/Dax.Formatter/Client/Http/DaxFormatterHttpClient.cs` and `tests/Dax.Formatter.Tests/DaxFormatterClientTests.cs` lack the one it asks for in `*.cs`; `samples/GettingStarted/BasicFormatter.csproj` and `tests/Dax.Formatter.Tests/Dax.Formatter.Tests.csproj` have one, which it rules out in project files. Final newline: `global.json`, `nuget.config`, `BasicFormatter.csproj`, `src/Dax.Formatter/IDaxFormatterClient.cs` and `src/Dax.Formatter/Client/Http/IDaxFormatterHttpClient.cs` have none. Trailing whitespace: `README.md`, `BasicFormatter.csproj`, `samples/GettingStarted/Program.cs`, and `Models/DaxFormatterRequest.cs`, `Models/DaxFormatterMultipleRequest.cs`, `Security/SecurityHelpers.cs` and `Serialization/JsonEnumMemberConverter.cs` under `src/Dax.Formatter/`. Tabs: `src/Dax.Formatter/AnalysisServices/ServerLocation.cs` and `ServerMode.cs`, and the two `.sln` files, which Visual Studio writes with tabs while `[*]` asks for spaces. Cost: saving one in an editor that applies `.editorconfig` changes its byte order mark or whitespace, so the diff shows changes unrelated to the edit. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`. +- The clients send enums in different forms: the .NET client sends `ServerMode`, `ServerEdition` and `ServerLocation` as numbers, the TypeScript port as strings; `ServerType` is a string in both. Cost: the service receives two forms of the same fields, a new client has no rule to follow, and changing the .NET form changes the wire format of a published package. Repay with the OpenAPI contract, which fixes one form for every client. +- The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool. Cost: every contract change touches each copy, and the copies already drift (the enums above). Repay with the OpenAPI contract and its shared test vectors. +- The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install. Repay in the next change to the sample. +- The .NET tests call the live service (`DaxFormatterClientTests`). Cost: .NET CI depends on the service and the network, and an outage fails unrelated pull requests. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. +- The MCP server says that `formatted` is null for invalid DAX, in the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` and in the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description misses the empty string. Repay by fixing both texts, which raises the MCP server's version. +- Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow's name before the move in `6df1bf0`; run each release job in a GitHub environment that only `master` can deploy to, which holds the release secrets and which the nuget.org policy names ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). +- Some files under `dotnet/` don't follow `.editorconfig`: a missing or unwanted byte order mark, no final newline, trailing whitespace, and tabs, including in the two `.sln` files, which Visual Studio writes with tabs. Cost: saving one in an editor that applies `.editorconfig` puts changes unrelated to the edit in the diff. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`. From 03242272b460907049eaa498ca999f03504ebff4 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:28:37 +0100 Subject: [PATCH 13/18] docs: reduce CONTRIBUTING.md to what contributors need - Keep the intro, Issues, a one-line Build and test that links the language AGENTS.md files, the commit and pull request conventions, and the license. - Remove Where code goes, Versions, tags and releases, and Reading history across the move: the layout shows itself, ADR-0004 and the workflows hold the release conventions, and git log --follow shows the history. - Drop the commit bullets that restated AGENTS.md: CI scope, document updates and the REST contract. --- CONTRIBUTING.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e92ef6..164b723 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,14 +8,6 @@ Thank you for helping with DAX Formatter. This repository holds the client packa - Report a security vulnerability privately, as the [security policy](SECURITY.md) explains, never in a public issue. - For a change larger than a fix, open an issue first, so that the approach is agreed before the work starts. -## Where code goes - -The repository is organized by language ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)): - -- `dotnet/`: the .NET client library `Dax.Formatter`, its tests and samples ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)). -- `typescript/packages/daxformatter-mcp/`: the MCP server `@sqlbi/daxformatter-mcp`, with its own TypeScript port of the client. -- `docs/`: documentation for contributors and maintainers; [`AGENTS.md`](AGENTS.md#documentation) says where each kind of fact lives. The user documentation is on [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). - ## Build and test Each language folder builds and tests on its own: the commands and their requirements are in [`dotnet/AGENTS.md`](dotnet/AGENTS.md) and [`typescript/AGENTS.md`](typescript/AGENTS.md). @@ -25,36 +17,6 @@ Each language folder builds and tests on its own: the commands and their require - Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/): `type(scope): summary`, in the imperative, lowercase start, at most 72 characters, for example `docs(mcp): link client setup on SQLBI Docs`. Usual types: `feat`, `fix`, `docs`, `refactor`, `test`, `build` (also dependencies, as Dependabot writes them), `ci`, `chore`. - One logical change per commit; the body says what changed and why, in `-` bullets wrapped at 72 columns. - Pull requests are squash-merged into `master`, so the pull request title becomes the commit subject: write it as a Conventional Commits subject. The description is plain text with `-` bullets, without headings or tables. -- CI builds and tests the language folders that a pull request changes, and again after the merge into `master`. -- A change updates the documents it affects in the same pull request; a change to the REST contract starts from [`docs/design/rest-api.md`](docs/design/rest-api.md) and updates both clients. An architectural decision is recorded in [`docs/decisions/`](docs/decisions/README.md). - -## Versions, tags and releases - -- Each package gets its version from Nerdbank.GitVersioning and its own `version.json` ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)): don't set versions in project files or in `package.json`. -- The maintainers release each package with its release workflow. - -## Reading history across the move - -On 2026-11-17 the repository moved to the language-first layout in one commit, `6df1bf0` (#53). To follow a file across the move, use `git log --follow`: - -```bash -git log --follow -- dotnet/src/Dax.Formatter/DaxFormatterClient.cs -``` - -Commits before the move use the old paths: - -| Before the move | After the move | -|---|---| -| `src/Dax.Formatter/` | `dotnet/src/Dax.Formatter/` | -| `src/Dax.Formatter.Tests/` | `dotnet/tests/Dax.Formatter.Tests/` | -| `src/Dax.Formatter.sln`, `src/Directory.Build.props` | `dotnet/` | -| `samples/getting-started/` | `dotnet/samples/GettingStarted/` | -| `version.json`, `global.json`, `nuget.config`, `package-icon.png`, `README.md` at the root | `dotnet/` | -| `mcp/` | `typescript/packages/daxformatter-mcp/` | -| `.github/workflows/ci.yml`, `release.yml` | `dotnet-ci.yml`, `dotnet-release-dax-formatter.yml` | -| `.github/workflows/ci-mcp.yml`, `publish-mcp.yml` | `typescript-ci.yml`, `typescript-release-daxformatter-mcp.yml` | - -For a folder, or for commands that don't follow renames, give both paths, for example `git log -- src/Dax.Formatter dotnet/src/Dax.Formatter`. ## License From 3fa18a0befd2b745b04ac2a4f021c5c323c02f4a Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:32:37 +0100 Subject: [PATCH 14/18] docs(decisions): link the NBGV caveat in its new home from ADR-0003 - The caveat on dotnet/version.json now lives in the Pitfalls of dotnet/AGENTS.md, so ADR-0003 links it there with a relative link instead of a permalink to the old architecture. - ADR-0003 is accepted in this same pull request and still proposed on master, so it can still be edited. --- docs/decisions/0003-keep-one-net-solution-with-role-folders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md index 3e78492..a24b155 100644 --- a/docs/decisions/0003-keep-one-net-solution-with-role-folders.md +++ b/docs/decisions/0003-keep-one-net-solution-with-role-folders.md @@ -23,7 +23,7 @@ Chosen option: "One solution with role folders", because one package, its tests - `Dax.Formatter.sln` holds the libraries under `src/` and the test projects under `tests/`; `Directory.Build.props` in `dotnet/` applies to both. - Samples under `samples/` show how users consume a published package: each has its own solution, references the package from nuget.org, and inherits no build settings from `dotnet/`. - A second NuGet package adds its project under `src/` and its tests under `tests/`, in the same solution, and a release workflow of its own, `dotnet-release-<package>.yml` ([ADR-0001](0001-organize-the-repository-by-language.md)). -- A second NuGet package puts its own `version.json` in its project folder, `src/<Package>/version.json`, with path filters that cover that folder and whatever it builds from. NBGV uses the `version.json` in the project's folder or its nearest ancestor, and its documentation shows a secondary `version.json` in a project folder ([`version.json`](https://dotnet.github.io/Nerdbank.GitVersioning/docs/versionJson.html)). `dotnet/version.json` stays the version file of `Dax.Formatter`: its path filter names `src/Dax.Formatter`, and moving it has an NBGV caveat ([architecture](https://github.com/sql-bi/DaxFormatter/blob/4928eacfedfcd2be7a0f7807162b505f8242af11/docs/design/architecture.md#versions-and-releases)). Checked on a scratch repository with the nbgv CLI 3.7.112: a project under a folder with its own `version.json` gets that file's version and height, and commits there don't raise the version of a project under `dotnet/version.json`. +- A second NuGet package puts its own `version.json` in its project folder, `src/<Package>/version.json`, with path filters that cover that folder and whatever it builds from. NBGV uses the `version.json` in the project's folder or its nearest ancestor, and its documentation shows a secondary `version.json` in a project folder ([`version.json`](https://dotnet.github.io/Nerdbank.GitVersioning/docs/versionJson.html)). `dotnet/version.json` stays the version file of `Dax.Formatter`: its path filter names `src/Dax.Formatter`, and moving it has an NBGV caveat ([`dotnet/AGENTS.md`](../../dotnet/AGENTS.md#pitfalls)). Checked on a scratch repository with the nbgv CLI 3.7.112: a project under a folder with its own `version.json` gets that file's version and height, and commits there don't raise the version of a project under `dotnet/version.json`. ### Consequences From 37ac69b062b0c473914f64f5bf91df71fcaeb3bc Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:32:43 +0100 Subject: [PATCH 15/18] docs(readme): drop the duplicate link to CONTRIBUTING.md - The Documentation list linked CONTRIBUTING.md for contributors and maintainers, as the Contributing section already does; keep the section. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b9b0b50..96fa6d6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ The service also hosts a remote MCP server, which needs nothing installed. - User documentation: [SQLBI Docs](https://docs.sqlbi.com/dax-formatter/). - Connecting an AI client: to the [remote MCP server](https://docs.sqlbi.com/dax-formatter/mcp-http) or to the [stdio MCP server](https://docs.sqlbi.com/dax-formatter/mcp-stdio). -- For contributors and maintainers: [`CONTRIBUTING.md`](CONTRIBUTING.md). ## Support From 19db48947c3832df86ff8307ff9025a64225a1ca Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:32:48 +0100 Subject: [PATCH 16/18] docs(agents): name the version command in the new-package rule - The rule listed the release guide, which held the command that prints the version a release would publish; that command now lives in each language folder's AGENTS.md, so a new package adds its own there. --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 9175b4f..973d936 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,7 @@ There is no build at the root: each language folder builds and tests on its own, - The REST contract (an endpoint, a field, an enum value, the hashing, the caller identity) → [`docs/design/rest-api.md`](docs/design/rest-api.md) and every implementation its [Implementations](docs/design/rest-api.md#implementations) section lists. - A workflow file renamed or added → its file name follows [ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md) (`<language>-ci.yml`, `<language>-release-<package>.yml`), its `name:` is the file name without `.yml`, and its CI job ids start with the language, such as `dotnet-build-and-test` ([why](docs/design/architecture.md#deployment)); for the .NET CI workflow, the CI badge in `dotnet/README.md`; for the .NET release workflow, a maintainer adds the nuget.org Trusted Publishing policy for the new file name before the next release. -- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `<language>-release-<package>.yml`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). +- A new package → its language folder ([ADR-0001](docs/decisions/0001-organize-the-repository-by-language.md)); its own `version.json` at its toolchain root ([ADR-0004](docs/decisions/0004-version-tag-and-release-each-package-independently.md)), or, for a second NuGet package, in its project folder ([ADR-0003](docs/decisions/0003-keep-one-net-solution-with-role-folders.md)) with a record that supersedes that rule of ADR-0004; its release workflow `<language>-release-<package>.yml`; the command that prints its version in its language folder's `AGENTS.md`; an entry in `.github/dependabot.yml` when no entry covers its folder; the component dropdown of the issue forms; the package table of `README.md`; [`docs/design/architecture.md`](docs/design/architecture.md). - How the packages fit together, version or release → [`docs/design/architecture.md`](docs/design/architecture.md). - An architectural decision → a new record in [`docs/decisions/`](docs/decisions/README.md), in the same pull request. - How to connect an AI client to the MCP servers → SQLBI Docs ([remote](https://docs.sqlbi.com/dax-formatter/mcp-http), [stdio](https://docs.sqlbi.com/dax-formatter/mcp-stdio)), maintained outside this repository, which only links them. From e319c9ce9fa9c54dfd677a97b89c9218d343bde4 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:32:56 +0100 Subject: [PATCH 17/18] docs(backlog): land the Node.js LTS item before the next MCP release - On Node.js 20, npm ci in the release workflow may fail without a placeholder NODE_AUTH_TOKEN, which setup-node v7 no longer sets; the workaround was in the deleted release guide, so the item now says to land before the next MCP release. --- docs/backlog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/backlog.md b/docs/backlog.md index 686e287..8b0698e 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -3,7 +3,7 @@ Reports and requests from users stay in [GitHub Issues](https://github.com/sql-bi/DaxFormatter/issues); an item here links its issue instead of copying it. ## Next -- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, which reached end of life on 2026-04-30; on 2026-11-19 the LTS majors are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). Done when both workflows set the same supported LTS major and CI passes on it. `engines` in `package.json` stays out: changing it changes the published package. +- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, which reached end of life on 2026-04-30; on 2026-11-19 the LTS majors are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). It lands before the next MCP release: on Node.js 20, `npm ci` in the release may fail without a placeholder `NODE_AUTH_TOKEN`, which setup-node v7 no longer sets ([setup-node](https://github.com/actions/setup-node)). Done when both workflows set the same supported LTS major and CI passes on it. `engines` in `package.json` stays out: changing it changes the published package. - npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and is rotated by hand. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. Depends on the Node.js item above. - MCP registry entry for the stdio server, so that AI clients that browse the registry find it. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. From a328fd2c34c1ef10d69ca4aa875ce18cdcee23f4 Mon Sep 17 00:00:00 2001 From: Alberto Spelta <albertospelta@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:58:05 +0100 Subject: [PATCH 18/18] docs(backlog): give every item an ID - Number the items in their current order, from B-1 to B-16, across Next, Later and Known debt, and add the Next ID line, B-17, so plans, pull requests and commit footers can cite an item by its ID. - Replace the references that relied on an item's place ("the Node.js item above", "the enums above") with B-1 and B-10. - The Documentation line of AGENTS.md says that a new item takes the Next ID and that IDs are never reused, since agents on this repository may not have the documentation guidelines. --- AGENTS.md | 2 +- docs/backlog.md | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 973d936..c3fafd9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,4 +42,4 @@ There is no build at the root: each language folder builds and tests on its own, - [`docs/design/`](docs/design/README.md): how the packages work, call the service, version and release. Read before changing a package's boundaries, the REST contract, a `version.json` or a workflow. - [`docs/decisions/`](docs/decisions/README.md): why it is so, one record per decision. Read the titles before proposing a design choice. -- [`docs/backlog.md`](docs/backlog.md): what comes next, open decisions and known debt. Read before picking up work. +- [`docs/backlog.md`](docs/backlog.md): what comes next, open decisions and known debt. Read before picking up work; a new item takes the `Next ID`, and IDs are never reused. diff --git a/docs/backlog.md b/docs/backlog.md index 8b0698e..9345862 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -1,25 +1,27 @@ # Backlog +Next ID: B-17 + Reports and requests from users stay in [GitHub Issues](https://github.com/sql-bi/DaxFormatter/issues); an item here links its issue instead of copying it. ## Next -- The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, which reached end of life on 2026-04-30; on 2026-11-19 the LTS majors are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). It lands before the next MCP release: on Node.js 20, `npm ci` in the release may fail without a placeholder `NODE_AUTH_TOKEN`, which setup-node v7 no longer sets ([setup-node](https://github.com/actions/setup-node)). Done when both workflows set the same supported LTS major and CI passes on it. `engines` in `package.json` stays out: changing it changes the published package. -- npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and is rotated by hand. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. Depends on the Node.js item above. -- MCP registry entry for the stdio server, so that AI clients that browse the registry find it. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. +- B-1 The MCP server's workflows run on a supported Node.js LTS: `typescript-ci.yml` and `typescript-release-daxformatter-mcp.yml` set `node-version: "20"`, which reached end of life on 2026-04-30; on 2026-11-19 the LTS majors are 22, 24 and 26 ([release schedule](https://github.com/nodejs/Release#release-schedule)). It lands before the next MCP release: on Node.js 20, `npm ci` in the release may fail without a placeholder `NODE_AUTH_TOKEN`, which setup-node v7 no longer sets ([setup-node](https://github.com/actions/setup-node)). Done when both workflows set the same supported LTS major and CI passes on it. `engines` in `package.json` stays out: changing it changes the published package. +- B-2 npm trusted publishing for the MCP server release: the release workflow publishes with a long-lived npm token, which can leak and is rotated by hand. Done when the trusted publisher on npm names `typescript-release-daxformatter-mcp.yml`, the release job runs on Node.js 22.14 or later with npm 11.5.1 or later, a release publishes without the token, and a maintainer deletes the token. Depends on B-1. +- B-3 MCP registry entry for the stdio server, so that AI clients that browse the registry find it. Done when a `server.json` describes the npm package with `repository.subfolder` set to `typescript/packages/daxformatter-mcp`, the server appears in the registry, and `typescript/AGENTS.md` has the command that updates the entry. ## Later -- OpenAPI contract in `spec/`, with test vectors shared by all clients: one definition of the REST contract (see Known debt). -- TypeScript client library in `typescript/packages/daxformatter`, extracted from the port inside the MCP package and used by it. -- npm workspaces rooted at `typescript/`, so the npm packages share one lockfile and one install; needed once there are two npm packages. -- Python client in `python/`. -- `timeout-minutes` for the job of `dotnet-ci.yml`, whose tests call the live service: without it, a stuck run lasts up to GitHub's default of 360 minutes ([workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)). -- `concurrency` groups in both CI workflows, so that a newer push to a pull request cancels its older run. +- B-4 OpenAPI contract in `spec/`, with test vectors shared by all clients: one definition of the REST contract (see Known debt). +- B-5 TypeScript client library in `typescript/packages/daxformatter`, extracted from the port inside the MCP package and used by it. +- B-6 npm workspaces rooted at `typescript/`, so the npm packages share one lockfile and one install; needed once there are two npm packages. +- B-7 Python client in `python/`. +- B-8 `timeout-minutes` for the job of `dotnet-ci.yml`, whose tests call the live service: without it, a stuck run lasts up to GitHub's default of 360 minutes ([workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)). +- B-9 `concurrency` groups in both CI workflows, so that a newer push to a pull request cancels its older run. ## Known debt -- The clients send enums in different forms: the .NET client sends `ServerMode`, `ServerEdition` and `ServerLocation` as numbers, the TypeScript port as strings; `ServerType` is a string in both. Cost: the service receives two forms of the same fields, a new client has no rule to follow, and changing the .NET form changes the wire format of a published package. Repay with the OpenAPI contract, which fixes one form for every client. -- The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool. Cost: every contract change touches each copy, and the copies already drift (the enums above). Repay with the OpenAPI contract and its shared test vectors. -- The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install. Repay in the next change to the sample. -- The .NET tests call the live service (`DaxFormatterClientTests`). Cost: .NET CI depends on the service and the network, and an outage fails unrelated pull requests. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. -- The MCP server says that `formatted` is null for invalid DAX, in the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` and in the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description misses the empty string. Repay by fixing both texts, which raises the MCP server's version. -- Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow's name before the move in `6df1bf0`; run each release job in a GitHub environment that only `master` can deploy to, which holds the release secrets and which the nuget.org policy names ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). -- Some files under `dotnet/` don't follow `.editorconfig`: a missing or unwanted byte order mark, no final newline, trailing whitespace, and tabs, including in the two `.sln` files, which Visual Studio writes with tabs. Cost: saving one in an editor that applies `.editorconfig` puts changes unrelated to the edit in the diff. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`. +- B-10 The clients send enums in different forms: the .NET client sends `ServerMode`, `ServerEdition` and `ServerLocation` as numbers, the TypeScript port as strings; `ServerType` is a string in both. Cost: the service receives two forms of the same fields, a new client has no rule to follow, and changing the .NET form changes the wire format of a published package. Repay with the OpenAPI contract, which fixes one form for every client. +- B-11 The REST contract is restated in each client: the .NET request and response models, the TypeScript port's types and serializer, and the zod schemas of the MCP tool. Cost: every contract change touches each copy, and the copies already drift (B-10). Repay with the OpenAPI contract and its shared test vectors. +- B-12 The getting-started sample references `Dax.Formatter` 1.0.0, while nuget.org has 1.2.2. Cost: the sample builds against a package from 2021, not the one users install. Repay in the next change to the sample. +- B-13 The .NET tests call the live service (`DaxFormatterClientTests`). Cost: .NET CI depends on the service and the network, and an outage fails unrelated pull requests. Repay with the shared test vectors: unit tests against recorded responses, and the live tests in a separate job. +- B-14 The MCP server says that `formatted` is null for invalid DAX, in the tool description in `typescript/packages/daxformatter-mcp/src/format-tool.ts` and in the comment of `formatted` in `src/daxformatter/types.ts`, while the service returns an empty string ([REST API, Response](design/rest-api.md#response)). Cost: an AI client that follows the tool description misses the empty string. Repay by fixing both texts, which raises the MCP server's version. +- B-15 Releases are tied to `master` only by the branch guard of the release workflows: a run uses the workflow file of the commit it runs on ([Workflows](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflows)), so a branch whose copy drops the guard runs with the repository secrets, and the nuget.org Trusted Publishing policy names the workflow file, not a branch. Cost: whoever can push a branch and run workflows can publish from it. Repay: remove the nuget.org policy for `release.yml`, the .NET release workflow's name before the move in `6df1bf0`; run each release job in a GitHub environment that only `master` can deploy to, which holds the release secrets and which the nuget.org policy names ([Trusted Publishing](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing), [environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)). +- B-16 Some files under `dotnet/` don't follow `.editorconfig`: a missing or unwanted byte order mark, no final newline, trailing whitespace, and tabs, including in the two `.sln` files, which Visual Studio writes with tabs. Cost: saving one in an editor that applies `.editorconfig` puts changes unrelated to the edit in the diff. Repay with one commit that only normalizes these files, and a `[*.sln]` section with `indent_style = tab`.