Compare commits

...

4 Commits

Author SHA1 Message Date
8a72362a8b chore: contributor workflow — issue/PR templates, git-cliff, gitea-workflow doc (refs #31)
Some checks failed
CI / compose-smoke (pull_request) Has been cancelled
CI / lint (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / unit (pull_request) Has been cancelled
Add the Gitea issue templates (slice/bug/adr-proposal) and a PR template
that carry the Definition of Done, a git-cliff config (cliff.toml) with a
`make changelog` target, the generated CHANGELOG.md, and docs/gitea-
workflow.md documenting the issue -> milestone -> PR flow.

Verified: make lint/build/unit green; `make changelog` regenerates the
changelog from Conventional Commits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 14:09:11 +02:00
d4a89e6e62 ci: Gitea Actions pipeline + runner runbook (refs #30) (#37)
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / unit (push) Has been cancelled
CI / compose-smoke (push) Has been cancelled
2026-06-03 12:04:19 +00:00
dfd6224fea feat(infra): containerize BFF + compose-up smoke (closes #29) (#36) 2026-06-03 11:46:27 +00:00
7d67ecbde1 chore: remove bootstrap scripts from main (#35) 2026-06-03 11:40:14 +00:00
16 changed files with 485 additions and 484 deletions

View File

@@ -0,0 +1,24 @@
---
name: ADR proposal
about: Propose a decision that needs recording before coding (CLAUDE.md §14)
title: "ADR: "
labels:
- type:adr-proposal
---
**Decision to be made:**
**Context / forces:** <!-- what makes this non-obvious; constraints, trade-offs -->
**Options considered:**
1.
2.
**Proposed option + why:**
**Consequences:** <!-- what becomes easier/harder; what we commit to -->
**Coupling rules touched (CLAUDE.md §8):** <!-- none, or which and why -->
> On acceptance, the ADR file (`docs/architecture/adr-NNNN-title.md`, Nygard
> template) lands in the PR that implements the decision.

View File

@@ -0,0 +1,21 @@
---
name: Bug
about: Something behaves incorrectly
title: ""
labels:
- type:bug
---
**What happened:**
**What you expected:**
**Steps to reproduce:**
1.
2.
**Environment:** <!-- branch/commit, OS, container engine, anything relevant -->
**Logs / evidence:**
**Suspected area:** <!-- e.g. area:bff, area:acl — add the matching area label -->

View File

@@ -0,0 +1,31 @@
---
name: Slice (user story)
about: A backlog slice — independently demoable, encodes the Definition of Done
title: "S-NN · "
labels:
- type:slice
---
**Outcome:** <!-- one sentence; user-visible if possible -->
**Acceptance:**
<!-- Gherkin scenarios or testable assertions -->
-
**Touches:** <!-- services and folders -->
**Out of scope:** <!-- explicit non-goals -->
## Definition of Done
- [ ] This linked Gitea issue exists and is on the right milestone.
- [ ] Failing test written and committed first (`test(scope): … (refs #NN)`).
- [ ] Implementation makes the test pass (`feat(scope): … (refs #NN)`).
- [ ] Refactor commit follows if structure improved.
- [ ] Conventional Commit messages referencing this issue.
- [ ] All Gitea Actions CI jobs green (or `make ci` green while no runner exists).
- [ ] `docker compose up` from a fresh clone reaches green health checks within 3 minutes.
- [ ] Docs touched if behaviour, contracts, or operations changed.
- [ ] ADR added in `docs/architecture/` if a non-obvious decision was made.
- [ ] Demo note appended to `docs/demo-script.md` if the slice is user-visible.
- [ ] This issue closed by the merging PR (`closes #NN`).

View File

@@ -0,0 +1,23 @@
<!-- Title: Conventional Commit style, e.g. feat(bff): … (closes #NN) -->
## What & why
<!-- Summary of the change and the slice/bug it addresses. -->
Closes #
## Definition of Done
- [ ] Linked Gitea issue (above).
- [ ] Failing test committed before the implementation.
- [ ] Implementation makes the test pass; refactor commit if structure improved.
- [ ] Conventional Commits referencing the issue (`refs #NN`).
- [ ] CI green — all Gitea Actions jobs (or `make ci` green while no runner exists).
- [ ] `docker compose up` from a fresh clone reaches green health checks within 3 minutes.
- [ ] Docs updated if behaviour, contracts, or operations changed.
- [ ] ADR added in `docs/architecture/` if a non-obvious decision was made.
- [ ] Demo note in `docs/demo-script.md` if user-visible.
## Notes for reviewers
<!-- Anything that helps review: trade-offs, follow-ups, known gaps. -->

50
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,50 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# Self-hosted runner — see docs/runbooks/ci.md for the runner setup.
# `uses:` are absolute, tag-pinned URLs (CLAUDE.md §8.7 / §15).
# Each job calls a `make` target — the same one developers run locally
# (`make ci`). The Makefile is the single source of truth; see docs/runbooks/ci.md.
jobs:
lint:
runs-on: respellion-linux
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: make lint
build:
runs-on: respellion-linux
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: make build
unit:
runs-on: respellion-linux
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: make unit
compose-smoke:
runs-on: respellion-linux
steps:
- uses: https://github.com/actions/checkout@v4
- run: make smoke

20
CHANGELOG.md Normal file
View File

@@ -0,0 +1,20 @@
# Changelog
All notable changes to this project. Generated from Conventional Commits by git-cliff.
## Unreleased
### CI
- Gitea Actions pipeline + runner runbook (refs #30) (#37)
### Chores
- Add idempotent Gitea backlog seeder
- Remove bootstrap scripts from main (#35)
### Documentation
- Split S-00 into sub-slices (refs #1) (#33)
### Features
- Placeholder BFF + /health endpoint (closes #28) (#34)
- Containerize BFF + compose-up smoke (closes #29) (#36)

54
Makefile Normal file
View File

@@ -0,0 +1,54 @@
# Developer + CI entrypoints.
#
# These targets are the single source of truth for the checks. The Gitea
# Actions workflow (.gitea/workflows/ci.yaml) invokes the SAME targets, so
# `make ci` locally runs exactly what the pipeline runs — no drift. Until a
# self-hosted runner is registered, `make ci` is the gate (see docs/runbooks/ci.md).
SLN := services/bff/Bff.slnx
COMPOSE := infra/docker-compose.yml
HEALTH_URL := http://localhost:8080/health
# On a rootless Podman dev box, point Docker CLI/Compose at the Podman socket —
# but only if that socket exists and DOCKER_HOST isn't already set, so real
# Docker hosts and CI runners are left untouched.
PODMAN_SOCK := /run/user/$(shell id -u)/podman/podman.sock
ifeq ($(wildcard $(PODMAN_SOCK)),$(PODMAN_SOCK))
ifeq ($(origin DOCKER_HOST),undefined)
export DOCKER_HOST := unix://$(PODMAN_SOCK)
endif
endif
.PHONY: ci lint build unit smoke down changelog help
## ci: run the full pipeline — lint, build, unit, smoke (mirrors Gitea Actions)
ci: lint build unit smoke
## lint: verify formatting (no changes)
lint:
dotnet format $(SLN) --verify-no-changes
## build: release build
build:
dotnet build $(SLN) -c Release
## unit: run unit tests
unit:
dotnet test $(SLN) -c Release
## smoke: compose up (wait for healthy), curl /health, then tear down
smoke:
docker compose -f $(COMPOSE) up -d --build --wait
bash -c 'curl -fsS $(HEALTH_URL); rc=$$?; docker compose -f $(COMPOSE) down --volumes; exit $$rc'
## down: stop and remove the local stack
down:
docker compose -f $(COMPOSE) down --volumes
## changelog: regenerate CHANGELOG.md from Conventional Commits (git-cliff)
changelog:
git-cliff --output CHANGELOG.md
## help: list available targets
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/^## //'

View File

@@ -56,6 +56,15 @@ docker compose -f infra/docker-compose.yml up -d
Health checks should be green within ~3 minutes on a developer machine. If something fails, see [docs/runbooks/local-startup.md](docs/runbooks/local-startup.md). Health checks should be green within ~3 minutes on a developer machine. If something fails, see [docs/runbooks/local-startup.md](docs/runbooks/local-startup.md).
> **Wired today (Iteration 0):** only the placeholder BFF is in `infra/docker-compose.yml` so far. Bring it up and smoke-test its health endpoint:
>
> ```bash
> docker compose -f infra/docker-compose.yml up -d --build --wait
> curl http://localhost:8080/health # -> Healthy
> ```
>
> `--wait` exits non-zero unless the container reports healthy, so this doubles as the compose-up smoke test. The remaining services and the URLs below land in later slices.
**Default URLs** **Default URLs**
| Service | URL | | Service | URL |

45
cliff.toml Normal file
View File

@@ -0,0 +1,45 @@
# git-cliff configuration — generates CHANGELOG.md from Conventional Commits.
# Run via `make changelog`. See https://git-cliff.org.
[changelog]
header = """
# Changelog
All notable changes to this project. Generated from Conventional Commits by git-cliff.\n
"""
body = """
{% if version %}\
## {{ version }} — {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## Unreleased
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}\
- {{ commit.message | upper_first }}{% if commit.breaking %} **[BREAKING]**{% endif %}
{% endfor %}\
{% endfor %}\n
"""
trim = true
[git]
conventional_commits = true
filter_unconventional = true
split_commits = false
protect_breaking_commits = true
tag_pattern = "v[0-9]*"
# CalVer tags: YYYY.MM.PATCH
filter_commits = false
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^docs", group = "Documentation" },
{ message = "^test", group = "Tests" },
{ message = "^ci", group = "CI" },
{ message = "^build", group = "Build" },
{ message = "^arch", group = "Architecture" },
{ message = "^chore", group = "Chores" },
{ message = ".*", group = "Other" },
]

52
docs/gitea-workflow.md Normal file
View File

@@ -0,0 +1,52 @@
# Working with Gitea: issues, milestones, PRs
Gitea is the **system of record** (CLAUDE.md §7). `BACKLOG.md` is a human-readable
mirror of the active milestone — when they disagree, Gitea wins.
## Issues
- Open issues from the templates in `.gitea/ISSUE_TEMPLATE/`:
- **Slice** — a backlog user story (`S-NN · …`), encodes the Definition of Done.
- **Bug** — a defect.
- **ADR proposal** — a decision to record before coding (CLAUDE.md §14).
- Every issue gets `type:*` plus the relevant `area:*` label(s), and is assigned to
its iteration **milestone** (`Iteration N — …`).
- Splitting a slice that grew too big: see CLAUDE.md §13 and the "How to split a
slice" section of `BACKLOG.md`.
## Branches & commits
- Trunk-based: short-lived branches off `main`, squash-merged. Never push to `main`.
- Branch name: `<type>/<issue-number>-<slug>`, e.g. `feat/28-bff-health`.
- Conventional Commits, each referencing its issue: `feat(bff): … (refs #28)`.
- TDD order: the `test(...)` red commit precedes the `feat(...)` green commit.
## Pull requests
- Open with `tea pr create` (the Gitea CLI) or the web UI; the body uses
`.gitea/PULL_REQUEST_TEMPLATE.md` and its DoD checklist.
- The merging PR closes its issue via `closes #NN` in the squash-commit body.
Work that isn't finished (e.g. CI green pending a runner) uses `refs #NN` and the
issue stays open.
- A PR needs a linked issue. Don't open one without it.
## CI gate
Until a self-hosted `respellion-linux` runner is registered, `make ci` is the gate
(it runs the same checks the workflow does). See [runbooks/ci.md](runbooks/ci.md).
## CLI cheatsheet (`tea`)
```bash
tea issues list --state open # backlog
tea issue create --title "S-NN · …" --labels type:slice,area:bff --milestone "Iteration 1 — Walking Skeleton"
tea pr create --base main --head <branch> --title "…" --description "… closes #NN"
tea pr list # open PRs
tea pr merge <n> --style squash # merge (after review)
```
## Changelog & releases
`CHANGELOG.md` is generated from commits by `git-cliff` (`make changelog`), refreshed
on tag. Versioning is **CalVer** `YYYY.MM.PATCH`; releases are published via Gitea
Releases.

104
docs/runbooks/ci.md Normal file
View File

@@ -0,0 +1,104 @@
# CI runbook — Gitea Actions
> **Status: no runner yet → run CI locally with `make ci`.** The workflow
> `.gitea/workflows/ci.yaml` is in place, but the pipeline cannot go green until a
> self-hosted `respellion-linux` runner is registered against the Gitea instance.
> Until then, **`make ci` is the gate** — it runs the exact same checks locally
> (the workflow calls the same `make` targets). Issue **#30 (S-00-c)** stays open
> until CI is verified green on a runner.
## The pipeline
`.gitea/workflows/ci.yaml` runs on every push and pull request to `main`. Each job
calls a `make` target — the **single source of truth** for the checks, so local
and CI cannot drift:
| Job | Target | Needs |
|---|---|---|
| `lint` | `make lint``dotnet format … --verify-no-changes` | .NET 10 SDK |
| `build` | `make build``dotnet build … -c Release` | .NET 10 SDK |
| `unit` | `make unit``dotnet test … -c Release` | .NET 10 SDK |
| `compose-smoke` | `make smoke` → compose up `--wait``curl /health``down` | container engine + compose v2 |
All `uses:` references are absolute, tag-pinned URLs (`https://github.com/actions/checkout@v4`,
`https://github.com/actions/setup-dotnet@v4`) per CLAUDE.md §8.7 and §15 — Gitea
Actions resolves them from GitHub.
## Running CI locally (`make ci`)
Until the runner exists, run the full pipeline yourself before pushing:
```bash
make ci # lint + build + unit + smoke — what the pipeline runs
make lint # or a single stage
make smoke # compose up --wait, curl /health, tear down
```
**Prerequisites:** .NET 10 SDK, a container engine with Compose v2, and `curl`.
On a **rootless Podman** box (the default dev setup here), the `smoke` target needs
the Podman API socket and a Compose provider:
```bash
systemctl --user enable --now podman.socket # start the API socket
ln -sf "$(command -v podman)" ~/.local/bin/docker # docker -> podman shim
# install Docker Compose v2 into ~/.local/bin as `docker-compose` (the provider)
```
The Makefile auto-points `DOCKER_HOST` at `/run/user/$(id -u)/podman/podman.sock`
when that socket exists and `DOCKER_HOST` is unset, so `make smoke` "just works"
locally while leaving real Docker hosts / CI runners untouched.
## Runner: `respellion-linux`
The single self-hosted runner label this repo targets is **`respellion-linux`**
(declared here per §15). It is intended to run **co-located on the Gitea server**
(`git.labs.respellion.tech` / `46.224.220.37`) so CI is durable and independent of
any developer machine.
### Host prerequisites
The runner executes jobs in **host mode** (see registration below), so the host
must have, on `PATH`:
- .NET 10 SDK (or let `setup-dotnet` install it into the runner tool cache)
- A container engine with Compose v2 — Docker, or Podman with the Docker-compatible
socket and the `docker-compose` provider (as configured on the dev box)
- `curl`
### Install & register `act_runner` (on the Gitea server)
```bash
# 1. Install the binary (pick the version matching the Gitea release line)
VER=0.2.11
curl -fsSL -o /usr/local/bin/act_runner \
"https://dl.gitea.com/act_runner/${VER}/act_runner-${VER}-linux-amd64"
chmod +x /usr/local/bin/act_runner
# 2. Obtain a registration token from the Gitea UI:
# Site Administration → Actions → Runners → "Create new Runner" (instance-level)
# (or Repo → Settings → Actions → Runners for a repo-scoped runner)
# 3. Register with the respellion-linux label in HOST execution mode.
# The ":host" suffix means jobs run directly on the host shell, so
# `docker compose` in compose-smoke uses the host engine (no docker-in-docker).
act_runner register --no-interactive \
--instance https://git.labs.respellion.tech \
--token <REGISTRATION_TOKEN> \
--name respellion-ci-1 \
--labels "respellion-linux:host"
# 4. Run it (foreground to verify, then install as a systemd service)
act_runner daemon
```
Verify in the Gitea UI (Actions → Runners) that `respellion-ci-1` shows **Idle**,
then re-run the `CI` workflow; all four jobs should pass.
## Security note
A self-hosted runner in **host mode** executes workflow code directly on the Gitea
server host. Anyone who can push a workflow can run code there. This is acceptable
for a **private lab** instance with trusted contributors. For anything
internet-facing, switch to container/VM isolation (`--labels "respellion-linux:docker://..."`)
or a dedicated runner host, and gate workflow runs on approval for outside PRs.

19
infra/docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
# Local development stack. Grows service-by-service with each slice.
# S-00-b: the placeholder BFF with a /health check.
#
# docker compose -f infra/docker-compose.yml up -d --build --wait
# curl http://localhost:8080/health # -> Healthy
services:
bff:
build:
context: ../services/bff
dockerfile: Dockerfile
image: register-referentie/bff:dev
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s

View File

@@ -0,0 +1,3 @@
**/bin
**/obj
**/*.user

30
services/bff/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# Multi-stage build for the placeholder BFF (.NET 10).
# Build context is services/bff (see infra/docker-compose.yml).
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Restore first (cached unless the csproj changes).
COPY Bff.Api/Bff.Api.csproj Bff.Api/
RUN dotnet restore Bff.Api/Bff.Api.csproj
# Then build + publish.
COPY Bff.Api/ Bff.Api/
RUN dotnet publish Bff.Api/Bff.Api.csproj -c Release -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
# curl is used by the container HEALTHCHECK / compose healthcheck.
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/publish .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=5 \
CMD curl -fsS http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "Bff.Api.dll"]

View File

@@ -1,54 +0,0 @@
# tools/
Repo bootstrap and maintenance scripts. Not part of the application runtime.
## `seed-gitea.sh` — bootstrap the Gitea backlog
One-time (idempotent) script that creates the project's backlog in Gitea from the
contents of [`BACKLOG.md`](../BACKLOG.md): the label taxonomy, the iteration
milestones, and all 26 slice issues (`S-00``S-25`). Gitea is the system of record
(see `CLAUDE.md` §7); this script just gets the empty repo to that starting state.
It overlaps part of **S-00**'s acceptance ("milestones, labels … exist in Gitea").
The authoritative operational write-up will move to `docs/runbooks/` and
`docs/gitea-workflow.md` when S-00 is implemented.
### Prerequisites
- `curl` and `jq` on `PATH`.
- A Gitea **personal access token** with scopes **`write:issue`** and
**`write:repository`** (Gitea → Settings → Applications → Generate New Token).
### Usage
```sh
GITEA_TOKEN=<your-pat> bash tools/seed-gitea.sh
```
The token is read from the environment only — it is never written to disk or
committed. The target repo (`eho/register-referentie` on
`git.labs.respellion.tech`) is hard-coded near the top of the script; edit the
`BASE`/`OWNER`/`REPO` variables to point elsewhere.
### What it creates
| Step | Items |
|------|-------|
| Labels | `type:{slice,bug,adr-proposal,chore}` + 12 `area:*` labels (16 total) |
| Milestones | `Iteration 0 — Foundations``Iteration 6 — Production Posture` (7 total) |
| Issues | `S-00``S-25` (26 total), each with body, milestone, and area labels |
### Idempotency
Every item is matched by name (labels), title (milestones), or issue title prefix
(`S-NN · …`) before creation, and skipped if it already exists. A partial or failed
run can be re-run safely — the second run reports every item as `skip`.
### Verify (no token needed — reads are anonymous)
```sh
B=https://git.labs.respellion.tech/api/v1/repos/eho/register-referentie
curl -s "$B/labels?limit=100" | jq length # expect 16
curl -s "$B/milestones?state=all&limit=100" | jq length # expect 7
curl -s "$B/issues?state=all&type=issues&limit=100" | jq length # expect 26
```

View File

@@ -1,430 +0,0 @@
#!/usr/bin/env bash
#
# seed-gitea.sh — populate the register-referentie Gitea repo with the backlog:
# 1. label taxonomy 2. iteration milestones 3. all 26 slice issues (S-00..S-25)
#
# Idempotent: existing labels/milestones/issues (matched by name/title) are skipped,
# so a partial or failed run can simply be re-run.
#
# Usage:
# GITEA_TOKEN=<pat> bash tools/seed-gitea.sh
#
# The token needs scopes: write:issue and write:repository (for labels + milestones).
#
set -euo pipefail
: "${GITEA_TOKEN:?Set GITEA_TOKEN to a Gitea personal access token (scopes: write:issue, write:repository)}"
BASE="https://git.labs.respellion.tech/api/v1"
OWNER="eho"
REPO="register-referentie"
REPO_API="$BASE/repos/$OWNER/$REPO"
AUTH=(-H "Authorization: token $GITEA_TOKEN")
JSON=(-H "Content-Type: application/json" -H "Accept: application/json")
say() { printf '%s\n' "$*"; }
# ---------------------------------------------------------------------------
# Preflight: confirm the token can see the repo.
# ---------------------------------------------------------------------------
code=$(curl -s -o /dev/null -w '%{http_code}' "${AUTH[@]}" "$REPO_API")
if [ "$code" != "200" ]; then
say "ERROR: cannot access $OWNER/$REPO (HTTP $code). Check the token and its scopes."
exit 1
fi
say "Authenticated against $REPO_API"
# ---------------------------------------------------------------------------
# 1. Labels
# ---------------------------------------------------------------------------
say ""
say "== Labels =="
existing_labels=$(curl -s "${AUTH[@]}" "$REPO_API/labels?limit=100")
create_label() {
local name="$1" color="$2"
if echo "$existing_labels" | jq -e --arg n "$name" 'any(.[]; .name == $n)' >/dev/null; then
say " skip $name"
return
fi
curl -s "${AUTH[@]}" "${JSON[@]}" -X POST "$REPO_API/labels" \
-d "$(jq -n --arg n "$name" --arg c "$color" '{name:$n, color:$c}')" >/dev/null
say " create $name"
}
create_label "type:slice" "#0e8a16"
create_label "type:bug" "#d73a4a"
create_label "type:adr-proposal" "#5319e7"
create_label "type:chore" "#fbca04"
for area in acl domain portal-self-service portal-openbaar portal-behandel \
portal-beheer infra workflow event-subscriber projection bff docs; do
create_label "area:$area" "#1d76db"
done
# ---------------------------------------------------------------------------
# 2. Milestones
# ---------------------------------------------------------------------------
say ""
say "== Milestones =="
existing_ms=$(curl -s "${AUTH[@]}" "$REPO_API/milestones?state=all&limit=100")
create_milestone() {
local title="$1"
if echo "$existing_ms" | jq -e --arg t "$title" 'any(.[]; .title == $t)' >/dev/null; then
say " skip $title"
return
fi
curl -s "${AUTH[@]}" "${JSON[@]}" -X POST "$REPO_API/milestones" \
-d "$(jq -n --arg t "$title" '{title:$t}')" >/dev/null
say " create $title"
}
create_milestone "Iteration 0 — Foundations"
create_milestone "Iteration 1 — Walking Skeleton"
create_milestone "Iteration 2 — Flow Completeness"
create_milestone "Iteration 3 — Beheer & Observability"
create_milestone "Iteration 4 — Objecten"
create_milestone "Iteration 5 — Data Governance"
create_milestone "Iteration 6 — Production Posture"
# Re-fetch labels + milestones so we have ids for issue creation.
labels_json=$(curl -s "${AUTH[@]}" "$REPO_API/labels?limit=100")
milestones_json=$(curl -s "${AUTH[@]}" "$REPO_API/milestones?state=all&limit=100")
existing_issues=$(curl -s "${AUTH[@]}" "$REPO_API/issues?state=all&type=issues&limit=100")
# Definition of Done checklist appended to every slice body (CLAUDE.md §3).
DOD=$(cat <<'EOF'
## Definition of Done
- [ ] A linked Gitea issue exists (this one).
- [ ] Failing test written and committed first.
- [ ] Implementation makes the test pass.
- [ ] Refactor commit follows if structure improved.
- [ ] Conventional Commit messages referencing this issue (`refs #NN`).
- [ ] All Gitea Actions CI jobs green: lint, unit, integration, mutation (ratchet), e2e, container build + push, compose-up smoke test.
- [ ] `docker compose up` from a fresh clone reaches green health checks within 3 minutes.
- [ ] Docs touched if behaviour, contracts, or operations changed.
- [ ] ADR added in `docs/architecture/` if a non-obvious decision was made.
- [ ] Demo note appended to `docs/demo-script.md` if the slice is user-visible.
- [ ] This issue closed by the merging PR (`closes #NN`).
EOF
)
# ---------------------------------------------------------------------------
# 3. Issues
# ---------------------------------------------------------------------------
say ""
say "== Issues =="
create_issue() {
local title="$1" milestone="$2" labels_csv="$3" body="$4"
if echo "$existing_issues" | jq -e --arg t "$title" 'any(.[]; .title == $t)' >/dev/null; then
say " skip $title"
return
fi
local ms_id
ms_id=$(echo "$milestones_json" | jq -r --arg m "$milestone" '.[] | select(.title == $m) | .id')
if [ -z "$ms_id" ]; then
say " ERROR milestone not found: $milestone (issue: $title)"
exit 1
fi
local want label_ids
want=$(printf '%s' "$labels_csv" | jq -R 'split(",")')
label_ids=$(echo "$labels_json" | jq -c --argjson want "$want" \
'[ .[] | select(.name as $n | $want | index($n)) | .id ]')
local full_body="${body}${DOD}"
local payload
payload=$(jq -n --arg t "$title" --arg b "$full_body" \
--argjson ms "$ms_id" --argjson ls "$label_ids" \
'{title:$t, body:$b, milestone:$ms, labels:$ls}')
curl -s "${AUTH[@]}" "${JSON[@]}" -X POST "$REPO_API/issues" -d "$payload" >/dev/null
say " create $title"
}
# ---- Iteration 0 ----------------------------------------------------------
create_issue "S-00 · Repository skeleton, Gitea Actions CI, contributor workflow" \
"Iteration 0 — Foundations" "type:slice,area:infra,area:docs" "$(cat <<'EOF'
**Outcome:** A fresh `git clone` from the Respellion Gitea remote, followed by `docker compose up`, produces a green "hello world" health endpoint from a placeholder BFF. Gitea Actions runs lint, build, unit tests, and the compose-up smoke test, all green. Issue templates, PR template, milestones, labels, and the first project board exist in Gitea.
**Acceptance:**
- New developer follows `README.md` and reaches a green local environment in under 10 minutes.
- Gitea Actions pipeline green on `main`.
- `git-cliff` produces an empty `CHANGELOG.md`.
- `docs/PRD.md`, `CLAUDE.md`, `BACKLOG.md`, `docs/architecture/adr-0001-loose-coupling.md`, `docs/gitea-workflow.md` all in repo.
- `.gitea/workflows/ci.yaml`, `.gitea/ISSUE_TEMPLATE/{slice,bug,adr-proposal}.md`, `.gitea/PULL_REQUEST_TEMPLATE.md` all in repo.
- Gitea milestone `Iteration 1 — Walking Skeleton` exists, populated with issues S-01 through S-09.
**Touches:** repo layout, Gitea Actions workflows, Dockerfile for placeholder BFF, `docker-compose.yml` skeleton, MkDocs scaffold, Gitea issue/PR templates.
**Out of scope:** any business logic, frontend, OpenZaak.
EOF
)"
# ---- Iteration 1 ----------------------------------------------------------
create_issue "S-01 · OpenZaak + Open Notificaties + Postgres come up in compose" \
"Iteration 1 — Walking Skeleton" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** Local `docker compose up` brings up OpenZaak, Open Notificaties, their dependencies, and a seeded ZTC catalogus called `BIG`. A health check confirms all reachable.
**Acceptance:**
- `curl` to OpenZaak `/zaken/api/v1/` returns 401 (auth working).
- A test client with a generated JWT can list zaaktypen in the `BIG` catalogus.
- The seeded catalogus contains one lean `BIG-registratie` zaaktype with only the schema-mandatory fields plus `bsn` as an eigenschap.
**Touches:** `infra/openzaak/`, `infra/opennotificaties/`, `infra/seed/`, ADR for catalogus design.
**Out of scope:** any portal, BFF, Flowable, ACL code.
EOF
)"
create_issue "S-02 · Keycloak with mock DigiD, eHerkenning, eIDAS, medewerker realms" \
"Iteration 1 — Walking Skeleton" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** Keycloak runs locally with four realms pre-seeded. Each realm has 12 test users with known credentials documented in `docs/synthetic-data.md`.
**Acceptance:**
- Browser-based OIDC login flow works for each realm against a placeholder client.
- Mock DigiD realm returns a BSN claim; eHerkenning returns a KvK; eIDAS returns a foreign identifier; medewerker returns role claims.
**Touches:** `infra/keycloak/`, seed scripts.
**Out of scope:** real federation, MFA.
EOF
)"
create_issue "S-03 · Flowable up with a minimal BPMN: \"Registratie ontvangen\"" \
"Iteration 1 — Walking Skeleton" "type:slice,area:infra,area:workflow" "$(cat <<'EOF'
**Outcome:** Flowable runs locally with Postgres. A single BPMN model (`registratie.bpmn`) deployed with one start event, one external task `OpenZaakAanmaken`, one end event.
**Acceptance:**
- BPMN model deployed via Flowable's REST API on container start.
- An HTTP call can start a process instance and observe it waiting on the external task.
**Touches:** `infra/flowable/`, `workflows/registratie.bpmn`.
**Out of scope:** DMN, boundary timers, second model.
EOF
)"
create_issue "S-04 · ACL skeleton with one operation: open a zaak" \
"Iteration 1 — Walking Skeleton" "type:slice,area:acl" "$(cat <<'EOF'
**Outcome:** A .NET library + service that exposes one method: `OpenZaak(domainPayload) → zaakUrl`. It default-fills `bronorganisatie`, `verantwoordelijkeOrganisatie`, `startdatum`, `vertrouwelijkheidaanduiding`, and posts to OpenZaak. **Strict TDD throughout.**
**Acceptance:**
- BDD scenario: "Given a domain registration payload, when I call the ACL, then a zaak exists in OpenZaak with the default-filled fields."
- Mutation score baseline captured and enforced by the Gitea Actions pipeline.
- Integration test using Testcontainers against real OpenZaak passes.
**Touches:** `services/acl/`, tests, ADR for default-fill strategy.
**Out of scope:** all other ZGW operations, status transitions, documents.
EOF
)"
create_issue "S-05 · BIG Domain Service skeleton with the Registration aggregate" \
"Iteration 1 — Walking Skeleton" "type:slice,area:domain" "$(cat <<'EOF'
**Outcome:** A .NET service exposing a single endpoint `POST /registrations`. The Registration aggregate has a state machine with at minimum `INGEDIEND`. The service orchestrates: start a Flowable process → external task callback executes the ACL `OpenZaak` → zaak URL stored on the aggregate.
**Acceptance:**
- BDD scenario: "Given a zorgprofessional submits a registration, when the domain service receives it, then a Flowable process is started and a zaak is opened in OpenZaak."
- Integration test exercises the full path (no real frontend yet).
- The Workflow Client is the only code that calls Flowable.
**Touches:** `services/domain/`, `services/acl/` (consumed), tests, ADR for external-task job-worker pattern.
**Out of scope:** any other use case, documents, decisions.
EOF
)"
create_issue "S-06 · Event Subscriber + Read Projection (minimal)" \
"Iteration 1 — Walking Skeleton" "type:slice,area:event-subscriber,area:projection" "$(cat <<'EOF'
**Outcome:** An NRC webhook consumer that, on `zaak.gecreeerd`, writes a row to a `register_projection` table with `id`, `bsn`, `naam_placeholder`, `status`. Idempotent. Rebuildable.
**Acceptance:**
- BDD scenario: "Given a zaak is created in OpenZaak, when the NRC event is delivered, then the projection contains a row with status INGEDIEND."
- Replaying the same event twice does not create duplicates.
- A `projection rebuild` admin command repopulates from OpenZaak.
**Touches:** `services/event-subscriber/`, `services/projection-api/`, tests.
**Out of scope:** decision events, multiple projections, public-safe field filtering (will tighten in S-09).
EOF
)"
create_issue "S-07 · BFF with one endpoint per portal + OIDC validation" \
"Iteration 1 — Walking Skeleton" "type:slice,area:bff" "$(cat <<'EOF'
**Outcome:** A .NET BFF exposing four endpoint groups (one per portal). Validates tokens issued by Keycloak. Implements the minimum needed for the walking skeleton: `POST /self-service/registrations`, `GET /openbaar/register?q=...`.
**Acceptance:**
- BDD scenarios cover the two endpoints with valid and invalid tokens.
- OpenAPI spec generated and committed.
**Touches:** `services/bff/`, OpenAPI spec, tests.
**Out of scope:** behandelaar and beheer endpoints (later slices).
EOF
)"
create_issue "S-08 · Self-Service portal (Angular, NL DS) — submit a registration" \
"Iteration 1 — Walking Skeleton" "type:slice,area:portal-self-service" "$(cat <<'EOF'
**Outcome:** The self-service Angular app, in the Nx monorepo, lets a zorgprofessional log in via mock DigiD and submit a registration. NL Design System styling. Generated API client.
**Acceptance:**
- E2E test (Playwright): full happy path, login → submit → success page.
- Component tests (Testing Library) for the form.
- Accessibility audit (axe-core) passes WCAG 2.1 AA on the submit page.
**Touches:** `apps/self-service/`, `libs/ui/`, `libs/auth/`, `libs/api-client/`, tests.
**Out of scope:** document upload, status tracking page.
EOF
)"
create_issue "S-09 · Openbaar Register portal — public lookup" \
"Iteration 1 — Walking Skeleton" "type:slice,area:portal-openbaar,area:projection" "$(cat <<'EOF'
**Outcome:** The openbaar Angular app shows a search box. Anonymous. Queries the BFF's `/openbaar/register` which reads only the projection's **public-safe** fields. Confirms the walking skeleton end-to-end.
**Acceptance:**
- E2E test: zorgprofessional registers via self-service (S-08), behandelaar approves via a temporary admin endpoint (no behandel-portal yet), openbaar register shows the entry.
- Public-safe field whitelist enforced and tested.
**Touches:** `apps/openbaar/`, projection-api hardening, tests.
**Out of scope:** advanced search filters, sorting.
_End of walking skeleton. Demo: submit → process → projection → public visibility. All CI gates green on Gitea Actions. Cut release `vYYYY.MM.0` and publish via Gitea Releases._
EOF
)"
# ---- Iteration 2 ----------------------------------------------------------
create_issue "S-10 · Document upload + boundary timer for document timeout (Flow 2)" \
"Iteration 2 — Flow Completeness" "type:slice,area:workflow,area:portal-self-service" "$(cat <<'EOF'
**Outcome:** BPMN extended with a "wacht op documenten" user task with a 30-day boundary timer. Self-service portal supports diploma upload. On timeout the case is cancelled.
**Acceptance:** BDD scenarios for both branches; integration tests for the timer firing.
EOF
)"
create_issue "S-11 · Withdrawal (Flow 3)" \
"Iteration 2 — Flow Completeness" "type:slice,area:portal-self-service,area:domain,area:workflow" "$(cat <<'EOF'
**Outcome:** Self-service portal has a "trek aanvraag in" action. Domain service issues a withdraw command; BPMN message event correlates; case cancels with audit trail.
EOF
)"
create_issue "S-12 · Behandel-portal — werkbak + beoordeling" \
"Iteration 2 — Flow Completeness" "type:slice,area:portal-behandel,area:workflow" "$(cat <<'EOF'
**Outcome:** Behandel portal with login (medewerker realm), werkbak listing INGEDIEND/IN_BEHANDELING cases, claim and complete user tasks via Flowable, decision endpoint via Domain Service.
**Acceptance:** BDD scenarios for claim, complete, request additional document, decide.
EOF
)"
create_issue "S-13 · DMN decision: diploma eligibility (Flow 4)" \
"Iteration 2 — Flow Completeness" "type:slice,area:workflow,area:domain" "$(cat <<'EOF'
**Outcome:** A DMN decision table evaluated by the Domain Service via Workflow Client. Foreign diplomas route to an extra "CBGV-advies" user task in BPMN.
**Acceptance:** BDD scenarios for domestic and foreign diploma paths; DMN evaluated separately is unit-tested.
EOF
)"
create_issue "S-14 · Beoordeling escalation (Flow 5)" \
"Iteration 2 — Flow Completeness" "type:slice,area:workflow" "$(cat <<'EOF'
**Outcome:** Boundary timer on beoordeling user task — 14 days. On timeout, reassigns to a teamlead role.
EOF
)"
# ---- Iteration 3 ----------------------------------------------------------
create_issue "S-15 · Beheer-portal — catalogus & default-fill rules" \
"Iteration 3 — Beheer & Observability" "type:slice,area:portal-beheer,area:acl" "$(cat <<'EOF'
**Outcome:** Beheer portal lets an admin view ZTC catalogi (read-only first), and manage the ACL's default-fill configuration via a CRUD UI. MFA on the medewerker realm enforced.
EOF
)"
create_issue "S-16 · OpenTelemetry traces + Grafana dashboard" \
"Iteration 3 — Beheer & Observability" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** Traces span portal → BFF → Domain → ACL → OpenZaak and portal → BFF → Domain → Flowable. Grafana dashboards pre-built for golden signals.
EOF
)"
create_issue "S-17 · Quartz.NET scheduler — herregistratie reminder sweep" \
"Iteration 3 — Beheer & Observability" "type:slice,area:domain" "$(cat <<'EOF'
**Outcome:** Nightly job that finds entries within 90 days of expiry and emits a domain event. (No outbound notification in v1 — logged.)
EOF
)"
# ---- Iteration 4 ----------------------------------------------------------
create_issue "S-18 · Objecten + Objecttypen up in compose; Register objecttype defined" \
"Iteration 4 — Objecten" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** Objecten and Objecttypen running. A `RegisterRecord` objecttype defined with the public-safe schema.
EOF
)"
create_issue "S-19 · ACL extension: write register-record to Objecten on approval" \
"Iteration 4 — Objecten" "type:slice,area:acl,area:projection" "$(cat <<'EOF'
**Outcome:** Approval path writes the canonical register record to Objecten, not OpenZaak eigenschappen. Projection now sourced from Objecten events.
**ADR required:** "Why Objecten holds the register, OpenZaak holds the process."
EOF
)"
# ---- Iteration 5 ----------------------------------------------------------
create_issue "S-20 · OpenMetadata module + seed bundle deployed alongside" \
"Iteration 5 — Data Governance" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** OpenMetadata stack runs as a separate compose file (`infra/governance/`). Seed bundle loaded: glossary, classification taxonomy, roles, default DQ tests.
EOF
)"
create_issue "S-21 · Read-replica ingestion + API ingestion" \
"Iteration 5 — Data Governance" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** Postgres read replicas of domain, Flowable, projection. OpenMetadata ingestion connectors discover schemas. API connector ingests OpenZaak and Objecten via OpenAPI.
EOF
)"
create_issue "S-22 · Lineage SDK (.NET) + lineage assertions across the personal-data path" \
"Iteration 5 — Data Governance" "type:slice,area:acl,area:event-subscriber,area:domain" "$(cat <<'EOF'
**Outcome:** A thin .NET package wrapping OpenMetadata's lineage API, published to the **Gitea Packages** registry. ACL, Event Subscriber, and Domain Service call it as personal data flows. Each lineage edge carries purpose and legal basis.
**ADR required:** "Lineage as a property of code, not docs."
EOF
)"
create_issue "S-23 · GDPR reporting cookbook" \
"Iteration 5 — Data Governance" "type:slice,area:docs" "$(cat <<'EOF'
**Outcome:** `docs/gdpr-reporting.md` showing how to answer specific AVG questions using OpenMetadata (data subject request, processing register, lineage trace).
EOF
)"
# ---- Iteration 6 ----------------------------------------------------------
create_issue "S-24 · Helm chart (sketch) + Kubernetes manifests for the platform" \
"Iteration 6 — Production Posture" "type:slice,area:infra" "$(cat <<'EOF'
**Outcome:** A non-deployed-but-reviewable Helm chart and accompanying ADR on production posture. Documents HA, secrets, backup, observability, identity wiring.
EOF
)"
create_issue "S-25 · Runbook completeness review" \
"Iteration 6 — Production Posture" "type:slice,area:docs" "$(cat <<'EOF'
**Outcome:** All runbooks complete: startup, seed, common failures, upgrade upstream modules, restore from backup, rotate secrets, Gitea Actions gotchas.
EOF
)"
say ""
say "Done. Verify counts (no token needed):"
say " curl -s '$REPO_API/labels?limit=100' | jq length # expect 16"
say " curl -s '$REPO_API/milestones?state=all&limit=100' | jq length # expect 7"
say " curl -s '$REPO_API/issues?state=all&type=issues&limit=100' | jq length # expect 26"