Skip to content

Commit 7e72759

Browse files
committed
Merge remote-tracking branch 'origin/develop' into AI-1580
# Conflicts: # CLAUDE.md # apps/temporal/package.json
2 parents 1ef1864 + 617da9a commit 7e72759

541 files changed

Lines changed: 604726 additions & 2784 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/create-pr/SKILL.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: create-pr
3+
description: "Create a single pull request for the current branch using gh. Trigger phrases: create a PR, open a pull request, create pull request, open a PR, submit a PR. Do NOT invoke for: splitting a branch into multiple PRs (use split-branch-into-prs), committing only, or pushing without a PR."
4+
---
5+
6+
# Create Pull Request
7+
8+
Opens one PR for the current branch against `develop` (unless the user specifies another base), using the repo PR template and documentation checklist.
9+
10+
## Always Follow
11+
12+
- Use `gh` for all GitHub operations
13+
- Never update git config
14+
- Do not force-push to `main`/`master`; warn if the user requests it
15+
- Do not commit unless the user explicitly asked to commit
16+
- Never commit secrets (`.env`, credentials, tokens)
17+
- Fill the PR body from `.github/PULL_REQUEST_TEMPLATE.md` structure
18+
- Confirm documentation and wiki checklist items were addressed (or explicitly N/A) before opening the PR
19+
- When documentation or wiki updates are needed, follow the [documentation](../documentation/SKILL.md) skill first
20+
21+
## Workflows
22+
23+
1. **[Create PR](Workflows/create-pr.md)** — Inspect branch state, push if needed, open the PR with `gh pr create`
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Create PR
2+
3+
Create a single pull request for the current branch.
4+
5+
## Prerequisites
6+
7+
- User explicitly asked to create/open a PR
8+
- Branch has commits to include (or user confirmed empty-diff intent is wrong and work is committed)
9+
10+
## Steps
11+
12+
1. **Gather branch state in parallel:**
13+
14+
```bash
15+
git status
16+
git diff
17+
git branch -vv
18+
git log --oneline -10
19+
git rev-parse --abbrev-ref HEAD
20+
```
21+
22+
Also determine the base branch (default `develop` unless the user specified another) and the full commit range:
23+
24+
```bash
25+
git log develop...HEAD --oneline
26+
git diff develop...HEAD
27+
```
28+
29+
If the branch does not track a remote or is behind/ahead in a way that matters, note that before pushing.
30+
31+
2. **Confirm documentation readiness:**
32+
33+
- If the change affects behavior, APIs, setup, ownership, or contributor routing, ensure docs were updated per the [documentation](../../documentation/SKILL.md) skill.
34+
- If the change affects system boundaries, doc routing, or where contributors should edit, ensure `docs-md/wiki/` was updated or confirmed not needed.
35+
- If wiki files changed, run `npm run docs:wiki:check`.
36+
37+
3. **Push the branch if needed:**
38+
39+
```bash
40+
git push -u origin HEAD
41+
```
42+
43+
4. **Draft the PR:**
44+
45+
- Title format: `JIRA_BOARD-NUMBER: short title` (e.g. `AI-1296: Add repo wiki`)
46+
- Summary links the Jira ticket when known
47+
- Changes summarize **all** commits on the branch, not only the latest
48+
- Testing lists what was run or how to verify
49+
- Checklist matches `.github/PULL_REQUEST_TEMPLATE.md`
50+
51+
5. **Create the PR:**
52+
53+
```bash
54+
gh pr create --base develop --title "AI-###: Title" --body "$(cat <<'EOF'
55+
## Summary
56+
57+
[AI-###](https://citz-do.atlassian.net/browse/AI-###)
58+
59+
Brief description of why this change exists.
60+
61+
## Changes
62+
63+
- Bullet list of what changed
64+
65+
## Testing
66+
67+
- How it was tested
68+
69+
## Checklist
70+
71+
By submitting this pull request, I acknowledge that I have attempted to meet the following:
72+
73+
> - a self-review of my code
74+
> - commented code particularly in hard-to-understand areas
75+
> - documentation updated where required (`docs-md/`, READMEs, and/or public `docs/` site), including the repo wiki (`docs-md/wiki/`) when boundaries, routing, or contributor guidance changed — or confirmed not needed
76+
> - changes tested to the best of my ability
77+
> - no new errors or non-functional code
78+
79+
EOF
80+
)"
81+
```
82+
83+
Use `--draft` only when the user asks for a draft PR.
84+
85+
6. **Return the PR URL** to the user.
86+
87+
## Common Pitfalls
88+
89+
- Creating a PR without updating docs/wiki when boundaries or contributor guidance changed
90+
- Summarizing only the latest commit instead of the full branch diff
91+
- Forcing push or amending commits the user did not ask to amend
92+
- Pasting secrets into the PR body or logs
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Docs Conventions
2+
3+
## Topic taxonomy (docs-md/)
4+
5+
| Folder | Scope |
6+
| --- | --- |
7+
| `architecture/` | System-level design: HITL architecture, database services/roles, transaction/audit compliance, blob storage, document content hash, ephemeral document cleanup, reference data tables, template models, shared packages, audit table, HA |
8+
| `auth/` | Authentication (OAuth/Keycloak, API keys) and group resource authorization |
9+
| `groups/` | Group management APIs, membership requests, group frontend pages/context |
10+
| `workflows/` | DAG workflow engine, graph types, node/activity/OCR-provider guides, workflow builder, node catalog, lineage, config overrides, Temporal worker concurrency, Temporal payload footprint (gzip codec + OCR payload refs), `templates/` example configs |
11+
| `extraction/` | OCR/extraction: Azure AI models, classifiers, enrichment, field formatting, image normalization, confusion profiles/matrices, OCR improvement pipeline, OCR failure handling, OCR result views, ground truth, HITL datasets |
12+
| `operations/` | OpenShift deployment, environment configuration, backups, Azure infrastructure, secrets, npm hardening |
13+
| `monitoring/` | PLG stack, Helm charts, Promtail, dashboards, metrics, alerting, logging |
14+
| `benchmarking/` | Benchmarking system, load testing runbooks |
15+
| `frontend/` | Frontend-wide concerns: BC Design System migration, confirmation-modal and sentence-case standardization, header/upload UI, UI patterns not tied to one feature |
16+
| `archive/` | Historical/point-in-time artifacts only — see `archive/README.md` |
17+
| `wiki/` | Routing layer — rules in `wiki/README.md`, canonical agent rules in `AGENTS.md` (Repo Wiki section) |
18+
19+
- New docs go in the matching folder. Create a new folder only when several related docs don't fit anywhere above; add it to `docs-md/README.md` and this table in the same PR.
20+
- Filenames: `SCREAMING_SNAKE.md` for reference docs (matches the majority convention).
21+
22+
## Content rules
23+
24+
- Current shipped behavior only. Requirements/user stories → `feature-docs/`; pre-implementation designs → historical once shipped.
25+
- No placeholders, no "future work" sections, no stubs. If describing target/planned UX is genuinely needed (e.g. design reference), open with an explicit status disclaimer stating what is and isn't implemented.
26+
- Reference code by repo-relative path. Prefer stable anchors (file paths, exported names) over line numbers.
27+
- Relative markdown links between docs; they must resolve from the doc's own folder.
28+
- The system is generic — no document-type-specific implementation guidance.
29+
- When code changes make a doc inaccurate, the doc is updated in the same PR (CLAUDE.md rule).
30+
31+
## Archive policy
32+
33+
A doc is archived (not deleted) when it stops describing current behavior: reports, one-off analyses, completed plans/status trackers, superseded requirements. Process is in [Workflows/Archive.md](Workflows/Archive.md). Delete only docs with no historical value.
34+
35+
## Wiki boundary (summary — full rules in docs-md/wiki/README.md)
36+
37+
- Wiki topic pages: short synthesis + `canonical_sources` links. 180-line soft limit. No runbooks, schemas, endpoint lists, or implementation guides.
38+
- Every wiki change: append a grep-friendly `log.md` entry (`## [YYYY-MM-DD] operation | Title`), update `sources.md` if canonical areas changed, record contradictions in `open-questions.md`, run `npm run docs:wiki:check`.

