@precepts/standards 0.1.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.
Files changed (34) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +115 -0
  3. package/package.json +40 -0
  4. package/schema/document-standard-template.md +139 -0
  5. package/schema/standards.schema.json +154 -0
  6. package/standards/integration/governance/_category_.json +1 -0
  7. package/standards/integration/governance/integration-styles.md +56 -0
  8. package/standards/integration/index.md +9 -0
  9. package/standards/integration/standards/_category_.json +1 -0
  10. package/standards/integration/standards/api/_category_.json +1 -0
  11. package/standards/integration/standards/api/error-handling.md +250 -0
  12. package/standards/integration/standards/api/resource-design.md +286 -0
  13. package/standards/integration/standards/data-formats/_category_.json +1 -0
  14. package/standards/integration/standards/data-formats/character-encoding.md +206 -0
  15. package/standards/integration/standards/data-formats/date-format.md +102 -0
  16. package/standards/integration/standards/data-formats/datetime-formats.md +265 -0
  17. package/standards/integration/standards/data-formats/monetary-format.md +61 -0
  18. package/standards/integration/standards/events/_category_.json +1 -0
  19. package/standards/integration/standards/events/event-envelope.md +270 -0
  20. package/standards/integration/standards/foundational/_category_.json +1 -0
  21. package/standards/integration/standards/foundational/naming-conventions.md +334 -0
  22. package/standards/integration/standards/observability/_category_.json +1 -0
  23. package/standards/integration/standards/observability/integration-observability.md +226 -0
  24. package/standards/integration/standards/resilience/_category_.json +1 -0
  25. package/standards/integration/standards/resilience/integration-resilience-patterns.md +291 -0
  26. package/standards/integration/standards/resilience/retry-policy.md +268 -0
  27. package/standards/integration/standards/resilience/timeout.md +269 -0
  28. package/standards/integration/standards/versioning/_category_.json +1 -0
  29. package/standards/integration/standards/versioning/backward-forward-compatibility.md +230 -0
  30. package/standards/product/Guidelines/_category_.json +1 -0
  31. package/standards/product/Guidelines/requirement-document.md +54 -0
  32. package/standards/product/index.md +9 -0
  33. package/standards/project-management/index.md +9 -0
  34. package/standards/ux/index.md +9 -0
