@zigrivers/scaffold 3.15.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -12
- package/content/knowledge/backend/backend-fintech-broker-integration.md +244 -0
- package/content/knowledge/backend/backend-fintech-compliance.md +181 -0
- package/content/knowledge/backend/backend-fintech-data-modeling.md +210 -0
- package/content/knowledge/backend/backend-fintech-ledger.md +226 -0
- package/content/knowledge/backend/backend-fintech-observability.md +151 -0
- package/content/knowledge/backend/backend-fintech-order-lifecycle.md +213 -0
- package/content/knowledge/backend/backend-fintech-risk-management.md +150 -0
- package/content/knowledge/backend/backend-fintech-testing.md +197 -0
- package/content/knowledge/core/automated-review-tooling.md +31 -26
- package/content/knowledge/core/multi-model-review-dispatch.md +30 -55
- package/content/knowledge/core/multi-service-api-contracts.md +634 -0
- package/content/knowledge/core/multi-service-architecture.md +492 -0
- package/content/knowledge/core/multi-service-auth.md +706 -0
- package/content/knowledge/core/multi-service-data-ownership.md +539 -0
- package/content/knowledge/core/multi-service-observability.md +545 -0
- package/content/knowledge/core/multi-service-resilience.md +710 -0
- package/content/knowledge/core/multi-service-task-decomposition.md +615 -0
- package/content/knowledge/core/multi-service-testing.md +728 -0
- package/content/methodology/backend-fintech.yml +46 -0
- package/content/methodology/custom-defaults.yml +6 -0
- package/content/methodology/deep.yml +6 -0
- package/content/methodology/multi-service-overlay.yml +103 -0
- package/content/methodology/mvp.yml +6 -0
- package/content/pipeline/architecture/service-ownership-map.md +83 -0
- package/content/pipeline/quality/cross-service-auth.md +96 -0
- package/content/pipeline/quality/cross-service-observability.md +104 -0
- package/content/pipeline/quality/integration-test-plan.md +106 -0
- package/content/pipeline/specification/inter-service-contracts.md +95 -0
- package/content/tools/post-implementation-review.md +36 -7
- package/content/tools/review-code.md +33 -8
- package/content/tools/review-pr.md +79 -95
- package/dist/cli/commands/adopt.cli-flags.test.js +20 -0
- package/dist/cli/commands/adopt.cli-flags.test.js.map +1 -1
- package/dist/cli/commands/adopt.d.ts.map +1 -1
- package/dist/cli/commands/adopt.js +11 -3
- package/dist/cli/commands/adopt.js.map +1 -1
- package/dist/cli/commands/complete.d.ts +1 -0
- package/dist/cli/commands/complete.d.ts.map +1 -1
- package/dist/cli/commands/complete.js +26 -8
- package/dist/cli/commands/complete.js.map +1 -1
- package/dist/cli/commands/dashboard.d.ts +1 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -1
- package/dist/cli/commands/dashboard.js +19 -6
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/decisions.d.ts +1 -0
- package/dist/cli/commands/decisions.d.ts.map +1 -1
- package/dist/cli/commands/decisions.js +18 -4
- package/dist/cli/commands/decisions.js.map +1 -1
- package/dist/cli/commands/info.d.ts +1 -0
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +25 -3
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/init-from.test.d.ts +2 -0
- package/dist/cli/commands/init-from.test.d.ts.map +1 -0
- package/dist/cli/commands/init-from.test.js +315 -0
- package/dist/cli/commands/init-from.test.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +239 -129
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +20 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/next.d.ts +1 -0
- package/dist/cli/commands/next.d.ts.map +1 -1
- package/dist/cli/commands/next.js +40 -4
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/commands/next.test.js +151 -0
- package/dist/cli/commands/next.test.js.map +1 -1
- package/dist/cli/commands/reset.d.ts +1 -0
- package/dist/cli/commands/reset.d.ts.map +1 -1
- package/dist/cli/commands/reset.js +77 -29
- package/dist/cli/commands/reset.js.map +1 -1
- package/dist/cli/commands/rework.d.ts +1 -0
- package/dist/cli/commands/rework.d.ts.map +1 -1
- package/dist/cli/commands/rework.js +16 -2
- package/dist/cli/commands/rework.js.map +1 -1
- package/dist/cli/commands/run.d.ts +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +65 -13
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/run.test.js +192 -3
- package/dist/cli/commands/run.test.js.map +1 -1
- package/dist/cli/commands/skip.d.ts +1 -0
- package/dist/cli/commands/skip.d.ts.map +1 -1
- package/dist/cli/commands/skip.js +24 -7
- package/dist/cli/commands/skip.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +51 -4
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +128 -0
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/guards-coverage.test.d.ts +2 -0
- package/dist/cli/guards-coverage.test.d.ts.map +1 -0
- package/dist/cli/guards-coverage.test.js +26 -0
- package/dist/cli/guards-coverage.test.js.map +1 -0
- package/dist/cli/guards-integration.test.d.ts +2 -0
- package/dist/cli/guards-integration.test.d.ts.map +1 -0
- package/dist/cli/guards-integration.test.js +178 -0
- package/dist/cli/guards-integration.test.js.map +1 -0
- package/dist/cli/guards.d.ts +13 -0
- package/dist/cli/guards.d.ts.map +1 -0
- package/dist/cli/guards.js +70 -0
- package/dist/cli/guards.js.map +1 -0
- package/dist/cli/guards.test.d.ts +2 -0
- package/dist/cli/guards.test.d.ts.map +1 -0
- package/dist/cli/guards.test.js +136 -0
- package/dist/cli/guards.test.js.map +1 -0
- package/dist/cli/init-flag-families.d.ts +1 -1
- package/dist/cli/init-flag-families.d.ts.map +1 -1
- package/dist/cli/init-flag-families.js +4 -1
- package/dist/cli/init-flag-families.js.map +1 -1
- package/dist/cli/init-flag-families.test.js +10 -0
- package/dist/cli/init-flag-families.test.js.map +1 -1
- package/dist/cli/shutdown.d.ts +2 -3
- package/dist/cli/shutdown.d.ts.map +1 -1
- package/dist/cli/shutdown.js +14 -11
- package/dist/cli/shutdown.js.map +1 -1
- package/dist/cli/shutdown.test.js +2 -4
- package/dist/cli/shutdown.test.js.map +1 -1
- package/dist/config/schema.d.ts +12122 -288
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +74 -79
- package/dist/config/schema.js.map +1 -1
- package/dist/config/schema.test.js +230 -1
- package/dist/config/schema.test.js.map +1 -1
- package/dist/config/validators/backend.d.ts +4 -0
- package/dist/config/validators/backend.d.ts.map +1 -0
- package/dist/config/validators/backend.js +14 -0
- package/dist/config/validators/backend.js.map +1 -0
- package/dist/config/validators/browser-extension.d.ts +4 -0
- package/dist/config/validators/browser-extension.d.ts.map +1 -0
- package/dist/config/validators/browser-extension.js +24 -0
- package/dist/config/validators/browser-extension.js.map +1 -0
- package/dist/config/validators/cli.d.ts +4 -0
- package/dist/config/validators/cli.d.ts.map +1 -0
- package/dist/config/validators/cli.js +14 -0
- package/dist/config/validators/cli.js.map +1 -0
- package/dist/config/validators/data-pipeline.d.ts +4 -0
- package/dist/config/validators/data-pipeline.d.ts.map +1 -0
- package/dist/config/validators/data-pipeline.js +14 -0
- package/dist/config/validators/data-pipeline.js.map +1 -0
- package/dist/config/validators/game.d.ts +4 -0
- package/dist/config/validators/game.d.ts.map +1 -0
- package/dist/config/validators/game.js +14 -0
- package/dist/config/validators/game.js.map +1 -0
- package/dist/config/validators/index.d.ts +7 -0
- package/dist/config/validators/index.d.ts.map +1 -0
- package/dist/config/validators/index.js +27 -0
- package/dist/config/validators/index.js.map +1 -0
- package/dist/config/validators/library.d.ts +4 -0
- package/dist/config/validators/library.d.ts.map +1 -0
- package/dist/config/validators/library.js +25 -0
- package/dist/config/validators/library.js.map +1 -0
- package/dist/config/validators/ml.d.ts +4 -0
- package/dist/config/validators/ml.d.ts.map +1 -0
- package/dist/config/validators/ml.js +31 -0
- package/dist/config/validators/ml.js.map +1 -0
- package/dist/config/validators/mobile-app.d.ts +4 -0
- package/dist/config/validators/mobile-app.d.ts.map +1 -0
- package/dist/config/validators/mobile-app.js +14 -0
- package/dist/config/validators/mobile-app.js.map +1 -0
- package/dist/config/validators/registry.test.d.ts +2 -0
- package/dist/config/validators/registry.test.d.ts.map +1 -0
- package/dist/config/validators/registry.test.js +26 -0
- package/dist/config/validators/registry.test.js.map +1 -0
- package/dist/config/validators/research.d.ts +4 -0
- package/dist/config/validators/research.d.ts.map +1 -0
- package/dist/config/validators/research.js +24 -0
- package/dist/config/validators/research.js.map +1 -0
- package/dist/config/validators/research.test.d.ts +2 -0
- package/dist/config/validators/research.test.d.ts.map +1 -0
- package/dist/config/validators/research.test.js +44 -0
- package/dist/config/validators/research.test.js.map +1 -0
- package/dist/config/validators/types.d.ts +19 -0
- package/dist/config/validators/types.d.ts.map +1 -0
- package/dist/config/validators/types.js +2 -0
- package/dist/config/validators/types.js.map +1 -0
- package/dist/config/validators/validators.test.d.ts +2 -0
- package/dist/config/validators/validators.test.d.ts.map +1 -0
- package/dist/config/validators/validators.test.js +25 -0
- package/dist/config/validators/validators.test.js.map +1 -0
- package/dist/config/validators/web-app.d.ts +4 -0
- package/dist/config/validators/web-app.d.ts.map +1 -0
- package/dist/config/validators/web-app.js +31 -0
- package/dist/config/validators/web-app.js.map +1 -0
- package/dist/core/assembly/context-gatherer.d.ts.map +1 -1
- package/dist/core/assembly/context-gatherer.js +4 -2
- package/dist/core/assembly/context-gatherer.js.map +1 -1
- package/dist/core/assembly/cross-reads.d.ts +58 -0
- package/dist/core/assembly/cross-reads.d.ts.map +1 -0
- package/dist/core/assembly/cross-reads.js +185 -0
- package/dist/core/assembly/cross-reads.js.map +1 -0
- package/dist/core/assembly/cross-reads.test.d.ts +2 -0
- package/dist/core/assembly/cross-reads.test.d.ts.map +1 -0
- package/dist/core/assembly/cross-reads.test.js +383 -0
- package/dist/core/assembly/cross-reads.test.js.map +1 -0
- package/dist/core/assembly/overlay-loader-structural.test.d.ts +2 -0
- package/dist/core/assembly/overlay-loader-structural.test.d.ts.map +1 -0
- package/dist/core/assembly/overlay-loader-structural.test.js +114 -0
- package/dist/core/assembly/overlay-loader-structural.test.js.map +1 -0
- package/dist/core/assembly/overlay-loader.d.ts +17 -3
- package/dist/core/assembly/overlay-loader.d.ts.map +1 -1
- package/dist/core/assembly/overlay-loader.js +75 -0
- package/dist/core/assembly/overlay-loader.js.map +1 -1
- package/dist/core/assembly/overlay-resolver.d.ts +2 -2
- package/dist/core/assembly/overlay-resolver.d.ts.map +1 -1
- package/dist/core/assembly/overlay-resolver.js.map +1 -1
- package/dist/core/assembly/overlay-resolver.test.js.map +1 -1
- package/dist/core/assembly/overlay-state-resolver.d.ts +5 -0
- package/dist/core/assembly/overlay-state-resolver.d.ts.map +1 -1
- package/dist/core/assembly/overlay-state-resolver.js +41 -1
- package/dist/core/assembly/overlay-state-resolver.js.map +1 -1
- package/dist/core/assembly/overlay-state-resolver.test.js +262 -0
- package/dist/core/assembly/overlay-state-resolver.test.js.map +1 -1
- package/dist/core/assembly/update-mode.d.ts +1 -0
- package/dist/core/assembly/update-mode.d.ts.map +1 -1
- package/dist/core/assembly/update-mode.js +17 -9
- package/dist/core/assembly/update-mode.js.map +1 -1
- package/dist/core/dependency/eligibility.d.ts +10 -1
- package/dist/core/dependency/eligibility.d.ts.map +1 -1
- package/dist/core/dependency/eligibility.js +19 -1
- package/dist/core/dependency/eligibility.js.map +1 -1
- package/dist/core/dependency/eligibility.test.js +82 -0
- package/dist/core/dependency/eligibility.test.js.map +1 -1
- package/dist/core/dependency/graph.d.ts +4 -1
- package/dist/core/dependency/graph.d.ts.map +1 -1
- package/dist/core/dependency/graph.js +7 -1
- package/dist/core/dependency/graph.js.map +1 -1
- package/dist/core/dependency/graph.test.js +29 -0
- package/dist/core/dependency/graph.test.js.map +1 -1
- package/dist/core/pipeline/global-steps.d.ts +7 -0
- package/dist/core/pipeline/global-steps.d.ts.map +1 -0
- package/dist/core/pipeline/global-steps.js +18 -0
- package/dist/core/pipeline/global-steps.js.map +1 -0
- package/dist/core/pipeline/resolver.d.ts +1 -0
- package/dist/core/pipeline/resolver.d.ts.map +1 -1
- package/dist/core/pipeline/resolver.js +51 -6
- package/dist/core/pipeline/resolver.js.map +1 -1
- package/dist/core/pipeline/types.d.ts +5 -1
- package/dist/core/pipeline/types.d.ts.map +1 -1
- package/dist/e2e/cross-service-references.test.d.ts +22 -0
- package/dist/e2e/cross-service-references.test.d.ts.map +1 -0
- package/dist/e2e/cross-service-references.test.js +188 -0
- package/dist/e2e/cross-service-references.test.js.map +1 -0
- package/dist/e2e/multi-service-pipeline.test.d.ts +10 -0
- package/dist/e2e/multi-service-pipeline.test.d.ts.map +1 -0
- package/dist/e2e/multi-service-pipeline.test.js +185 -0
- package/dist/e2e/multi-service-pipeline.test.js.map +1 -0
- package/dist/e2e/project-type-overlays.test.js +68 -0
- package/dist/e2e/project-type-overlays.test.js.map +1 -1
- package/dist/e2e/service-execution.test.d.ts +15 -0
- package/dist/e2e/service-execution.test.d.ts.map +1 -0
- package/dist/e2e/service-execution.test.js +219 -0
- package/dist/e2e/service-execution.test.js.map +1 -0
- package/dist/e2e/service-manifest.test.d.ts +19 -0
- package/dist/e2e/service-manifest.test.d.ts.map +1 -0
- package/dist/e2e/service-manifest.test.js +166 -0
- package/dist/e2e/service-manifest.test.js.map +1 -0
- package/dist/project/__frozen-schemas__/schema-v3.9.2.d.ts +224 -224
- package/dist/project/frontmatter.d.ts.map +1 -1
- package/dist/project/frontmatter.js +11 -0
- package/dist/project/frontmatter.js.map +1 -1
- package/dist/project/frontmatter.test.js +71 -0
- package/dist/project/frontmatter.test.js.map +1 -1
- package/dist/state/completion.d.ts +1 -1
- package/dist/state/completion.d.ts.map +1 -1
- package/dist/state/completion.js +10 -8
- package/dist/state/completion.js.map +1 -1
- package/dist/state/decision-logger.d.ts +3 -2
- package/dist/state/decision-logger.d.ts.map +1 -1
- package/dist/state/decision-logger.js +12 -11
- package/dist/state/decision-logger.js.map +1 -1
- package/dist/state/ensure-v3-migration.d.ts +9 -0
- package/dist/state/ensure-v3-migration.d.ts.map +1 -0
- package/dist/state/ensure-v3-migration.js +35 -0
- package/dist/state/ensure-v3-migration.js.map +1 -0
- package/dist/state/lock-manager.d.ts +5 -4
- package/dist/state/lock-manager.d.ts.map +1 -1
- package/dist/state/lock-manager.js +11 -11
- package/dist/state/lock-manager.js.map +1 -1
- package/dist/state/rework-manager.d.ts +1 -2
- package/dist/state/rework-manager.d.ts.map +1 -1
- package/dist/state/rework-manager.js +4 -5
- package/dist/state/rework-manager.js.map +1 -1
- package/dist/state/state-manager.d.ts +25 -1
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +86 -12
- package/dist/state/state-manager.js.map +1 -1
- package/dist/state/state-manager.test.js +278 -0
- package/dist/state/state-manager.test.js.map +1 -1
- package/dist/state/state-migration-v3.d.ts +22 -0
- package/dist/state/state-migration-v3.d.ts.map +1 -0
- package/dist/state/state-migration-v3.js +82 -0
- package/dist/state/state-migration-v3.js.map +1 -0
- package/dist/state/state-migration-v3.test.d.ts +2 -0
- package/dist/state/state-migration-v3.test.d.ts.map +1 -0
- package/dist/state/state-migration-v3.test.js +196 -0
- package/dist/state/state-migration-v3.test.js.map +1 -0
- package/dist/state/state-migration.d.ts.map +1 -1
- package/dist/state/state-migration.js +11 -6
- package/dist/state/state-migration.js.map +1 -1
- package/dist/state/state-migration.test.js +47 -2
- package/dist/state/state-migration.test.js.map +1 -1
- package/dist/state/state-path-resolver.d.ts +23 -0
- package/dist/state/state-path-resolver.d.ts.map +1 -0
- package/dist/state/state-path-resolver.js +36 -0
- package/dist/state/state-path-resolver.js.map +1 -0
- package/dist/state/state-path-resolver.test.d.ts +2 -0
- package/dist/state/state-path-resolver.test.d.ts.map +1 -0
- package/dist/state/state-path-resolver.test.js +78 -0
- package/dist/state/state-path-resolver.test.js.map +1 -0
- package/dist/state/state-version-dispatch.d.ts +17 -0
- package/dist/state/state-version-dispatch.d.ts.map +1 -0
- package/dist/state/state-version-dispatch.js +27 -0
- package/dist/state/state-version-dispatch.js.map +1 -0
- package/dist/state/state-version-dispatch.test.d.ts +2 -0
- package/dist/state/state-version-dispatch.test.d.ts.map +1 -0
- package/dist/state/state-version-dispatch.test.js +40 -0
- package/dist/state/state-version-dispatch.test.js.map +1 -0
- package/dist/types/config.d.ts +25 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.test.js +13 -1
- package/dist/types/config.test.js.map +1 -1
- package/dist/types/dependency.d.ts +5 -0
- package/dist/types/dependency.d.ts.map +1 -1
- package/dist/types/frontmatter.d.ts +5 -0
- package/dist/types/frontmatter.d.ts.map +1 -1
- package/dist/types/lock.d.ts +1 -1
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/state.d.ts +1 -1
- package/dist/types/state.d.ts.map +1 -1
- package/dist/utils/artifact-path.d.ts +19 -0
- package/dist/utils/artifact-path.d.ts.map +1 -0
- package/dist/utils/artifact-path.js +95 -0
- package/dist/utils/artifact-path.js.map +1 -0
- package/dist/utils/artifact-path.test.d.ts +2 -0
- package/dist/utils/artifact-path.test.d.ts.map +1 -0
- package/dist/utils/artifact-path.test.js +138 -0
- package/dist/utils/artifact-path.test.js.map +1 -0
- package/dist/utils/errors.d.ts +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +5 -2
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/user-errors.d.ts +46 -0
- package/dist/utils/user-errors.d.ts.map +1 -0
- package/dist/utils/user-errors.js +76 -0
- package/dist/utils/user-errors.js.map +1 -0
- package/dist/utils/user-errors.test.d.ts +2 -0
- package/dist/utils/user-errors.test.d.ts.map +1 -0
- package/dist/utils/user-errors.test.js +74 -0
- package/dist/utils/user-errors.test.js.map +1 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +16 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/index.test.js +48 -0
- package/dist/validation/index.test.js.map +1 -1
- package/dist/validation/state-validator.d.ts +5 -2
- package/dist/validation/state-validator.d.ts.map +1 -1
- package/dist/validation/state-validator.js +18 -20
- package/dist/validation/state-validator.js.map +1 -1
- package/dist/validation/state-validator.test.js +31 -2
- package/dist/validation/state-validator.test.js.map +1 -1
- package/dist/wizard/copy/backend.d.ts.map +1 -1
- package/dist/wizard/copy/backend.js +12 -0
- package/dist/wizard/copy/backend.js.map +1 -1
- package/dist/wizard/flags.d.ts +1 -0
- package/dist/wizard/flags.d.ts.map +1 -1
- package/dist/wizard/questions.d.ts.map +1 -1
- package/dist/wizard/questions.js +5 -1
- package/dist/wizard/questions.js.map +1 -1
- package/dist/wizard/questions.test.js +45 -2
- package/dist/wizard/questions.test.js.map +1 -1
- package/dist/wizard/wizard.d.ts +23 -0
- package/dist/wizard/wizard.d.ts.map +1 -1
- package/dist/wizard/wizard.js +85 -47
- package/dist/wizard/wizard.js.map +1 -1
- package/dist/wizard/wizard.test.js +186 -1
- package/dist/wizard/wizard.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: multi-service-task-decomposition
|
|
3
|
+
description: Breaking multi-service work into per-service implementation waves
|
|
4
|
+
topics: [per-service-waves, dependency-ordering, parallel-implementation, shared-infrastructure-first]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
Multi-service implementation fails predictably when teams try to build everything in parallel without a dependency plan, or when they serialize everything and lose the parallelism that multi-service architecture is supposed to enable. The solution is structured wave planning.
|
|
10
|
+
|
|
11
|
+
**Wave 0 — Shared infrastructure first (sequential, all teams):** Service scaffold template, shared TypeScript types, auth middleware, observability setup, database migration runner, CI pipeline. No service work begins until Wave 0 completes. Keep this wave minimal — if it takes more than two weeks, it is over-scoped.
|
|
12
|
+
|
|
13
|
+
**Contract-first development:** For each inter-service integration, produce a machine-readable contract (OpenAPI spec or event schema) before writing any implementation code. Both teams review and ratify the contract. Then implement in parallel — provider builds the real endpoint; consumer implements against a generated stub or mock.
|
|
14
|
+
|
|
15
|
+
**Per-service internal waves (A–D):**
|
|
16
|
+
- Wave A: Database schema, domain models, repositories (no external dependencies)
|
|
17
|
+
- Wave B: Core business logic, event publishing, unit tests
|
|
18
|
+
- Wave C: HTTP controllers, auth integration, endpoint integration tests
|
|
19
|
+
- Wave D: Downstream service clients, inbound event consumers, contract tests
|
|
20
|
+
|
|
21
|
+
**Cross-service integration milestones** are explicit synchronization gates:
|
|
22
|
+
- Milestone 1 (after Wave C): All services pass contract tests against stubs and expose `/health`.
|
|
23
|
+
- Milestone 2 (after shared test environment deploy): End-to-end happy path works with real services.
|
|
24
|
+
- Milestone 3 (before production): Load tested, circuit breakers validated, runbooks written.
|
|
25
|
+
|
|
26
|
+
**Release ordering:** Leaf services (no upstream dependencies) release first. Services with dependencies release after their dependencies are live. Use expand-contract for breaking changes and feature flags to decouple deployment from release.
|
|
27
|
+
|
|
28
|
+
## Deep Guidance
|
|
29
|
+
|
|
30
|
+
## Shared Infrastructure First
|
|
31
|
+
|
|
32
|
+
Before any service-specific work begins, the infrastructure that all services share must exist. Building shared infrastructure after services start causes rework — services make assumptions about auth, observability, and database patterns that must be retrofitted when the shared layer is added.
|
|
33
|
+
|
|
34
|
+
### What Belongs in the Shared Infrastructure Wave
|
|
35
|
+
|
|
36
|
+
The shared infrastructure wave covers anything that two or more services will import, depend on, or integrate with:
|
|
37
|
+
|
|
38
|
+
- **Service scaffold**: The project template that each service starts from — runtime, framework, logging configuration, health check endpoint, graceful shutdown handler.
|
|
39
|
+
- **Auth middleware**: JWT validation, service token extraction, role/permission checking. Every service needs this from day one.
|
|
40
|
+
- **Shared type contracts**: TypeScript types (or protobuf definitions) for events, error shapes, and API response envelopes that cross service boundaries.
|
|
41
|
+
- **Observability instrumentation**: Structured logging setup, distributed trace context propagation (`x-trace-id`, `x-request-id`), metrics client initialization.
|
|
42
|
+
- **Database migration infrastructure**: The migration runner and migration table — not the schema itself, but the mechanism.
|
|
43
|
+
- **Test infrastructure**: Integration test helpers, database test fixtures, service client mocks.
|
|
44
|
+
- **CI pipeline**: Build, lint, test stages that run on every push to every service repository.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Wave 0: Shared Infrastructure (sequential — each item may unblock others)
|
|
48
|
+
0-A: Service scaffold template (unblocks: all per-service waves)
|
|
49
|
+
0-B: Shared TypeScript types package (unblocks: API contract work)
|
|
50
|
+
0-C: Auth middleware + JWT validation (unblocks: any auth-protected endpoint)
|
|
51
|
+
0-D: Observability setup (logging + trace propagation) (unblocks: debuggable work)
|
|
52
|
+
0-E: Database migration runner (unblocks: all schema work)
|
|
53
|
+
0-F: CI pipeline configuration (unblocks: parallel development with confidence)
|
|
54
|
+
|
|
55
|
+
Wave 1+: Per-service implementation (parallel across services)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Trade-offs:**
|
|
59
|
+
- (+) Services start from a consistent, tested base. No service implements its own JWT parser or log formatter.
|
|
60
|
+
- (+) Cross-cutting bugs (a wrong trace header format, a broken auth check) are fixed once in the shared layer, not six times across six services.
|
|
61
|
+
- (-) The shared wave is a bottleneck — no service work can start until it completes. Keep the wave minimal. If "shared infrastructure" takes four weeks, the plan is over-scoped.
|
|
62
|
+
- (-) Shared code creates coupling. When the shared types package changes, all consumers must update. Use semantic versioning and publish as a versioned package.
|
|
63
|
+
|
|
64
|
+
## Contract-First Development Workflow
|
|
65
|
+
|
|
66
|
+
Contracts are the interface definitions between services: HTTP API schemas, event schemas, and gRPC proto files. Writing contracts before implementations enables parallel development — two teams can build against the same contract simultaneously.
|
|
67
|
+
|
|
68
|
+
### Step 1: Define the Contract
|
|
69
|
+
|
|
70
|
+
For each inter-service integration, produce a machine-readable contract before writing any implementation code:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
# order-service/contracts/inventory-availability.yaml
|
|
74
|
+
# OpenAPI fragment describing what order-service needs from inventory-service
|
|
75
|
+
|
|
76
|
+
openapi: "3.0.3"
|
|
77
|
+
info:
|
|
78
|
+
title: Inventory Availability — used by Order Service
|
|
79
|
+
version: "1.0.0"
|
|
80
|
+
paths:
|
|
81
|
+
/inventory/check:
|
|
82
|
+
post:
|
|
83
|
+
operationId: checkAvailability
|
|
84
|
+
requestBody:
|
|
85
|
+
required: true
|
|
86
|
+
content:
|
|
87
|
+
application/json:
|
|
88
|
+
schema:
|
|
89
|
+
type: object
|
|
90
|
+
required: [items]
|
|
91
|
+
properties:
|
|
92
|
+
items:
|
|
93
|
+
type: array
|
|
94
|
+
items:
|
|
95
|
+
type: object
|
|
96
|
+
required: [productId, quantity]
|
|
97
|
+
properties:
|
|
98
|
+
productId:
|
|
99
|
+
type: string
|
|
100
|
+
format: uuid
|
|
101
|
+
quantity:
|
|
102
|
+
type: integer
|
|
103
|
+
minimum: 1
|
|
104
|
+
responses:
|
|
105
|
+
"200":
|
|
106
|
+
content:
|
|
107
|
+
application/json:
|
|
108
|
+
schema:
|
|
109
|
+
type: object
|
|
110
|
+
required: [available, items]
|
|
111
|
+
properties:
|
|
112
|
+
available:
|
|
113
|
+
type: boolean
|
|
114
|
+
items:
|
|
115
|
+
type: array
|
|
116
|
+
items:
|
|
117
|
+
type: object
|
|
118
|
+
required: [productId, available, quantityOnHand]
|
|
119
|
+
properties:
|
|
120
|
+
productId:
|
|
121
|
+
type: string
|
|
122
|
+
available:
|
|
123
|
+
type: boolean
|
|
124
|
+
quantityOnHand:
|
|
125
|
+
type: integer
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
For async event contracts, define the event schema in the shared types package:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
// packages/shared-types/src/events/order.ts
|
|
132
|
+
|
|
133
|
+
export interface OrderPlacedEvent {
|
|
134
|
+
eventType: 'order.placed';
|
|
135
|
+
eventId: string; // UUID — for deduplication
|
|
136
|
+
occurredAt: string; // ISO 8601
|
|
137
|
+
version: number; // Schema version — increment on breaking change
|
|
138
|
+
payload: {
|
|
139
|
+
orderId: string;
|
|
140
|
+
customerId: string;
|
|
141
|
+
items: Array<{
|
|
142
|
+
productId: string;
|
|
143
|
+
quantity: number;
|
|
144
|
+
unitPriceCents: number;
|
|
145
|
+
}>;
|
|
146
|
+
totalCents: number;
|
|
147
|
+
currency: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface OrderCancelledEvent {
|
|
152
|
+
eventType: 'order.cancelled';
|
|
153
|
+
eventId: string;
|
|
154
|
+
occurredAt: string;
|
|
155
|
+
version: number;
|
|
156
|
+
payload: {
|
|
157
|
+
orderId: string;
|
|
158
|
+
customerId: string;
|
|
159
|
+
reason: 'customer_request' | 'payment_failure' | 'inventory_unavailable';
|
|
160
|
+
cancelledAt: string;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Step 2: Review and Ratify the Contract
|
|
166
|
+
|
|
167
|
+
The teams on both sides of the contract must agree before implementation begins. Common review points:
|
|
168
|
+
|
|
169
|
+
- Is the request payload minimal? Avoid sending data the consumer won't use.
|
|
170
|
+
- Are response fields nullable or optional fields documented as such?
|
|
171
|
+
- Does the error shape match the standard envelope used across all services?
|
|
172
|
+
- Are event schema fields sufficient for all known consumers?
|
|
173
|
+
|
|
174
|
+
Ratification can be async (a PR comment approval), but it must be explicit. Contract changes after ratification require a new version.
|
|
175
|
+
|
|
176
|
+
### Step 3: Implement in Parallel
|
|
177
|
+
|
|
178
|
+
Once contracts are ratified, both the provider and consumer can implement simultaneously:
|
|
179
|
+
|
|
180
|
+
- The **provider** implements the real endpoint or event publisher, verified by its own unit and integration tests.
|
|
181
|
+
- The **consumer** implements against a generated stub or mock, verified by consumer-side contract tests.
|
|
182
|
+
|
|
183
|
+
Integration is deferred to the integration milestone, not day-to-day development.
|
|
184
|
+
|
|
185
|
+
**Trade-offs:**
|
|
186
|
+
- (+) Parallel development becomes possible without any real service running.
|
|
187
|
+
- (+) Contract reviews surface design problems early — a missing required field is caught in review, not at integration.
|
|
188
|
+
- (-) Contracts require discipline. If teams skip the ratification step and start implementing simultaneously against unreviewed contracts, they diverge and must reconcile later.
|
|
189
|
+
- (-) Contract changes trigger consumer notifications. Maintaining a contract registry (e.g., Pact Broker, OpenAPI registry) is overhead that pays off at 5+ services.
|
|
190
|
+
|
|
191
|
+
## Stub and Mock-Driven Parallel Implementation
|
|
192
|
+
|
|
193
|
+
A stub is a lightweight implementation of a service's API that returns realistic test data. It enables consumers to develop and test against the contract without waiting for the real service.
|
|
194
|
+
|
|
195
|
+
### Generating Stubs from Contracts
|
|
196
|
+
|
|
197
|
+
For REST services, generate a stub server from the OpenAPI spec:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// scripts/generate-stubs.ts
|
|
201
|
+
// Reads OpenAPI specs from contracts/ and generates a stub server per service
|
|
202
|
+
|
|
203
|
+
import { createServer } from 'prism';
|
|
204
|
+
import path from 'path';
|
|
205
|
+
|
|
206
|
+
const stubs = [
|
|
207
|
+
{ name: 'inventory-service', spec: 'contracts/inventory-availability.yaml', port: 4001 },
|
|
208
|
+
{ name: 'user-service', spec: 'contracts/user-profile.yaml', port: 4002 },
|
|
209
|
+
{ name: 'notification-service', spec: 'contracts/notification-dispatch.yaml', port: 4003 },
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
async function startStubs() {
|
|
213
|
+
for (const stub of stubs) {
|
|
214
|
+
const server = await createServer(path.resolve(stub.spec), {
|
|
215
|
+
mock: { dynamic: true }, // Generates realistic mock data from schema
|
|
216
|
+
port: stub.port,
|
|
217
|
+
});
|
|
218
|
+
console.log(`Stub ${stub.name} running on :${stub.port}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
startStubs();
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
In the consumer service's integration test configuration, point at the stub server instead of the real service:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// order-service/tests/helpers/test-env.ts
|
|
229
|
+
|
|
230
|
+
export const TEST_SERVICE_URLS = {
|
|
231
|
+
inventoryService: process.env.INVENTORY_SERVICE_URL ?? 'http://localhost:4001',
|
|
232
|
+
userService: process.env.USER_SERVICE_URL ?? 'http://localhost:4002',
|
|
233
|
+
notificationService: process.env.NOTIFICATION_SERVICE_URL ?? 'http://localhost:4003',
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// In CI: stubs run as Docker containers, URLs set via env vars
|
|
237
|
+
// In local dev: run `npm run stubs` to start stub servers
|
|
238
|
+
// In integration tests (post-stub): URLs point at real services in a test environment
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Consumer-Driven Contract Tests
|
|
242
|
+
|
|
243
|
+
Consumer-driven contract tests encode what the consumer expects from the provider. These tests run in the provider's CI and fail if the provider breaks a consumer's expectations:
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
// order-service/tests/contracts/inventory.contract.test.ts
|
|
247
|
+
// This file lives in the consumer (order-service) but runs in the provider's (inventory-service) CI
|
|
248
|
+
|
|
249
|
+
import { Pact } from '@pact-foundation/pact';
|
|
250
|
+
|
|
251
|
+
describe('Order Service → Inventory Service contract', () => {
|
|
252
|
+
const provider = new Pact({
|
|
253
|
+
consumer: 'order-service',
|
|
254
|
+
provider: 'inventory-service',
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
beforeAll(() => provider.setup());
|
|
258
|
+
afterAll(() => provider.finalize());
|
|
259
|
+
afterEach(() => provider.verify());
|
|
260
|
+
|
|
261
|
+
it('returns availability for all requested items', async () => {
|
|
262
|
+
await provider.addInteraction({
|
|
263
|
+
state: 'product prod_abc123 has 5 units available',
|
|
264
|
+
uponReceiving: 'a check-availability request for 2 units',
|
|
265
|
+
withRequest: {
|
|
266
|
+
method: 'POST',
|
|
267
|
+
path: '/inventory/check',
|
|
268
|
+
body: { items: [{ productId: 'prod_abc123', quantity: 2 }] },
|
|
269
|
+
},
|
|
270
|
+
willRespondWith: {
|
|
271
|
+
status: 200,
|
|
272
|
+
body: {
|
|
273
|
+
available: true,
|
|
274
|
+
items: [{ productId: 'prod_abc123', available: true, quantityOnHand: 5 }],
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
const result = await inventoryClient.checkAvailability([
|
|
280
|
+
{ productId: 'prod_abc123', quantity: 2 },
|
|
281
|
+
]);
|
|
282
|
+
|
|
283
|
+
expect(result.available).toBe(true);
|
|
284
|
+
expect(result.items[0].quantityOnHand).toBe(5);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Trade-offs (stub-driven development):**
|
|
290
|
+
- (+) Each service team moves at full speed without blocking on another team's implementation schedule.
|
|
291
|
+
- (+) Contract tests in provider CI catch breaking changes before they reach a shared environment.
|
|
292
|
+
- (-) Stubs return static or schema-generated data. Complex business logic (e.g., "available quantity decreases as orders are placed") cannot be modeled in stubs. Real integration testing is still required.
|
|
293
|
+
- (-) Stubs can drift from the real implementation if the provider team doesn't keep the OpenAPI spec current. Enforce spec-first: the spec is the source of truth, implementation follows.
|
|
294
|
+
|
|
295
|
+
## Per-Service Implementation Waves
|
|
296
|
+
|
|
297
|
+
Once shared infrastructure exists and contracts are ratified, each service is implemented in internal waves.
|
|
298
|
+
|
|
299
|
+
### Service-Level Wave Structure
|
|
300
|
+
|
|
301
|
+
Each service follows the same internal wave structure regardless of domain:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Service-Internal Wave A: Foundation (no external dependencies)
|
|
305
|
+
A-1: Database schema + migrations
|
|
306
|
+
A-2: Domain models + validation
|
|
307
|
+
A-3: Repository / data access layer
|
|
308
|
+
A-4: Unit tests for models and validation
|
|
309
|
+
|
|
310
|
+
Service-Internal Wave B: Core operations (depends on Wave A)
|
|
311
|
+
B-1: Core business logic (services / use cases)
|
|
312
|
+
B-2: Internal event publishing (domain events → message bus)
|
|
313
|
+
B-3: Unit tests for business logic
|
|
314
|
+
|
|
315
|
+
Service-Internal Wave C: API surface (depends on Wave B)
|
|
316
|
+
C-1: HTTP controllers + request validation
|
|
317
|
+
C-2: Auth middleware integration
|
|
318
|
+
C-3: Error handling + response serialization
|
|
319
|
+
C-4: Integration tests for all endpoints
|
|
320
|
+
|
|
321
|
+
Service-Internal Wave D: External integrations (depends on Wave B contracts)
|
|
322
|
+
D-1: Downstream service clients (using stubs in tests)
|
|
323
|
+
D-2: Inbound event consumers (from other services' events)
|
|
324
|
+
D-3: Consumer contract tests
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Cross-Service Wave Ordering
|
|
328
|
+
|
|
329
|
+
When multiple services are built in parallel, their internal waves must align at integration milestones:
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
Month 1 — Shared Infrastructure (Wave 0, all teams)
|
|
333
|
+
All: scaffold, auth middleware, shared types, CI
|
|
334
|
+
|
|
335
|
+
Month 2 — Per-service Foundation Waves (A + B, teams parallel)
|
|
336
|
+
Order Service: DB schema, domain models, core business logic
|
|
337
|
+
Inventory Service: DB schema, domain models, stock management logic
|
|
338
|
+
User Service: DB schema, domain models, profile management
|
|
339
|
+
Notification Service: DB schema, domain models, dispatch logic
|
|
340
|
+
|
|
341
|
+
Month 3 — Per-service API + Stub-based Integration (Wave C + D, teams parallel)
|
|
342
|
+
All services: HTTP controllers, auth, integration tests against stubs
|
|
343
|
+
→ Integration Milestone 1: All services pass contract tests against stubs
|
|
344
|
+
|
|
345
|
+
Month 4 — Real Integration (Wave E, shared test environment)
|
|
346
|
+
All: deploy to shared test environment
|
|
347
|
+
All: run integration tests against real services (not stubs)
|
|
348
|
+
→ Integration Milestone 2: End-to-end happy path works in test environment
|
|
349
|
+
|
|
350
|
+
Month 5 — Hardening + Release Prep
|
|
351
|
+
All: load testing, circuit breaker tuning, graceful degradation
|
|
352
|
+
→ Integration Milestone 3: Production-ready — passes all gates
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Practical tracking format for cross-service waves:**
|
|
356
|
+
|
|
357
|
+
```markdown
|
|
358
|
+
## Wave B Status (Core Operations) — Target: End of Month 2
|
|
359
|
+
|
|
360
|
+
| Service | B-1 Business Logic | B-2 Event Publishing | B-3 Unit Tests | Wave B Complete |
|
|
361
|
+
|---------------------|:------------------:|:--------------------:|:--------------:|:---------------:|
|
|
362
|
+
| order-service | ✅ Done | ✅ Done | ✅ Done | ✅ |
|
|
363
|
+
| inventory-service | ✅ Done | 🔄 In Progress | 🔄 In Progress | ⏳ |
|
|
364
|
+
| user-service | ✅ Done | ✅ Done | ✅ Done | ✅ |
|
|
365
|
+
| notification-service| 🔄 In Progress | ⬜ Not started | ⬜ Not started | ⏳ |
|
|
366
|
+
|
|
367
|
+
Blockers:
|
|
368
|
+
- inventory-service B-2: waiting on shared event bus topic naming convention (Wave 0-B, shared types)
|
|
369
|
+
- notification-service: team bandwidth — estimated completion 3 days late
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Integration Milestones
|
|
373
|
+
|
|
374
|
+
Integration milestones are explicit synchronization points where all services must pass a shared set of tests before work continues. They prevent a common failure mode: services that pass their individual tests but fail when integrated because contracts drifted or assumptions don't hold.
|
|
375
|
+
|
|
376
|
+
### Milestone 1: Contract Compliance
|
|
377
|
+
|
|
378
|
+
**When:** After each service completes Wave C (API surface with integration tests).
|
|
379
|
+
|
|
380
|
+
**Gate criteria:**
|
|
381
|
+
- All services pass their own integration tests (against stubs).
|
|
382
|
+
- Consumer contract tests pass for every provider-consumer pair.
|
|
383
|
+
- Every service returns the standard error envelope shape.
|
|
384
|
+
- Every service exposes `/health` and returns 200 with a structured health payload.
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# Milestone 1 validation script
|
|
388
|
+
#!/usr/bin/env bash
|
|
389
|
+
set -euo pipefail
|
|
390
|
+
|
|
391
|
+
SERVICES=(order-service inventory-service user-service notification-service)
|
|
392
|
+
FAILED=()
|
|
393
|
+
|
|
394
|
+
for service in "${SERVICES[@]}"; do
|
|
395
|
+
echo "=== Checking $service ==="
|
|
396
|
+
|
|
397
|
+
# Run integration tests
|
|
398
|
+
if ! cd "services/$service" && npm test -- --testPathPattern=integration; then
|
|
399
|
+
FAILED+=("$service: integration tests failed")
|
|
400
|
+
fi
|
|
401
|
+
|
|
402
|
+
# Validate health endpoint exists and returns 200
|
|
403
|
+
if ! curl -sf "http://localhost:$(get_port "$service")/health" > /dev/null; then
|
|
404
|
+
FAILED+=("$service: health endpoint unavailable")
|
|
405
|
+
fi
|
|
406
|
+
|
|
407
|
+
# Run consumer contract tests for this provider
|
|
408
|
+
if ! npm run test:contracts -- --provider="$service"; then
|
|
409
|
+
FAILED+=("$service: consumer contract tests failed")
|
|
410
|
+
fi
|
|
411
|
+
done
|
|
412
|
+
|
|
413
|
+
if [[ ${#FAILED[@]} -gt 0 ]]; then
|
|
414
|
+
echo "Milestone 1 FAILED:"
|
|
415
|
+
printf " - %s\n" "${FAILED[@]}"
|
|
416
|
+
exit 1
|
|
417
|
+
fi
|
|
418
|
+
|
|
419
|
+
echo "Milestone 1 PASSED — all services contract-compliant"
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Milestone 2: Real Integration
|
|
423
|
+
|
|
424
|
+
**When:** After all services are deployed to a shared test environment.
|
|
425
|
+
|
|
426
|
+
**Gate criteria:**
|
|
427
|
+
- All end-to-end happy-path flows complete successfully.
|
|
428
|
+
- Event-driven flows (e.g., order placed → inventory reserved → notification sent) complete within their SLAs.
|
|
429
|
+
- No unhandled errors in structured logs across any service.
|
|
430
|
+
- Distributed traces show correct parent-child span relationships.
|
|
431
|
+
|
|
432
|
+
### Milestone 3: Production Readiness
|
|
433
|
+
|
|
434
|
+
**When:** Before any service goes to production.
|
|
435
|
+
|
|
436
|
+
**Gate criteria:**
|
|
437
|
+
- Load test: each service handles 2× expected peak traffic without errors.
|
|
438
|
+
- Circuit breakers open under artificial load, close on recovery.
|
|
439
|
+
- Graceful degradation works: stopping one service does not bring down dependent services.
|
|
440
|
+
- Runbooks exist for every on-call scenario identified in the architecture review.
|
|
441
|
+
- Secrets are managed via the approved secret store (not `.env` files).
|
|
442
|
+
|
|
443
|
+
**Trade-offs (integration milestones):**
|
|
444
|
+
- (+) Milestones create shared accountability. A team cannot declare itself "done" while its contracts fail the provider's tests.
|
|
445
|
+
- (+) Problems are found while teams still remember what they built. Integration failures discovered a month after implementation are expensive to debug.
|
|
446
|
+
- (-) Milestone gates slow down the fast-moving teams that are ahead of schedule. Mitigate by allowing ahead-of-schedule teams to begin hardening (load testing, observability tuning) while waiting for others.
|
|
447
|
+
|
|
448
|
+
## Dependency Ordering for Parallel Development
|
|
449
|
+
|
|
450
|
+
When services depend on each other's data or events, the dependency ordering determines which can start before others.
|
|
451
|
+
|
|
452
|
+
### Mapping Service Dependencies
|
|
453
|
+
|
|
454
|
+
Before planning waves, build a dependency map:
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
Dependency analysis:
|
|
458
|
+
|
|
459
|
+
order-service READS FROM:
|
|
460
|
+
→ user-service (customer profile, shipping address) [sync REST call]
|
|
461
|
+
→ inventory-service (product availability) [sync REST call]
|
|
462
|
+
→ catalog-service (product details, pricing) [sync REST call]
|
|
463
|
+
|
|
464
|
+
order-service PUBLISHES:
|
|
465
|
+
→ order.placed event (consumed by: inventory-service, notification-service)
|
|
466
|
+
→ order.cancelled event (consumed by: inventory-service, notification-service)
|
|
467
|
+
|
|
468
|
+
inventory-service READS FROM:
|
|
469
|
+
→ catalog-service (product definitions) [sync REST call]
|
|
470
|
+
|
|
471
|
+
inventory-service PUBLISHES:
|
|
472
|
+
→ inventory.reserved event (consumed by: order-service)
|
|
473
|
+
→ inventory.released event (consumed by: order-service)
|
|
474
|
+
|
|
475
|
+
notification-service READS FROM:
|
|
476
|
+
→ user-service (notification preferences, contact info) [sync REST call]
|
|
477
|
+
|
|
478
|
+
notification-service CONSUMES:
|
|
479
|
+
→ order.placed, order.cancelled (from order-service)
|
|
480
|
+
→ inventory.reserved, inventory.released (from inventory-service)
|
|
481
|
+
|
|
482
|
+
catalog-service: no upstream service dependencies (leaf service)
|
|
483
|
+
user-service: no upstream service dependencies (leaf service)
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Parallelism from the Dependency Map
|
|
487
|
+
|
|
488
|
+
Services with no upstream dependencies are leaf services and can start immediately. Services with dependencies can start development (using stubs) but cannot complete real integration until their dependencies are live:
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
Can start immediately (no real upstream dependencies):
|
|
492
|
+
✅ catalog-service — no dependencies
|
|
493
|
+
✅ user-service — no dependencies
|
|
494
|
+
|
|
495
|
+
Can develop with stubs, integrate after catalog + user are live:
|
|
496
|
+
⏳ inventory-service — depends on catalog-service (real integration)
|
|
497
|
+
⏳ notification-service — depends on user-service (real integration)
|
|
498
|
+
|
|
499
|
+
Can develop with stubs, integrates last:
|
|
500
|
+
⏳ order-service — depends on user, inventory, catalog
|
|
501
|
+
|
|
502
|
+
Optimal parallel development order:
|
|
503
|
+
Week 1-6: catalog-service + user-service (parallel, no dependencies)
|
|
504
|
+
Week 3-8: inventory-service + notification-service (parallel, stubs for catalog/user)
|
|
505
|
+
Week 5-10: order-service (stubs for inventory/catalog/user)
|
|
506
|
+
Week 9-12: Integration Milestones 1 + 2 + 3 (sequential gates)
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Note the overlap: inventory-service starts in week 3 (using stubs), not after catalog-service completes (week 6). This is the key efficiency gain from contract-first + stub-driven development.
|
|
510
|
+
|
|
511
|
+
## Release Coordination Strategies
|
|
512
|
+
|
|
513
|
+
Releasing multiple services to production without a coordination strategy causes integration failures in production that were not present in test.
|
|
514
|
+
|
|
515
|
+
### Release Ordering Rules
|
|
516
|
+
|
|
517
|
+
Release services in reverse dependency order — leaf services first, dependent services last:
|
|
518
|
+
|
|
519
|
+
```
|
|
520
|
+
Release order (example):
|
|
521
|
+
Release 1: catalog-service + user-service (no dependencies — safe to release any time)
|
|
522
|
+
Release 2: inventory-service (depends on catalog; released after catalog is live)
|
|
523
|
+
notification-service (depends on user; released after user is live)
|
|
524
|
+
Release 3: order-service (depends on all above; released last)
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Consumer-Before-Provider Releases (Expand-Contract)
|
|
528
|
+
|
|
529
|
+
When a contract change is required, use the expand-contract pattern to deploy without downtime:
|
|
530
|
+
|
|
531
|
+
```
|
|
532
|
+
Phase 1 — Expand (consumer adds support for new field, provider adds new field):
|
|
533
|
+
1a. Provider adds new field to response (backward-compatible addition)
|
|
534
|
+
1b. Consumer adds code to handle the new field when present
|
|
535
|
+
1c. Deploy provider first, then consumer — no coordination required
|
|
536
|
+
|
|
537
|
+
Phase 2 — Contract (remove old field once consumers are updated):
|
|
538
|
+
2a. Monitor: verify consumer no longer reads old field
|
|
539
|
+
2b. Provider removes old field (breaking change — now safe because no consumer uses it)
|
|
540
|
+
2c. Deploy provider — consumers already prepared for absence of old field
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
```typescript
|
|
544
|
+
// Phase 1b: consumer handles both old and new field shapes
|
|
545
|
+
function parseInventoryResponse(response: InventoryResponse): AvailabilityResult {
|
|
546
|
+
return {
|
|
547
|
+
available: response.available,
|
|
548
|
+
quantityOnHand: response.quantityOnHand, // new field — may be present or absent
|
|
549
|
+
// Legacy fallback: some providers may still return the old shape during rollout
|
|
550
|
+
quantity: response.quantityOnHand ?? response.quantity ?? 0,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Feature Flags for Cross-Service Features
|
|
556
|
+
|
|
557
|
+
When a feature requires coordinated changes across multiple services, use feature flags to decouple deployment from release:
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
// Feature flag: 'real-time-inventory-check' enables new inventory flow
|
|
561
|
+
// Services can deploy their part independently; flag enables the feature system-wide
|
|
562
|
+
|
|
563
|
+
async function placeOrder(order: OrderRequest): Promise<Order> {
|
|
564
|
+
const useRealTimeInventory = await featureFlags.isEnabled('real-time-inventory-check');
|
|
565
|
+
|
|
566
|
+
if (useRealTimeInventory) {
|
|
567
|
+
// New flow: synchronous inventory check before order confirmation
|
|
568
|
+
const availability = await inventoryClient.checkAvailability(order.items);
|
|
569
|
+
if (!availability.available) {
|
|
570
|
+
throw new InsufficientInventoryError(availability.items);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
// Old flow: inventory check happens asynchronously after order creation
|
|
574
|
+
|
|
575
|
+
return orderRepository.create(order);
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Deployment sequence with feature flag:**
|
|
580
|
+
1. Deploy order-service with new code + feature flag check (flag off by default).
|
|
581
|
+
2. Deploy inventory-service with new availability endpoint.
|
|
582
|
+
3. Test integration end-to-end with flag enabled in staging.
|
|
583
|
+
4. Enable flag in production during a low-traffic window.
|
|
584
|
+
5. Monitor for errors. If issues arise, disable the flag — no deployment required.
|
|
585
|
+
6. After confidence period, remove the flag and the old code path.
|
|
586
|
+
|
|
587
|
+
**Trade-offs (release coordination):**
|
|
588
|
+
- (+) Reverse dependency release ordering prevents consumers from calling providers that don't exist yet.
|
|
589
|
+
- (+) Expand-contract pattern removes the need for coordinated simultaneous deployments of breaking changes.
|
|
590
|
+
- (+) Feature flags decouple deployment from release, reducing the blast radius of new cross-service features.
|
|
591
|
+
- (-) Feature flags accumulate. Stale flags add complexity without value. Assign an expiry date to every flag at creation time and schedule cleanup.
|
|
592
|
+
- (-) Expand-contract requires two deployment cycles per breaking change. This is a feature, not a bug — it means breaking changes can be done without coordination windows.
|
|
593
|
+
|
|
594
|
+
## Common Pitfalls
|
|
595
|
+
|
|
596
|
+
**Skipping shared infrastructure to move faster.** Teams start building services before shared auth middleware, logging, or migration infrastructure exists. Each service implements its own version. Later, a security bug in auth must be patched in six places, not one. Fix: treat Wave 0 as non-negotiable. Two weeks of shared infrastructure saves months of divergence cleanup.
|
|
597
|
+
|
|
598
|
+
**Contracts as informal agreements.** Two teams agree verbally on an API shape, start implementing, and meet at integration time to discover they made different assumptions about nullable fields, error shapes, and pagination. Fix: contracts must be written down and reviewed before implementation starts. A YAML file, even an imperfect one, is worth more than a verbal agreement.
|
|
599
|
+
|
|
600
|
+
**Stubs that don't reflect the real service.** The stub server returns data that the real service never actually returns (e.g., stub returns a `price` field that the real endpoint omits). Consumer tests pass against the stub but fail against the real service. Fix: generate stubs from the same OpenAPI spec that the real service is validated against. If the spec is wrong, fix the spec, then fix both.
|
|
601
|
+
|
|
602
|
+
**Integration milestones treated as optional.** Teams skip Milestone 1 because "contracts look good" and go straight to Milestone 2. Contract drift discovered late is expensive. Fix: milestones are gates, not suggestions. Automate them in CI so they cannot be bypassed.
|
|
603
|
+
|
|
604
|
+
**Releasing services in the wrong order.** Order service is released before inventory service. Order service makes calls to an endpoint that doesn't exist yet, producing 500 errors. Fix: draw the dependency map before planning releases. Leaf services always go first.
|
|
605
|
+
|
|
606
|
+
**Feature flags with no expiry.** A flag enabled "temporarily" for a cross-service feature rollout is still in the codebase two years later, with the old code path dead but never removed. Developers are afraid to delete the flag because they don't know if anything depends on it. Fix: every feature flag has a ticket to remove it, created at the same time as the flag.
|
|
607
|
+
|
|
608
|
+
**Wave planning that ignores the critical path.** Assigning agents to build notification-service (low dependency count, not on critical path) while order-service (critical path, highest dependency count) waits for resources. Fix: identify the critical path before assigning agents. Non-critical services are parallelized around the critical path, not instead of it.
|
|
609
|
+
|
|
610
|
+
## See Also
|
|
611
|
+
|
|
612
|
+
- [task-decomposition](./task-decomposition.md) — Single-service task sizing, dependency graphs, and wave planning
|
|
613
|
+
- [multi-service-api-contracts](./multi-service-api-contracts.md) — Contract evolution, versioning, and deprecation
|
|
614
|
+
- [multi-service-architecture](./multi-service-architecture.md) — Service boundary design and communication patterns
|
|
615
|
+
- [multi-service-testing](./multi-service-testing.md) — Consumer-driven contract tests (Pact), integration test strategies
|