Skip to content

Commit ac6eb0b

Browse files
docs(server): align reactor guidance
1 parent 7f3e6fa commit ac6eb0b

15 files changed

Lines changed: 58 additions & 144 deletions

File tree

.github/workflows/ci-server-clean-reference.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
working-directory: server
6363
run: |
6464
mkdir -p ../ci-metrics/unit-architecture
65-
./mvnw -f application/pom.xml test -Parchitecture-tests -DskipCoverage=false \
65+
./mvnw -f application/pom.xml test -Parchitecture-tests \
66+
-Dsurefire.includedGroups=unit,architecture -DskipCoverage=false \
6667
-Dmaven.build.cache.enabled=false -Dprofile=unit-architecture -DprofileFormat=JSON \
6768
-Dmaven-profiler-report-directory=../ci-metrics/unit-architecture --batch-mode
6869

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ Holds wherever TypeScript is written here, the Bun agent trees and `scripts/**`
115115
| `webapp/src/routeTree.gen.ts` | TanStack Router Vite plugin |
116116
| `server/generated-clients/target/generated-sources/**` | GraphQL and Outline codegen, owned by the generated-clients Maven module |
117117

118-
Regeneration is destructive: it empties the target directory, so stash local edits first. Commit
119-
generated clients alongside the API change that caused them.
118+
Regeneration is destructive: it empties the target directory, so do not edit or commit Maven-generated
119+
sources. Commit the version-controlled OpenAPI specification and webapp client alongside the API
120+
change that produced them.
120121

121122
## Database changes (Liquibase)
122123

docs/contributor/ci-cd.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Coolify handles PR previews:
117117
| `ci-docker-build.yml` | Called by cicd.yml | Docker image builds per component |
118118
| `ci-security-scan.yml` | Called by cicd.yml | Dependency scanning (Trivy), secret detection |
119119
| `ci-profile.yml` | Weekly, manual | Profiles server integration tests and Spring contexts |
120+
| `ci-server-clean-reference.yml` | Weekly, manual | Records cold server phases and compares generated JARs |
120121
| `verify-changesets.yml`| PRs | Fails shipped-code PRs that carry no changeset |
121122
| `ci-compose-validate.yml` | PRs, push to main | Renders the reference and self-host compose stacks so an interpolation or merge break is a red check, not a stranger's bad first boot |
122123
| `version-pr.yml` | Push to main | Maintains the accumulating Version PR (changesets) |
@@ -220,6 +221,11 @@ resource usage, JUnit results, and Spring context-cache metrics. It signals only
220221
consecutive regressions against five earlier default-branch profiles. Branch dispatches produce
221222
standalone diagnostic artifacts without changing or enforcing that baseline.
222223

224+
The weekly **Server Phase Reference** workflow records cache-disabled Maven generation, compilation,
225+
test-compilation, and execution profiles and compares two clean generated-client JARs. GitHub Actions
226+
step durations remain the source for toolchain setup and artifact-upload time; Maven Profiler covers
227+
only work inside Maven.
228+
223229
`SpringTestContextArchitectureTest` separately enforces the reviewed Spring context keys. Run the
224230
profile options locally with:
225231

@@ -235,7 +241,7 @@ mkdir -p ci-metrics
235241

236242
Before pushing, run the same checks that CI runs:
237243

238-
### Quick Check (Recommended)
244+
### Full Local Check (Recommended)
239245

240246
```bash
241247
# Format and check all services
@@ -253,7 +259,7 @@ pnpm run test:webapp # Unit tests
253259

254260
# Application Server (Java) — includes the integration.core.webhook receiver
255261
pnpm run format:java:check # Check formatting
256-
cd server && ./mvnw test # Unit tests, including required reactor dependencies
262+
cd server && ./mvnw test # Unit tests, including required reactor dependencies
257263

258264
# Agent runtime (Bun) — the Pi runner and the practice precompute scripts
259265
pnpm run test:agents # Runner + precompute specs

docs/contributor/local-development.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ pnpm run check:agents # Biome format, then oxlint, then both typechecks
4545
pnpm run check:agents:fix # Apply every safe fix
4646
pnpm run check:webapp # The SPA: Biome format check, then oxlint
4747
pnpm run typecheck:webapp # The SPA's typecheck — a separate leg, not part of check:webapp
48-
pnpm run check # Everything — a strict superset of CI
48+
pnpm run check # Complete local quality gate; every leg also runs in CI
4949
```
5050

51-
`check` is a superset, not a copy: PMD (`lint:java`), `check:story-sort` and `check:diagrams` run in
52-
no workflow, so green CI is not evidence that `check` passes. The `pre-push` hook is the only thing
53-
that runs them before a merge, and `--no-verify` skips it.
51+
Every `pnpm run check` leg also runs in CI. Run it locally before pushing because it fails faster and
52+
reports the complete local gate in one command.
5453

