Microservice cross-cutting
Cross-cutting service rules: idempotency, timeouts, queues, observability.
Cross-cutting service rules that apply regardless of language — idempotency, timeouts, contract versioning, at-least-once delivery. Its concerns are distributed-systems failure modes any service can hit: calls without timeouts, non-idempotent message consumers, breaking API changes shipped without a version bump, dual writes with no outbox, PII leaking into logs and traces. This is the stack every service-* profile pulls in alongside its language-specific rules.
Which repositories get it
A repository on any of these 7 profiles: fullstack-react-node, service-dotnet, service-express, service-go, service-java, service-node, service-python. redline init detects the profile and --profile overrides it — see Profiles & stacks.
Within such a repository, a file gets these rules when it matches one of these globs:
**/*.java**/*.go**/*.py**/*.cssrc/**/*.tscmd/**internal/**services/**
The 17 rules
When a review comment cites one of these ids, this is where to look up what it catches. Of the 17, 6 BLOCKER, 8 HIGH and 3 SUGGESTION. A finding from this file opens like this:
Redline/BLOCKER [microservices/missing-timeout]: <one-line problem>What each severity obliges you to do is on The output contract.
| Rule id | Severity | Catches |
|---|---|---|
microservices/missing-timeout | BLOCKER | Outbound calls without timeouts. Every HTTP/gRPC/DB/queue call must have an explicit timeout; no infinite defaults. |
microservices/unversioned-breaking-change | BLOCKER | Breaking API changes without versioning. Removing/renaming fields, changing types, or tightening validation on a published API contract requires a version bump or an approved deprecation path. Additive changes only on existing versions. |
microservices/pii-in-telemetry | BLOCKER | PII in logs, traces, or metrics labels — MSISDN, email, account IDs, tokens. Log opaque IDs only. |
microservices/secrets-in-config | BLOCKER | Secrets in code, Dockerfiles, compose files, Helm values, or CI YAML — vault/secret-manager references only. |
microservices/non-idempotent-consumer | BLOCKER | Non-idempotent consumers/handlers for at-least-once delivery (Kafka, SQS, retries on POST). Duplicate delivery must not double-apply. |
microservices/swallowed-errors | BLOCKER | Swallowed errors — catch-and-ignore, error logged then treated as success, or error branch returning 200. |
microservices/retry-without-backoff | HIGH | Retries without backoff + jitter, or retrying non-idempotent operations. |
microservices/missing-circuit-breaker | HIGH | Missing circuit breaker / bulkhead on dependencies known to degrade (peer services, third parties). |
microservices/unauthenticated-endpoint | HIGH | New endpoint without authn/authz middleware — even "internal" services; do not trust the network. |
microservices/dual-write-no-outbox | HIGH | DB work and message publish in one logical step without outbox or equivalent — dual-write inconsistency. |
microservices/unbounded-work | HIGH | Unbounded work from external input: no pagination limits, unbounded batch sizes, unbounded payload accepted. |
microservices/readiness-liveness-conflated | HIGH | Missing health/readiness distinction: readiness must fail when dependencies are down; liveness must not. |
microservices/missing-trace-propagation | HIGH | New external call without propagating trace context / correlation ID. |
microservices/incompatible-migration | HIGH | Migration not backward-compatible with the currently deployed version (rename/drop column while old pods still run). |
microservices/undocumented-config | SUGGESTION | New config value without a sane default and documentation in the service README/values file. |
microservices/missing-metrics | SUGGESTION | Metrics for new critical paths (rate, errors, duration) missing. |
microservices/missing-dlq-handling | SUGGESTION | Consumer lag / DLQ handling absent on new consumers. |
Changing a rule
Edit standards/stacks/microservices.md and nowhere else. Every other copy is generated from it. A merged change reaches every onboarded repository as a pull request, so treat it as a production change.
Rule ids are permanent. Reword a rule freely; it keeps its id. Renaming or removing an id orphans every telemetry record that cited it.
- Edit the markdownstandards/ is the only place a human edits a rule. AGENTS.md, CLAUDE.md, .github/copilot-instructions.md and .github/instructions/ are rendered from it, and the next render overwrites any hand edit there.
- node scripts/assign-rule-ids.mjsAssigns a permanent <stack>/<slug> id to any new rule bullet and rewrites the file in place. Do not invent an id by hand. CI runs the same script with --check and fails if a rule is missing one.
- node scripts/render-self.mjsRe-renders this repository's own copies of those files. CI runs it with --check, so a stale copy fails the build.
- Bump standards/manifest.json → versionIn the same pull request as the rule change. Sync pull requests quote the version, so every repository can tell which standards it is on.
- Add a CHANGELOG.md entryAlso in the same pull request. Say what changed and why, and record the seed score: a standards change with no measurement is an opinion.
- node scripts/validate.mjsThe self-check CI runs: the manifest is consistent, rule ids are well formed, the output contract is intact, and every glob is one Copilot can read.
Related
- The output contract — what each severity obliges you to do.
- Profiles & stacks — how a repository ends up with a set of rules.
- Seeded corpus: microservices — the known-bad code that tests whether reviewers catch these rules.
- All standards
The full file
# Microservice Cross-Cutting Review Rules **Scope:** backend service code in any language. Applies in addition to the language-specific rules, never instead of them. Apply to all backend services regardless of language, in addition to the language-specific rules. ## BLOCKER — request changes - `microservices/missing-timeout` — **Outbound calls without timeouts.** Every HTTP/gRPC/DB/queue call must have an explicit timeout; no infinite defaults. - `microservices/unversioned-breaking-change` — **Breaking API changes without versioning.** Removing/renaming fields, changing types, or tightening validation on a published API contract requires a version bump or an approved deprecation path. Additive changes only on existing versions. - `microservices/pii-in-telemetry` — **PII in logs, traces, or metrics labels** — MSISDN, email, account IDs, tokens. Log opaque IDs only. - `microservices/secrets-in-config` — **Secrets in code, Dockerfiles, compose files, Helm values, or CI YAML** — vault/secret-manager references only. - `microservices/non-idempotent-consumer` — **Non-idempotent consumers/handlers for at-least-once delivery** (Kafka, SQS, retries on POST). Duplicate delivery must not double-apply. - `microservices/swallowed-errors` — **Swallowed errors** — catch-and-ignore, error logged then treated as success, or error branch returning 200. ## HIGH - `microservices/retry-without-backoff` — Retries without backoff + jitter, or retrying non-idempotent operations. - `microservices/missing-circuit-breaker` — Missing circuit breaker / bulkhead on dependencies known to degrade (peer services, third parties). - `microservices/unauthenticated-endpoint` — New endpoint without authn/authz middleware — even "internal" services; do not trust the network. - `microservices/dual-write-no-outbox` — DB work and message publish in one logical step without outbox or equivalent — dual-write inconsistency. - `microservices/unbounded-work` — Unbounded work from external input: no pagination limits, unbounded batch sizes, unbounded payload accepted. - `microservices/readiness-liveness-conflated` — Missing health/readiness distinction: readiness must fail when dependencies are down; liveness must not. - `microservices/missing-trace-propagation` — New external call without propagating trace context / correlation ID. - `microservices/incompatible-migration` — Migration not backward-compatible with the currently deployed version (rename/drop column while old pods still run). ## SUGGESTION - `microservices/undocumented-config` — New config value without a sane default and documentation in the service README/values file. - `microservices/missing-metrics` — Metrics for new critical paths (rate, errors, duration) missing. - `microservices/missing-dlq-handling` — Consumer lag / DLQ handling absent on new consumers. ## What NOT to flag - Existing contract shapes the PR does not modify. - Infrastructure choices (broker, DB engine) already established in the service.