@@ -0,0 +1,230 @@
1
+ ---
2
+ identifier: "INTG-STD-006"
3
+ name: "Backward and Forward Compatibility"
4
+ version: "1.0.0"
5
+ status: "MANDATORY"
6
+
7
+ domain: "INTEGRATION"
8
+ documentType: "standard"
9
+ category: "versioning"
10
+ appliesTo: ["api", "events", "a2a", "files", "mcp", "webhooks", "grpc", "graphql", "batch", "streaming"]
11
+
12
+ lastUpdated: "2026-03-28"
13
+ owner: "Integration Architecture Board"
14
+
15
+ standardsCompliance:
16
+ iso: []
17
+ rfc: ["RFC-9110"]
18
+ w3c: []
19
+ other: ["Zalando-RESTful-API-Guidelines", "Protobuf-Wire-Compatibility", "Avro-Schema-Resolution"]
20
+
21
+ taxonomy:
22
+ capability: "versioning"
23
+ subCapability: "compatibility"
24
+ layer: "contract"
25
+
26
+ enforcement:
27
+ method: "hybrid"
28
+ validationRules:
29
+ schemaCompatibility: "backward-transitive"
30
+ rejectionCriteria:
31
+ - "Removal of existing fields"
32
+ - "Renaming of existing fields"
33
+ - "Changing field types in incompatible ways"
34
+ - "Narrowing enum value sets"
35
+
36
+ dependsOn: ["INTG-STD-004"]
37
+ supersedes: ""
38
+ ---
39
+
40
+ # Backward and Forward Compatibility
41
+
42
+ ## Purpose
43
+
44
+ Integration contracts are long-lived shared agreements. Once a producer publishes a field, consumers depend on it in ways the producer cannot observe. This standard defines how contracts evolve without breaking existing participants. **Full compatibility** (both backward and forward) is required for all shared contracts.
45
+
46
+ ## Rules
47
+
48
+ ### Compatibility Definitions
49
+
50
+ | Term | Definition |
51
+ |---|---|
52
+ | Backward compatible | New schema reads data written by old schema. Consumers survive producer upgrades. |
53
+ | Forward compatible | Old schema reads data written by new schema. Consumers tolerate unknown fields/values. |
54
+ | Full compatible | Both backward and forward compatible. **Required** for all shared contracts. |
55
+ | Breaking change | Modification causing existing, correct consumers to fail at parse, validation, or runtime. |
56
+ | Non-breaking change | Modification preserving behavior for all existing, correct consumers. |
57
+ | Additive-only evolution | Evolving contracts exclusively through non-breaking additions. |
58
+
59
+ ### R-1: Additive-Only Evolution (Provider Rules)
60
+
61
+ **R-COMPAT-001:** Providers **MUST** evolve published contracts using additive-only changes as the default policy.
62
+
63
+ **R-COMPAT-002:** Providers **MUST NOT** make any breaking change without following the Breaking Change Process.
64
+
65
+ **R-COMPAT-003:** Providers **MUST NOT** remove a field from a published response or event payload. Deprecated fields **MUST** continue to be populated until the next major version.
66
+
67
+ **R-COMPAT-004:** Providers **MUST NOT** rename a field in a published contract. A rename equals a remove-plus-add - both sides break.
68
+
69
+ **R-COMPAT-005:** Providers **MUST NOT** change the type of an existing field. Type widening is permitted only where the wire format guarantees lossless representation (see Protocol-Specific Rules).
70
+
71
+ **R-COMPAT-006:** Providers **MUST NOT** change the semantic meaning of an existing field. Repurposing a field is a breaking change even if the type is unchanged.
72
+
73
+ **R-COMPAT-007:** Providers **MUST NOT** make an optional field mandatory in request contracts.
74
+
75
+ **R-COMPAT-008:** Providers **MUST NOT** make a mandatory field optional in response contracts if consumers depend on its presence.
76
+
77
+ **R-COMPAT-009:** New fields added to responses or events **MUST** be optional or **MUST** include a default value.
78
+
79
+ **R-COMPAT-010:** Providers **MUST NOT** tighten validation constraints on existing fields. Loosening constraints is permitted.
80
+
81
+ ### R-2: Consumer Resilience
82
+
83
+ **R-COMPAT-011:** Consumers **MUST** ignore unknown fields in responses and events. Unknown fields **MUST NOT** cause deserialization failure, validation rejection, or runtime error.
84
+
85
+ **R-COMPAT-012:** Consumers **MUST** tolerate the absence of optional fields. Default/fallback behavior **MUST** be defined for every optional field a consumer depends on.
86
+
87
+ **R-COMPAT-013:** Consumers **MUST** handle unknown enum values gracefully by applying a documented fallback rather than failing.
88
+
89
+ **R-COMPAT-014:** Consumers **MUST** handle unknown HTTP status codes by falling back to the class-level code (e.g., unrecognized `432` treated as `400`).
90
+
91
+ **R-COMPAT-015:** Consumers **MUST** follow HTTP redirects (301, 302, 307, 308) rather than failing.
92
+
93
+ **R-COMPAT-016:** Consumers **MUST NOT** exploit definition gaps in provider contracts. Providers **MAY** tighten undocumented constraints without a major version bump.
94
+
95
+ **R-COMPAT-017:** Consumers performing PUT/PATCH **SHOULD** preserve unknown fields and send them back unmodified to prevent data loss.
96
+
97
+ ### R-3: Security Constraints
98
+
99
+ **R-COMPAT-018:** Ignoring unknown fields (R-COMPAT-011) **MUST NOT** override security validation. Providers **SHOULD** reject unexpected fields in request bodies (HTTP 400) to prevent mass-assignment attacks.
100
+
101
+ **R-COMPAT-019:** Providers **MUST NOT** accept deprecated authentication or encryption parameters with known vulnerabilities solely for backward compatibility. Security breaking changes **MAY** bypass standard deprecation timelines.
102
+
103
+ **R-COMPAT-020:** All fields - known and unknown - **MUST** be subject to size limits, encoding validation, and injection-prevention controls.
104
+
105
+ ### R-4: Enum Evolution
106
+
107
+ **R-COMPAT-021:** Providers **MUST NOT** remove values from an enum in a response or event payload.
108
+
109
+ **R-COMPAT-022:** Providers **MAY** add new values to a response/event enum, provided consumers handle unknown values (R-COMPAT-013). Extensible enums **SHOULD** be documented as such.
110
+
111
+ **R-COMPAT-023:** Providers **MUST NOT** add new values to a request enum if the provider previously validated against a closed set.
112
+
113
+ **R-COMPAT-024:** For enums used in both input and output, the safe path is: (1) provider adds the value to processing and response schema, (2) provider documents it, (3) consumers adopt it in requests at their own pace.
114
+
115
+ ### R-5: Type-Specific Compatibility
116
+
117
+ | Change | Compatible? | Notes |
118
+ |---|---|---|
119
+ | String: increase `maxLength` | Yes | Widening |
120
+ | String: decrease `maxLength` | **No** | Narrowing |
121
+ | String: add `pattern` | **No** | Narrowing - rejects previously valid values |
122
+ | String: remove `pattern` | Yes | Widening |
123
+ | Integer: `int32` to `int64` | Conditional | Safe in length-encoded formats; unsafe in JSON |
124
+ | Integer: `int64` to `int32` | **No** | Truncation risk |
125
+ | Number: increase precision | Yes | Widening |
126
+ | Number: decrease precision | **No** | Loss of information |
127
+ | Boolean: to enum | **No** | Type change - requires new field |
128
+ | Array: change item type | **No** | Breaking for all items |
129
+ | Array: increase `maxItems` | Yes | Widening |
130
+ | Array: decrease `maxItems` | **No** | Narrowing |
131
+ | Object: add optional property | Yes | Additive |
132
+ | Object: add required property | **No** | Breaking for both request and response |
133
+ | Object: remove property | **No** | Consumers may depend on it |
134
+ | Nullable: non-null to nullable | Yes (response) | Consumer **SHOULD** already handle null |
135
+ | Nullable: nullable to non-null | **No** | Consumers may be sending null |
136
+
137
+ ### R-6: Audit and Traceability
138
+
139
+ **R-COMPAT-025:** All schema changes **MUST** be version-controlled with full commit history.
140
+
141
+ **R-COMPAT-026:** Each schema version **MUST** be immutable once published to a registry or catalog.
142
+
143
+ **R-COMPAT-027:** Breaking change approvals **MUST** be recorded in the architecture decision log with justification, impact assessment, and migration plan.
144
+
145
+ **R-COMPAT-028:** Consumer migration progress **MUST** be tracked. Providers **MUST** retain traffic metrics sufficient to identify consumers still using deprecated versions.
146
+
147
+ ## Examples
148
+
149
+ ### Non-Breaking Change
150
+
151
+ Adding an optional field to a response:
152
+
153
+ ```
154
+ Before: After:
155
+ order: order:
156
+ id: "ORD-123" id: "ORD-123"
157
+ total: 99.95 total: 99.95
158
+ currency: "USD" <-- new optional field
159
+ ```
160
+
161
+ Existing consumers ignore `currency` and continue working. No version bump required.
162
+
163
+ ### Breaking Change
164
+
165
+ Renaming a field in a response:
166
+
167
+ ```
168
+ Before: After:
169
+ { "user_name": "alice" } { "username": "alice" }
170
+ ```
171
+
172
+ Consumers reading `user_name` now get null/missing. This is equivalent to removing one field and adding another - both sides break. Requires the Breaking Change Process and a major version bump.
173
+
174
+ ## Protocol-Specific Rules
175
+
176
+ | Protocol | Key Compatibility Rules |
177
+ |---|---|
178
+ | **REST/JSON** | Top-level responses **MUST** be objects (not bare arrays). **MUST NOT** use `additionalProperties: false` on responses. Providers **SHOULD** reject unknown request fields (HTTP 400). URL paths **MUST NOT** change for existing resources. |
179
+ | **gRPC/Protobuf** | Field numbers are permanent - **MUST NOT** reuse or change. Removed fields require `reserved` for both number and name. Field renames are wire-safe but break JSON transcoding. Adding fields to `oneof` is safe; moving existing fields into `oneof` is not. |
180
+ | **Avro Events** | New fields **MUST** have a default value. Schema registry **MUST** use `FULL_TRANSITIVE` mode. Type promotions follow Avro rules (`int` to `long`, `float` to `double`, `string` to `bytes`). |
181
+ | **Protobuf Events** | Same field number rules as gRPC. Schema registry **MUST** use `FULL_TRANSITIVE`. The `optional` keyword provides built-in forward compatibility. |
182
+ | **JSON Schema Events** | Same field-level rules as REST responses. **MUST NOT** set `additionalProperties: false`. Schema registry **MUST** use `FULL_TRANSITIVE`. |
183
+ | **GraphQL** | Adding fields/types/optional arguments is non-breaking. Removing fields requires `@deprecated` before removal. Making nullable fields non-nullable is breaking. New arguments **MUST** be optional with defaults. |
184
+ | **File/Batch** | Column additions at end of CSV/TSV are non-breaking. Column removals, reordering, or renames are breaking. Version identifiers **SHOULD** be embedded in file headers. |
185
+ | **MCP** | Adding tools/resources is non-breaking. Removing tools/resources is breaking. Parameter schema changes follow REST request body rules. Changing tool output semantics is breaking even if structure is unchanged. |
186
+
187
+ ## Enforcement Rules
188
+
189
+ - **CI gate:** All PRs modifying shared contracts **MUST** pass automated compatibility checks before merge. Use protocol-appropriate tooling (e.g., `oasdiff` for OpenAPI, `buf breaking` for Protobuf, `graphql-inspector` for GraphQL, schema registry checkers for Avro/JSON Schema).
190
+ - **Schema registry gate:** Event schemas **MUST** be validated against the registry's compatibility mode before registration. Incompatible schemas **MUST** be rejected.
191
+ - **Manual review:** Changes that automated tools cannot assess (semantic or behavioral changes) **MUST** be reviewed by the Integration Architecture Board.
192
+ - **Boundary:** Enforcement occurs at contract publish time (CI, schema registry, API gateway), not at runtime.
193
+ - **Rejection:** Any change failing compatibility checks **MUST** be rejected unless it follows the Breaking Change Process with a major version bump.
194
+
195
+ ## Breaking Change Process
196
+
197
+ When a breaking change is unavoidable, follow these steps:
198
+
199
+ | Step | Requirement |
200
+ |---|---|
201
+ | **1. Justify** | Document why compatible evolution is impossible, which consumers are affected, and any security/regulatory driver. |
202
+ | **2. Approve** | Breaking changes **MUST** be approved by the Integration Architecture Board. Security changes **MAY** use an expedited process. |
203
+ | **3. Version** | Bump to a new major version. The old version **MUST** remain available during migration. |
204
+ | **4. Migrate** | Old version **MUST** remain operational for minimum 6 months (30 days for actively exploited security vulnerabilities). Monitor traffic to both versions. |
205
+ | **5. Communicate** | Notify all consumers via: changelog entry, deprecation/sunset HTTP headers, direct team notification, and schema registry annotations. |
206
+ | **6. Sunset** | Old version **MAY** be removed only after the migration period has elapsed, traffic confirms negligible usage, a final shutdown notice has been sent, and removal is recorded in the changelog. |
207
+
208
+ ## Rationale
209
+
210
+ **Additive-only default:** The alternative - arbitrary changes with coordinated deployment - does not scale. Every major API platform converges on this principle because breaking a consumer costs more than maintaining additive discipline.
211
+
212
+ **Consumer resilience with security asymmetry:** Consumers should tolerate unknown fields (Postel's Law), but providers must validate strictly. Providers are trust boundaries; consumers are not. Uncritical tolerance of malformed input creates attack surface.
213
+
214
+ **FULL_TRANSITIVE for event registries:** Non-transitive compatibility permits drift chains where version N is compatible with N-1 but not N-2. Event consumers may lag multiple versions, making transitive checks essential.
215
+
216
+ **6-month migration period:** Aligns with industry practice (Google Cloud, Stripe, Atlassian) and reflects that large organizations need multiple release cycles to absorb breaking changes.
217
+
218
+ ## References
219
+
220
+ - [Zalando RESTful API Guidelines - Compatibility](https://opensource.zalando.com/restful-api-guidelines/#compatible-extensions)
221
+ - [Protocol Buffers Language Guide (proto3)](https://protobuf.dev/programming-guides/proto3/)
222
+ - [Confluent Schema Registry - Schema Evolution](https://docs.confluent.io/platform/current/schema-registry/fundamentals/schema-evolution.html)
223
+ - [RFC 9110 - HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110)
224
+ - [Eric Allman, "The Robustness Principle Reconsidered" (ACM Queue, 2011)](https://queue.acm.org/detail.cfm?id=1999945)
225
+
226
+ ## Version History
227
+
228
+ | Version | Date | Change |
229
+ | ------- | ---------- | ------------------ |
230
+ | 1.0.0 | 2026-03-28 | Initial definition |
@@ -0,0 +1 @@
1
+ {"label": "Guidelines", "position": 1}
@@ -0,0 +1,54 @@
1
+ ---
2
+ identifier: "PRD-GDL-001"
3
+ name: "Requirement Document"
4
+ version: "1.0.0"
5
+ status: "DRAFT"
6
+
7
+ domain: "PRODUCT-MANAGEMENT"
8
+ documentType: "guideline"
9
+ category: "process"
10
+ appliesTo: ["prd", "user-story", "epic"]
11
+
12
+ lastUpdated: "2026-03-28"
13
+ owner: "Product Council"
14
+
15
+ standardsCompliance:
16
+ iso: []
17
+ rfc: []
18
+ w3c: []
19
+ other: []
20
+
21
+ taxonomy:
22
+ capability: "requirements"
23
+ subCapability: "documentation"
24
+ layer: "artifact"
25
+
26
+ enforcement:
27
+ method: "review-based"
28
+ reviewChecklist: []
29
+
30
+ dependsOn: []
31
+ supersedes: ""
32
+ ---
33
+
34
+ # Requirement Document
35
+
36
+ ## Purpose
37
+
38
+ ## Conceptual Model
39
+
40
+ ## Rules
41
+
42
+ ## Examples
43
+
44
+ ## Roles & Responsibilities
45
+
46
+ ## References
47
+
48
+ ## Rationale
49
+
50
+ ## Version History
51
+
52
+ | Version | Date | Change |
53
+ | ------- | ---------- | ------------------ |
54
+ | 1.0.0 | 2026-03-28 | Initial definition |
@@ -0,0 +1,9 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Product Management Standards
6
+
7
+ This section contains product management standards, guidelines, and best practices for the Precepts platform.
8
+
9
+ Standards in this discipline cover requirements documentation, roadmapping, prioritization, metrics, and stakeholder management.
@@ -0,0 +1,9 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Project Management Standards
6
+
7
+ This section contains project management standards, guidelines, and best practices for the Precepts platform.
8
+
9
+ Standards in this discipline cover ceremonies, estimation, risk management, reporting, delivery lifecycle, and methodology.
@@ -0,0 +1,9 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # UX Standards
6
+
7
+ This section contains UX standards, guidelines, and best practices for the Precepts platform.
8
+
9
+ Standards in this discipline cover accessibility, design systems, interaction patterns, visual design, and content strategy.