5554
JetBrains alternatives such as IntelliJ (Java) and WebStorm (React/TypeScript) work equally well.
5655

@@ -63,7 +62,7 @@ have their own `application-<name>.yml` under `server/application/src/main/resou
6362
the per-role and per-purpose overlays (`worker`, `webhook`, `e2e`, `cds-training`) documented where
6463
they are used.
6564

66-
They are **not** Maven profiles — `./mvnw -Plocal` warns that the profile does not exist and changes
65+
They are **not** Maven profiles — `cd server && ./mvnw -Plocal` warns that the profile does not exist and changes
6766
nothing. Maven passes the active Spring profile through the `app.profiles` property, so the override
6867
is `-Dapp.profiles=…` (this is what `pnpm dev:server:e2e` does).
6968

docs/contributor/overview.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Hephaestus is maintained by the Applied Education Technologies (AET) team at TUM
1212
```text
1313
Hephaestus/
1414
├── webapp/ # React + Vite front-end (public UI)
15-
├── server/ # Spring Boot server (GitHub + mentor APIs, webhook receiver,
16-
│ # Pi mentor agent, sync NATS consumer — three runtime roles)
15+
├── server/ # Maven reactor
16+
│ ├── application/ # Spring Boot application — server, worker, and webhook roles
17+
│ └── generated-clients/ # Generated GitHub, GitLab, and Outline transports
1718
├── docs/ # Docusaurus site (this documentation)
1819
└── scripts/ # Tooling (ERD generation, migrations, utilities)
1920
```

docs/contributor/testing.mdx

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,30 @@ Testing keeps regression risk low across services. The application server uses M
1414

1515
```bash
1616
# Unit tests only (fast)
17-
./mvnw test
17+
cd server && ./mvnw test
1818

1919
# Full suite including integration tests
20-
./mvnw verify
20+
cd server && ./mvnw verify
2121
```
2222

23-
The reactor generates and compiles the clients on the first build. Later application and test
24-
edits reuse that unchanged module automatically; no skip profile or preserved generated-source
25-
directory is required.
23+
Generated clients have their own module, so unchanged client inputs do not require regeneration
24+
or recompilation when Maven finds a matching build-cache entry. Test selection never depends on
25+
existing build output.
2626

2727
3. Extend the correct base class:
2828

29-
```java
30-
// Unit test
31-
class UserServiceTest extends BaseUnitTest { }
32-
33-
// Integration test
34-
class UserServiceIntegrationTest extends BaseIntegrationTest { }
35-
```
29+
Unit tests extend `BaseUnitTest`; Spring-backed tests extend `BaseIntegrationTest` or a
30+
feature-specific subclass.
3631

3732
:::warning Naming matters
3833
Use `*Test.java` for unit tests and `*IntegrationTest.java` for integration tests. Maven's surefire and failsafe plugins use these patterns.
3934
:::
4035

41-
## Why testing?
42-
43-
Tests catch regressions before they hit production, document expected behaviour, and unlock safe refactors. Our setup keeps the feedback loop fast – unit tests finish in under a second, while the shared Testcontainers environment limits the cost of integration suites.
44-
4536
## Unit tests
4637

4738
- Extend `BaseUnitTest` for isolated component tests.
4839
- Use Mockito (`@Mock`, `@InjectMocks`) for dependencies.
49-
- Expect sub-second runtime – no Spring context is loaded.
50-
51-
```java
52-
class UserServiceTest extends BaseUnitTest {
53-
@Mock private UserRepository repository;
54-
@InjectMocks private UserService service;
55-
56-
@Test
57-
@DisplayName("Should validate email format")
58-
void shouldValidateEmailFormat() {
59-
// Fast isolated test
60-
}
61-
}
62-
```
40+
- Keep unit tests independent of Spring contexts and Testcontainers.
6341

6442
## Integration tests
6543

@@ -137,7 +115,7 @@ The `hephaestus.tenancy.enforcement: throw` setting in `application-test.yml` fa
137115

138116
## Webhook fixtures and tooling
139117

140-
Reusable webhook JSON lives in `src/test/resources/github`, named after the event it records. Load one with a `ClassPathResource`, or extract new samples with:
118+
Reusable webhook JSON lives in `server/application/src/test/resources/github`, named after the event it records. Load one with a `ClassPathResource`, or extract new samples with:
141119

142120
```bash
143121
pnpm run nats:extract-examples
@@ -182,7 +160,7 @@ Each annotation pins JUnit to `Execution(SAME_THREAD)` so two live tests in the
182160
### Authoring a new live test
183161

