docs(rules): fix contradictions, update technical rules, enforce rule structure
CI / CI configuration security checks (pull_request) Successful in 2s
CI / Capabilities and shell quality (pull_request) Successful in 15s
CI / Python tests and compilation (pull_request) Successful in 36s
CI / QMD unit tests (pull_request) Successful in 7s
CI / Build and inspect generated packages (pull_request) Successful in 16s
CI / Bash integration and installation guards (pull_request) Failing after 51s
CI / PowerShell tests on Ubuntu (pull_request) Failing after 1m45s
CI / Installed client configuration smoke tests (pull_request) Canceled after 1m24s

- Resolve contradictions: authorization is never a skipped "boundary check";
  one browser token policy (BFF/HttpOnly cookies first, RFC 10017); one
  sanitizer-bypass rule; Angular responses are unknown until validated.
- Add security rules for AI/LLM integration and Java XXE, concrete crypto
  and password-hashing parameters, and RFC 8725 JWT validation.
- Update version-dependent guidance after checking official sources:
  Angular 22, TypeScript 6/7, Node 24+, .NET 10/C# 14, JDK 21-25, Spring
  Boot 4; add a Spring Boot and Spring Security topic.
- Give every rule a unique level-1 title and scope line, keep language
  security files to language specifics, and fix routing for inbound vs
  outbound HTTP, XML parsing, and WPF/Angular parent rules.
- Validate rule structure and routing in validate-config.py, with tests.
- Fix CI issues found by a local run: shellcheck directive order, pinned
  ruff rule set, Invoke-Python test mock, CRLF-tolerant package checks,
  Windows-only credential test, and refreshed prompt-budget baselines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-05 10:51:08 +01:00
1 parent 79694fbaa2
commit 6159c6373c
62 files changed
+453 -300

No files matched your search

@@ -3,10 +3,13 @@
Apply these rules when changing executors, threads, futures, background work, or shared state.
* Choose synchronous, asynchronous, platform-thread, or virtual-thread execution for the actual workload and target Java release. Virtual threads suit many blocking I/O tasks; they do not accelerate CPU work.
* Create one virtual thread per task (`Executors.newVirtualThreadPerTaskExecutor()`); never pool virtual threads. Limit downstream concurrency with a `Semaphore`, not with a fixed pool size.
* On JDK 21 to 23, blocking inside `synchronized` pins the carrier thread; prefer `ReentrantLock` on hot blocking paths there. JDK 24+ (JEP 491) removes that pinning, but native frames and class initialization still pin.
* Do not cache expensive objects in `ThreadLocal` when running on virtual threads. On JDK 25+, prefer `ScopedValue` (final, JEP 506) for request-scoped context.
* Keep task lifetime owned by a request, service, or scoped executor. Close or shut down owned executors and handle completion, failure, timeout, and cancellation.
* Propagate interruption and cancellation. When catching `InterruptedException` without rethrowing it, restore the interrupt flag and stop work safely; do not turn cancellation into success.
* Bound queues, fan-out, and downstream calls. Virtual threads reduce thread cost but do not remove database, network, memory, or rate limits.
* Protect shared mutable state with clear ownership or suitable concurrency primitives. Do not assume `volatile` makes compound actions atomic.
* Avoid blocking joins inside unrelated executor tasks when they can exhaust a bounded pool. Use `CompletableFuture` or parallel streams only when their execution context and failure behavior are understood.
* Keep retries limited to transient failures, with bounded attempts and delay. Preserve idempotency and avoid retry multiplication across layers.
* Use preview concurrency APIs only when the project explicitly enables them for its target release.
* Use preview concurrency APIs only when the project explicitly enables them for its target release; `StructuredTaskScope` is still a preview API in JDK 25.