.claude/skills/docs-sync/SKILL.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: docs-sync
3+
description: "Keeps docs-md/ and the repo wiki synchronized with the codebase: update docs affected by code changes, audit docs for accuracy, add new docs in the right topic folder, archive stale docs. Trigger phrases: sync docs, update docs for this change, audit docs, docs maintenance, archive doc, document this feature. Do NOT invoke for: editing the docs/ HTML site (use docs-site), writing feature requirements (use requirements-refiner), or wiki-only content questions (read docs-md/wiki/README.md directly)."
4+
---
5+
6+
# Docs Sync
7+
8+
Maintains `docs-md/` (canonical developer reference docs, organized by topic) and `docs-md/wiki/` (routing layer for humans and LLM agents) so they stay accurate against the codebase.
9+
10+
## Workflows
11+
12+
| Task | Workflow |
13+
| --- | --- |
14+
| Code changed — update the affected docs | [Workflows/Ingest.md](Workflows/Ingest.md) |
15+
| Verify docs are accurate against code (periodic or targeted) | [Workflows/Audit.md](Workflows/Audit.md) |
16+
| Document something new | [Workflows/AddDoc.md](Workflows/AddDoc.md) |
17+
| Retire a stale / point-in-time doc | [Workflows/Archive.md](Workflows/Archive.md) |
18+
19+
## Always Follow
20+
21+
1. Read [CONVENTIONS.md](CONVENTIONS.md) before editing any doc — it defines the topic taxonomy, naming, archive policy, and wiki boundary.
22+
2. Docs describe **current shipped behavior only**. Verify every concrete claim (paths, commands, env vars, endpoints, model/field names) against code before writing it. Never document unverified or planned behavior without an explicit status disclaimer.
23+
3. Canonical docs first, wiki second: update the `docs-md/` topic doc, then reflect routing/boundary changes in the wiki per `docs-md/wiki/README.md` (ingest workflow). The wiki never duplicates implementation detail.
24+
4. After touching `docs-md/wiki/`: run `npm run docs:wiki:check`.
25+
5. After moving/renaming/deleting any doc: run `bash .claude/skills/docs-sync/scripts/check-doc-links.sh` and fix reported dangling links; also grep code, READMEs, and `docs/_pages/` for references to the old path (`grep -rn "docs-md/<OLDNAME>" --include='*.ts' --include='*.md' --include='*.html' --include='*.sh' --include='*.yml' apps packages docs scripts tools deployments README.md`).
26+
6. Use `git mv` for moves so history is preserved.
27+
7. Never commit generated `docs/wiki*.html` (gitignored; built by `docs/build.sh` at deploy time).
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AddDoc — document something new
2+
3+
Use when a shipped subsystem/feature has no reference doc.
4+
5+
## Steps
6+
7+
1. **Confirm it's a real gap.** Search existing docs first — coverage may live under a non-obvious name:
8+
```bash
9+
grep -rlni "<subsystem keywords>" docs-md --include='*.md'
10+
```
11+
If a doc partially covers it, extend that doc instead of creating a near-duplicate.
12+
13+
2. **Research the code** until you can describe the shipped behavior: entry points, key modules, data flow, configuration. Verify everything you plan to state.
14+
15+
3. **Pick folder and name** from the taxonomy in [CONVENTIONS.md](../CONVENTIONS.md): `docs-md/<topic>/<SCREAMING_SNAKE>.md`.
16+
17+
4. **Write the doc.** Match the conventions of 2–3 neighbors in the folder. Typical shape: title, short overview, key code paths, how it works / how to use it, configuration (env vars, keys), links to related docs. Shipped behavior only — no placeholders, no future-work sections.
18+
19+
5. **Link it into the system:**
20+
- Cross-link from the most related existing docs where a reader would need it.
21+
- If `docs-md/README.md`'s folder description no longer covers the folder's contents, update it.
22+
- Wiki: if the doc adds a canonical area, add it to the relevant topic page's `canonical_sources` and to `docs-md/wiki/sources.md`; log an `ingest` entry in `docs-md/wiki/log.md`.
23+
24+
6. **Verify:**
25+
```bash
26+
npm run docs:wiki:check
27+
bash .claude/skills/docs-sync/scripts/check-doc-links.sh
28+
```
29+
30+
## Common Pitfalls
31+
32+
- Writing a doc for something `feature-docs/` already specs — feature-docs is requirements history; the new doc describes shipped behavior and should not copy requirements text.
33+
- Duplicating a runbook into the wiki — the wiki only routes to it.
34+
- Document-type-specific guidance — the platform is generic; keep examples generic.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Archive — retire a stale or point-in-time doc
2+
3+
Use when a doc stops describing current behavior: completed plans and status trackers, one-off reports/analyses, docs for removed code.
4+
5+
## Steps
6+
7+
1. **Confirm it qualifies.** Archive policy is in [CONVENTIONS.md](../CONVENTIONS.md). If only parts are stale, fix the doc instead ([Audit.md](Audit.md)). Delete outright only when a doc has no historical value (rare).
8+
9+
2. **Move with history:**
10+
```bash
11+
git mv docs-md/<topic>/<DOC>.md docs-md/archive/<DOC>.md
12+
```
13+
14+
3. **Update `docs-md/archive/README.md`:** add a row to the Contents table — what it was, and the canonical alternative (the doc/code that now answers those questions).
15+
16+
4. **Repair inbound references.** Find everything pointing at the old path and either re-point to the canonical alternative or to the archive path (for historical citations):
17+
```bash
18+
grep -rn "<DOC>.md" --include='*.md' --include='*.ts' --include='*.tsx' --include='*.html' --include='*.sh' --include='*.yml' --include='*.yaml' apps packages docs docs-md scripts tools deployments README.md .claude
19+
```
20+
21+
5. **Wiki:** remove the doc from any `canonical_sources` lists and `sources.md`; if a whole topic became historical, set the topic page `status: archived`. Append a `maintenance` entry to `docs-md/wiki/log.md`.
22+
23+
6. **Verify:**
24+
```bash
25+
npm run docs:wiki:check
26+
bash .claude/skills/docs-sync/scripts/check-doc-links.sh
27+
```
28+
29+
## Common Pitfalls
30+
31+
- Leaving the archived doc listed as a canonical source in the wiki — the validator may pass (file still exists) but routing is now wrong.
32+
- Archiving a doc that is the only coverage of still-shipped behavior — extract the still-true content into the topic folder first.
33+
- Using `mv` instead of `git mv`, losing file history.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Audit — verify docs against the codebase
2+
3+
Use for a periodic accuracy pass, or a targeted check of one topic folder ("audit the monitoring docs").
4+
5+
## Steps
6+
7+
1. **Pick scope.** One doc, one topic folder, or all of `docs-md/` (excluding `archive/` and `wiki/`).
8+
9+
2. **For each doc, verify concrete claims against code.** Check with Grep/Read — never from memory:
10+
- file/directory paths exist
11+
- commands and npm scripts exist and are spelled right
12+
- env var names match code (`grep -rn "process.env.<NAME>"` / config files)
13+
- API endpoints, methods, and DTOs match controllers
14+
- Prisma model/field names match `apps/shared/prisma/schema.prisma`
15+
- workflow node types and activity names match the registries in `apps/temporal/src/` and `packages/graph-workflow/`
16+
- helm values, ports, manifest paths match `deployments/`
17+
18+
3. **Fix in place.** Surgical edits; preserve the doc's voice. Don't restructure working content. Content explicitly marked as target design / design reference keeps its content — verify the status disclaimer is still accurate instead.
19+
20+
4. **Classify outcomes:**
21+
- accurate → done
22+
- fixed → done
23+
- describes removed code or is point-in-time → run [Archive.md](Archive.md)
24+
- reveals an undocumented subsystem → run [AddDoc.md](AddDoc.md)
25+
26+
5. **For large scopes** (whole tree), fan out subagents — one per doc or per folder batch — each with the checklist above, returning findings + fixes. Cross-check anything a subagent flags as uncertain yourself.
27+
28+
6. **Verify and record:**
29+
```bash
30+
npm run docs:wiki:check
31+
bash .claude/skills/docs-sync/scripts/check-doc-links.sh
32+
```
33+
If wiki structure or the source registry changed, append a `lint` entry to `docs-md/wiki/log.md`.
34+
35+
## Common Pitfalls
36+
37+
- Trusting a doc's own cross-references as evidence — verify against code, not other docs.
38+
- "Fixing" intentionally deferred abstractions: this team defers abstractions until a documented duplication threshold; their absence is not an inaccuracy or a gap.
39+
- Deleting design-reference content because it isn't implemented — it's kept intentionally with a status disclaimer.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Ingest — update docs after a code change
2+
3+
Use when code changed (a diff, a merged PR, a feature you just implemented) and the docs must catch up.
4+
5+
## Steps
6+
7+
1. **Scope the change.** List what actually changed:
8+
```bash
9+
git diff --stat <base>...HEAD # or the working-tree diff
10+
```
11+
Identify affected surfaces: endpoints, env vars, Prisma models, workflow nodes/activities, UI routes, deploy manifests, npm scripts.
12+
13+
2. **Find the affected docs.** Map each changed surface to its topic folder (taxonomy in [CONVENTIONS.md](../CONVENTIONS.md)). Search rather than guess:
14+
```bash
15+
grep -rln "<changed symbol/path/env var>" docs-md --include='*.md'
16+
```
17+
Check `docs-md/<topic>/` listings for docs whose subject overlaps the change.
18+
19+
3. **Update each affected doc.** Verify the new behavior in code first, then edit. Follow the content rules in CONVENTIONS.md. If the change makes a whole doc obsolete, switch to [Archive.md](Archive.md). If the change introduces a new undocumented subsystem, switch to [AddDoc.md](AddDoc.md).
20+
21+
4. **Wiki ingest** (only if the change affects navigation, boundaries, or drift risks — most small changes don't):
22+
- Update the relevant `docs-md/wiki/<topic>.md` routing context and `canonical_sources`; bump its `updated:` date.
23+
- Update `docs-md/wiki/sources.md` if new canonical areas appeared.
24+
- Append to `docs-md/wiki/log.md`: `## [YYYY-MM-DD] ingest | <title>`.
25+
- Record contradictions in `docs-md/wiki/open-questions.md`.
26+
27+
5. **Verify:**
28+
```bash
29+
npm run docs:wiki:check
30+
bash .claude/skills/docs-sync/scripts/check-doc-links.sh
31+
```
32+
33+
## Common Pitfalls
34+
35+
- Updating the wiki but not the canonical doc — canonical source first, always.
36+
- Documenting the diff instead of the resulting behavior. Docs describe the current state, not the change history.
37+
- Forgetting non-markdown references: code comments, seed scripts, and configmaps reference `docs-md/` paths too.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# Checks that every relative markdown link in docs-md/ resolves to an existing file.
3+
# Prints "OK" or a list of dangling links (file: link). Exit 1 if any dangle.
4+
set -e
5+
cd "$(git rev-parse --show-toplevel)"
6+
7+
fail=0
8+
while IFS= read -r -d '' f; do
9+
dir=$(dirname "$f")
10+
# extract markdown link targets: ](target)
11+
grep -oE '\]\([^)[:space:]]+\)' "$f" 2>/dev/null | sed -E 's/^\]\(//; s/\)$//' | while IFS= read -r target; do
12+
case "$target" in
13+
http://*|https://*|mailto:*|\#*) continue ;;
14+
esac
15+
clean="${target%%#*}"
16+
clean="${clean%%\?*}"
17+
[ -z "$clean" ] && continue
18+
if [ "${clean#/}" != "$clean" ]; then
19+
resolved=".$clean" # repo-root-absolute style
20+
else
21+
resolved="$dir/$clean"
22+
fi
23+
if [ ! -e "$resolved" ]; then
24+
echo "DANGLING $f: $target"
25+
fi
26+
done
27+
done < <(find docs-md -name '*.md' -not -path 'docs-md/archive/*' -print0) | sort | tee /tmp/doc-link-check.out
28+
29+
if [ -s /tmp/doc-link-check.out ]; then
30+
echo "--- $(wc -l < /tmp/doc-link-check.out) dangling link(s) found"
31+
exit 1
32+
else
33+
echo "OK: all relative links in docs-md resolve (archive/ excluded)"
34+
fi

0 commit comments

Comments
 (0)