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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/scripts/build-decision-index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Builds docs/decisions/README.md from the title, status, and feature (or older design) line of each decision record.
# With --check, fails when the index is out of date instead of writing it.
set -euo pipefail
shopt -s nullglob
cd "$(dirname "${BASH_SOURCE[0]}")/../.."

readonly decisions_dir="docs/decisions"
readonly index_file="$decisions_dir/README.md"
readonly no_design="Project-wide"

fail() {
echo "::error::$1" >&2
exit 1
}

field() {
sed -n "s/^- \*\*$2:\*\* //p" "$1" | head -n 1
}

build_index() {
local -A groups=()
local -a group_order=()
local superseded=""

for record in "$decisions_dir"/[0-9][0-9][0-9][0-9]-*.md; do
local file title status group entry
file="$(basename "$record")"
title="$(head -n 1 "$record" | sed -n 's/^# \([0-9][0-9]*\. .*\)$/\1/p')"
status="$(field "$record" Status)"
group="$(field "$record" Feature)"
[[ -n "$group" ]] || group="$(field "$record" Design)"
[[ -n "$title" ]] || fail "$record must start with '# N. Title'."
[[ -n "$status" ]] || fail "$record has no '- **Status:**' line."

entry="- [$title]($file)"
if [[ "$status" == Superseded* ]]; then
superseded+="$entry: ${status,}"$'\n'
continue
fi
[[ "$status" == "Accepted" ]] || entry+=" (${status#Accepted, })"
group="${group:-$no_design}"
[[ -v "groups[$group]" ]] || group_order+=("$group")
groups[$group]+="$entry"$'\n'
done

print_header
for group in "${group_order[@]}"; do
printf '\n## %s\n\n%s' "$(capitalize_link_text "$group")" "${groups[$group]}"
done
if [[ -n "$superseded" ]]; then
printf '\n## Superseded\n\n%s' "$superseded"
fi
}