184162
1. Pick the right meta-annotation. If the env var doesn't exist yet, add a new annotation alongside the existing four — don't reuse one with a misleading name.
185-
2. Put the test under `src/test/java/.../live/`. The directory marker keeps live and non-live tests in different code-review buckets.
163+
2. Put the test under `server/application/src/test/java/.../live/`. The directory marker keeps live and non-live tests in different code-review buckets.
186164
3. Read credentials from `LiveLlmCredentials.fromEnv()` (or the GitHub helpers); never inline values. Secrets stay in env vars only.
187165
4. Per-test wall-clock timeouts: 90s is reasonable for a single mentor turn; 5 minutes for a full practice run.
188166

docs/decisions/0001-flat-top-level-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR 0001: Flat top-level layout
22

3-
**Status:** Superseded by [ADR 0032](0032-generated-clients-build-boundary.md)
3+
**Status:** Accepted
44
**Date:** 2026-05-20
55
**Authors:** Server foundations epic (#1097)
66

docs/decisions/0002-java-package-rename-to-aet-cit-tum.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Context
88

9-
The Java code under `server/application/src/main/java/` used `de.tum.in.www1.hephaestus` — a legacy
9+
The Java code under `server/src/main/java/` used `de.tum.in.www1.hephaestus` — a legacy
1010
TUM naming convention referencing the "Informatics, chair www1" structure. That structure
1111
has since been reorganized into CIT (Computation, Information and Technology) with
1212
multiple chairs at `*.cit.tum.de`. The legacy package name no longer reflects organisation

docs/decisions/0032-generated-clients-build-boundary.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ Only generated-client output participates in Maven Build Cache; the application
4747
and saving build output. Pull requests may restore an exact generated entry, while only the default
4848
branch may publish one.
4949

50-
Maven Build Cache addresses output from effective build inputs. CI persists its local cache using an
51-
exact source-and-toolchain key. The scheduled Server Phase Reference workflow monitors byte
52-
reproducibility by comparing two clean generated-client builds with caching disabled.
50+
Maven Build Cache computes checksums from configured inputs and the effective Maven model. CI wraps
51+
its local cache in an exact source-and-toolchain Actions cache key. The scheduled Server Phase
52+
Reference workflow monitors byte reproducibility by comparing two clean generated-client builds with
53+
caching disabled.
5354

5455
## Consequences
5556

@@ -60,11 +61,21 @@ reproducibility by comparing two clean generated-client builds with caching disa
6061
- Commands start at `server/`; deployable-only invocations target `application` after installing its
6162
reactor dependency.
6263
- Tooling addresses module-owned paths rather than the former monolithic source and output trees.
63-
- ADR 0001 remains valid for organizational nesting; this reactor adds an enforceable build-lifecycle
64-
boundary.
64+
- ADR 0001's rationale against organizational nesting remains applicable; this reactor adds an
65+
enforceable build-lifecycle boundary.
6566

6667
## Revisit when
6768

6869
Reconsider the mechanism if cache validation or reproducibility fails, cache transfer cost erases the
69-
measured gain, or Maven Build Cache support changes materially. Preserve the generated/application
70-
ownership boundary unless their lifecycles cease to differ.
70+
measured gain, or Maven Build Cache support changes materially. Re-test removal of the Relay wrapper
71+
cleanup when GraphQL Java Codegen is upgraded. Preserve the generated/application ownership boundary
72+
unless their lifecycles cease to differ.
73+
74+
## References
75+
76+
- [Issue #1527](https://github.com/ls1intum/Hephaestus/issues/1527) and
77+
[PR #1529](https://github.com/ls1intum/Hephaestus/pull/1529) contain the measurements and hosted
78+
observation record.
79+
- [Maven reactor builds](https://maven.apache.org/guides/mini/guide-multiple-modules.html)
80+
- [Maven Build Cache concepts](https://maven.apache.org/extensions/maven-build-cache-extension/concepts.html)
81+
- [Maven reproducible builds](https://maven.apache.org/guides/mini/guide-reproducible-builds.html)

docs/decisions/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ do, its home is the Admin Guide (`docs/admin/`) and the runbook links to it.
7070
| [0029](0029-measurement-intervention-seam-and-channel-levels.md) | Measurement and intervention are separate turns; a channel names where feedback lands, and its level follows | Accepted |
7171
| [0030](0030-agent-runtime-is-typescript-on-bun.md) | The agent runtime is TypeScript on Bun, with no Node in the sandbox | Accepted |
7272
| [0031](0031-agent-image-follows-the-deployments-own-tag.md) | The agent image reference follows the deployment's own image tag | Accepted |
73+
| [0032](0032-generated-clients-build-boundary.md) | Generated clients are a Maven build boundary | Accepted |
7374

7475
Template: [0000-template.md](0000-template.md).

0 commit comments

Comments
 (0)