capitalize_link_text() {
if [[ "$1" != \[* ]]; then
echo "$1"
return
fi
local rest="${1:1}"
echo "[${rest^}"
}

print_header() {
cat <<'EOF'
# Decision records

<!-- Generated by .github/scripts/build-decision-index.sh. Do not edit by hand. -->

One line per record, grouped by the feature that made it. Before changing something a record may cover, find it
here and open only that record. [`docs/README.md`](../README.md) says which choices get a record.
EOF
}

index="$(build_index)"
if [[ "${1:-}" == "--check" ]]; then
diff -u "$index_file" <(printf '%s\n' "$index") ||
fail "$index_file is out of date. Run .github/scripts/build-decision-index.sh and commit the result."
else
printf '%s\n' "$index" > "$index_file"
fi
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
with:
persist-credentials: false

- name: Check the decision index
run: .github/scripts/build-decision-index.sh --check

- name: Install the .NET SDK from global.json
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
## Documentation

Read `docs/README.md` before designing or implementing a feature, and follow its "Adding a feature" steps. It defines
where designs, decision records, the contract, and the public API files live, and which of them may change.
where the spec, the plan, decision records, and the public API files live, and which of them may change.
56 changes: 44 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,55 @@
| --- | --- | --- |
| [`contract.md`](contract.md) | What Arbitrator promises: principles, semantics, the behavioral contract, diagnostics | In the same pull request as the behavior |
| [`architecture.md`](architecture.md) | How it's built, for contributors | When the internals it describes change |
| [`decisions/`](decisions/) | One record per decision, with its context and consequences | Never, once accepted. A new record supersedes an old one |
| [`design/`](design/) | The design of each feature | Never, once the feature is implemented |
| [`decisions/`](decisions/) | One record per decision worth protecting, with its context and consequences, and a generated [index](decisions/README.md) | Never, once accepted. A new record supersedes an old one |
| [`releasing.md`](releasing.md) | How to publish a version | When the release process changes |
| `src/Arbitrator/PublicAPI.*.txt` | The exact public API | With every public API change. The build enforces it |

The repository's `README.md` is the user guide.
The repository's `README.md` is the user guide. A feature's plan is the description of its pull request and isn't kept
in the repository ([42](decisions/0042-feature-plans-live-in-the-pull-request.md)).

## Adding a feature

1. Write the design in `docs/design/<feature>.md`. Earlier designs show the expected depth.
2. Record each real choice the feature makes as a new decision, numbered after the last one. If it reverses an earlier
decision, set that record's status to "Superseded by N".
3. Implement it. Add new public API to `PublicAPI.Unshipped.txt`, update the contract sections and README sections
whose behavior changed, add a row to the behavioral contract for each new rule with a test for it, and update
`architecture.md` if the internals it describes changed.
4. Once implemented, set the design's status to "Implemented" and leave it unchanged after that. Close the enhancement
issue the feature delivers, if there is one. Ideas deferred along the way become new enhancement issues.
1. **Write the spec.** On the feature's branch, change the contract sections, `PublicAPI.Unshipped.txt`, and the README
sections to describe the feature as it will behave, and add a row to the behavioral contract for each new rule.
Small changes start here and need nothing else before the code.
2. **Write the plan** as the pull request's description: what the feature does and why, the approach, the steps, the
risks, the alternatives rejected, and the acceptance criteria. A large feature opens with a short overview, since
the spec alone is a diff.
3. **Record the decisions.** Check each real choice against [the bar for a record](#when-a-choice-gets-a-record). List
the ones that pass in the plan, and record each that the maintainer approves as a new decision, numbered after the
last one. The rest stay in the plan's alternatives. If a record reverses an earlier decision, set that record's
status to "Superseded by N", or "Accepted, partly superseded by N" when only part of it changes. Then run
`.github/scripts/build-decision-index.sh`.
4. **Implement it.** Add a test for each new row of the behavioral contract, keep the spec in step with what was built,
and update `architecture.md` if the internals it describes changed.
5. Close the enhancement issue the feature delivers, if there is one. Ideas deferred along the way become new
enhancement issues.

## When a choice gets a record

A choice gets a decision record only if it passes all three tests:

1. **Costly to reverse.** Changing it later breaks callers, a release, or a lot of code. Examples: public API shape,
promised behavior, dependencies, license, packaging.
2. **Likely to be undone.** A capable contributor reading the code without the record might "fix" or "simplify" it. If
the obvious option was chosen, there's nothing to protect.
3. **A real alternative lost.** A viable option was rejected for a reason specific to this case, not only because of a
rule already written elsewhere.

Every other choice goes where it belongs:

| Kind of choice | Where it goes |
| --- | --- |
| A trade-off inside one feature | The plan in its pull request, under the alternatives |
| A naming or style convention | `.editorconfig` or an analyzer when it can be enforced, otherwise the plan that introduces it |
| What Arbitrator does | [`contract.md`](contract.md) |
| Something Arbitrator won't do | One line under "Not planned" in [`contract.md`](contract.md) §2 |
| Something the build or tests already enforce | Nowhere else. The check is the record |

The title of a record states the decision itself, such as "Duplicates are errors", so that the
[index](decisions/README.md) is enough to find it. Where code looks wrong but is deliberate because of a record, a
one-line comment may point to the record.

## Decision record template

Expand All @@ -29,7 +61,7 @@ The repository's `README.md` is the user guide.

- **Status:** Accepted
- **Date:** YYYY-MM-DD
- **Design:** link to the feature design, if there is one
- **Feature:** the feature's name, linked to its pull request once it exists

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0001-async-method-naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0002-task-not-valuetask.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0003-no-response-requests-bridge-to-unit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0004-response-type-inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0005-exact-runtime-type-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0006-continuation-takes-the-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0007-continuation-invoked-at-most-once.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0008-single-global-behavior-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0009-constrained-open-behaviors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0010-scoped-sender-transient-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted, partly superseded by [38](0038-configurable-component-lifetimes.md)
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0011-keyed-internal-registrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0012-duplicates-are-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0013-resolve-components-before-running.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0014-single-cancellation-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0015-failures-through-the-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0016-one-configuration-exception-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0017-defer-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Superseded by [22](0022-notifications.md)
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0018-single-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0020-apache-2-license.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0021-tunit-test-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-07
- **Design:** [requests and pipeline](../design/requests-and-pipeline.md)
- **Design:** [requests and pipeline](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/requests-and-pipeline.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0022-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted, partly superseded by [35](0035-per-handler-notification-behaviors.md)
- **Date:** 2026-11-07
- **Design:** [notifications](../design/notifications.md)
- **Design:** [notifications](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/notifications.md)
- **Supersedes:** [17](0017-defer-notifications.md)

## Context
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0023-opt-in-assembly-scanning.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-08
- **Design:** [assembly scanning](../design/assembly-scanning.md)
- **Design:** [assembly scanning](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/assembly-scanning.md)

## Context

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0024-documentation-layout.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 24. Documentation layout

- **Status:** Accepted
- **Status:** Accepted, partly superseded by [41](0041-only-choices-worth-protecting-get-a-record.md) and [42](0042-feature-plans-live-in-the-pull-request.md)
- **Date:** 2026-11-08

## Context
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0026-dedicated-streaming-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Date:** 2026-11-08
- **Design:** [request streaming](../design/request-streaming.md)
- **Design:** [request streaming](https://github.com/CodeByDylan/Arbitrator/blob/f2bb0a6673fa49c8666cd5d21febda9d0c81993b/docs/design/request-streaming.md)

## Context

Expand Down
Loading
Loading