@pdtf/schemas 3.6.0-8 → 3.6.0-dev.1

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 (71) hide show
  1. package/CLAUDE.md +101 -0
  2. package/README.md +57 -33
  3. package/docs/backend-lms-profile-filtering-spec.md +180 -0
  4. package/docs/branch-release-workflow.md +138 -0
  5. package/docs/sef25-extensions-ui-spec.md +355 -0
  6. package/index.js +134 -66
  7. package/package.json +6 -2
  8. package/src/examples/v3/exampleTransaction.json +3 -3
  9. package/src/schemas/v3/combined.json +6981 -1234
  10. package/src/schemas/v3/compactSkeleton.txt +316 -5
  11. package/src/schemas/v3/overlays/baspi4.json +162 -20
  12. package/src/schemas/v3/overlays/baspi5.json +167 -22
  13. package/src/schemas/v3/overlays/extensions/ac.json +333 -0
  14. package/src/schemas/v3/overlays/extensions/as.json +4 -2
  15. package/src/schemas/v3/overlays/extensions/dk.json +32 -0
  16. package/src/schemas/v3/overlays/extensions/dr.json +9 -9
  17. package/src/schemas/v3/overlays/extensions/er.json +4 -2
  18. package/src/schemas/v3/overlays/extensions/fd.json +6 -3
  19. package/src/schemas/v3/overlays/extensions/hi.json +6 -3
  20. package/src/schemas/v3/overlays/extensions/hs.json +4 -2
  21. package/src/schemas/v3/overlays/extensions/ic.json +59 -0
  22. package/src/schemas/v3/overlays/extensions/jk.json +28 -8
  23. package/src/schemas/v3/overlays/extensions/la.json +4 -2
  24. package/src/schemas/v3/overlays/extensions/lc.json +75 -0
  25. package/src/schemas/v3/overlays/extensions/ma.json +6 -3
  26. package/src/schemas/v3/overlays/extensions/mc.json +4 -2
  27. package/src/schemas/v3/overlays/extensions/mi.json +69 -0
  28. package/src/schemas/v3/overlays/extensions/nd.json +43 -0
  29. package/src/schemas/v3/overlays/extensions/oa.json +4 -2
  30. package/src/schemas/v3/overlays/extensions/oc.json +4 -2
  31. package/src/schemas/v3/overlays/extensions/pc.json +37 -0
  32. package/src/schemas/v3/overlays/extensions/ph.json +194 -0
  33. package/src/schemas/v3/overlays/extensions/rw.json +68 -0
  34. package/src/schemas/v3/overlays/extensions/sb.json +4 -2
  35. package/src/schemas/v3/overlays/extensions/sc.json +129 -0
  36. package/src/schemas/v3/overlays/extensions/sd.json +63 -0
  37. package/src/schemas/v3/overlays/extensions/sf.json +4 -2
  38. package/src/schemas/v3/overlays/extensions/sl.json +4 -2
  39. package/src/schemas/v3/overlays/extensions/ta.json +252 -0
  40. package/src/schemas/v3/overlays/extensions/tf.json +6 -3
  41. package/src/schemas/v3/overlays/extensions/tr.json +73 -0
  42. package/src/schemas/v3/overlays/extensions/wg.json +350 -0
  43. package/src/schemas/v3/overlays/fme1.json +16 -14
  44. package/src/schemas/v3/overlays/lpe1.json +60 -30
  45. package/src/schemas/v3/overlays/nts.json +68 -1
  46. package/src/schemas/v3/overlays/nts2.json +68 -4
  47. package/src/schemas/v3/overlays/ntsl.json +68 -1
  48. package/src/schemas/v3/overlays/ntsl2.json +68 -4
  49. package/src/schemas/v3/overlays/piq.json +37 -3
  50. package/src/schemas/v3/overlays/rds.json +117 -8
  51. package/src/schemas/v3/overlays/sef25.json +1639 -0
  52. package/src/schemas/v3/overlays/ta6.json +46 -16
  53. package/src/schemas/v3/overlays/ta6ed6.json +6533 -0
  54. package/src/schemas/v3/overlays/ta7.json +70 -6
  55. package/src/schemas/v3/overlays/ta7ed5.json +1551 -0
  56. package/src/schemas/v3/pdtf-transaction.json +3896 -686
  57. package/src/schemas/v3/skeleton.json +442 -35
  58. package/src/utils/extractExtensionOverlays.js +293 -31
  59. package/src/utils/extractOverlay.js +94 -27
  60. package/src/utils/pathSkeleton.js +1 -1
  61. package/.claude/settings.local.json +0 -42
  62. package/.github/workflows/pages.yml +0 -50
  63. package/CNAME +0 -1
  64. package/_config.yml +0 -1
  65. package/src/tests/v3/caching.test.js +0 -591
  66. package/src/tests/v3/enquiries.test.js +0 -1096
  67. package/src/tests/v3/extensionOverlays.test.js +0 -525
  68. package/src/tests/v3/offers.test.js +0 -823
  69. package/src/tests/v3/patternProperties.test.js +0 -565
  70. package/src/tests/v3/transactionSchema.test.js +0 -615
  71. package/src/tests/v3/verifiedClaimsValidator.test.js +0 -195
package/CLAUDE.md ADDED
@@ -0,0 +1,101 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance for AI coding agents when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ This repository contains the Property Data Trust Framework (PDTF) schemas - JSON Schema-based definitions for digital residential property data exchange in England and Wales. The framework enables frictionless exchange of property data between software products and services.
8
+
9
+ ## Commands
10
+
11
+ ### Testing
12
+ ```bash
13
+ npm test # Run all tests
14
+ npm run test:watch # Run tests in watch mode
15
+ ```
16
+
17
+ ### Development
18
+ ```bash
19
+ npm install # Install dependencies
20
+ npm run extract-overlays # Regenerate v3 schemas and overlays from combined.json
21
+ npm run extract-extension-overlays # Regenerate v3 extension overlays from combined.json
22
+ npm run publish:dev # Publish the dev branch package to npm tag dev
23
+ npm run publish:next # Publish the next branch package to npm tag next
24
+ npm run publish:latest # Publish the main branch package to npm tag latest
25
+ ```
26
+
27
+ **Important**: `src/schemas/v3/combined.json` is the source of truth for v3 schema changes. Never edit generated schema artifacts directly; there are no exceptions. Utility/source files may be edited normally. After changing `combined.json`, always run both overlay extraction commands so derived files stay in sync.
28
+
29
+ ## Architecture
30
+
31
+ ### Schema System
32
+ The PDTF uses a flexible overlay system where a base transaction schema can be extended with form-specific overlays:
33
+
34
+ - **Base Schema**: Core transaction schema at `/src/schemas/v3/pdtf-transaction.json`
35
+ - **Overlays**: Form-specific extensions in `/src/schemas/v3/overlays/` (e.g., baspi5.json, ta6.json)
36
+ - **Merging**: Overlays are merged with the base schema using deepmerge with custom merge strategies
37
+ - **Generated Files**: `pdtf-transaction.json`, `skeleton.json`, `compactSkeleton.txt`, `src/schemas/v3/overlays/*.json`, and `src/schemas/v3/overlays/extensions/*.json` are generated from `combined.json`
38
+
39
+ ### Key Components
40
+
41
+ 1. **index.js**: Main module exposing schema utilities
42
+ - `getTransactionSchema(schemaId, overlays)`: Merges base schema with overlays
43
+ - `getValidator(schemaId, overlays)`: Returns AJV validator for schema
44
+ - `validateVerifiedClaims()`: Validates verified claims structure
45
+
46
+ 2. **Schema Versions**: Currently on v3, with v2 still supported
47
+ - Use `https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json` for v3
48
+
49
+ 3. **Overlay System**: Supports multiple UK property forms
50
+ - BASPI (v4 and v5)
51
+ - Law Society TA forms (TA6, TA7, TA10)
52
+ - NTS forms (2023 and 2025 versions)
53
+ - CON29R, PIQ, RDS, and others
54
+
55
+ ### Testing Approach
56
+ Tests in `/src/tests/` validate:
57
+ - Schema structure with different overlay combinations
58
+ - Path validation for nested properties
59
+ - Custom overlay merging
60
+ - Verified claims validation
61
+
62
+ Use existing test patterns when adding new tests.
63
+
64
+ ## Branch And Release Workflow
65
+
66
+ This repository publishes `@pdtf/schemas` through three branches and npm
67
+ dist-tags:
68
+
69
+ - `main` -> npm `latest`: stable PDTF releases for broad industry use.
70
+ - `next` -> npm `next`: tested capabilities proposed for the next managed PDTF
71
+ point release.
72
+ - `dev` -> npm `dev`: the unstable coal face for faster-moving integration work
73
+ and early adopters.
74
+
75
+ PRs may be merged into `dev` to prove out work before it is ready for the managed
76
+ release path. Once a `dev` PR has been tested and is suitable for standards
77
+ review, promote the same change into `next` via a focused PR. Do not treat `dev`
78
+ as the standard, and do not publish `dev` or `next` builds to npm `latest`.
79
+
80
+ Promotion is automatic by default: after a PR is merged into `dev`,
81
+ `.github/workflows/promote-dev-to-next.yml` creates a matching PR into `next` by
82
+ cherry-picking the merged dev PR. Add the `no-promote-next` label before merging
83
+ a dev PR only when it should stay out of the `next` review queue. Reviewers
84
+ should still inspect the promotion PR, resolve conflicts, and adjust
85
+ release/version metadata if needed before merging to `next`.
86
+
87
+ Each npm publish needs a unique semver version. Use `-dev.N` versions on `dev`,
88
+ prerelease versions on `next`, and normal release versions on `main`.
89
+
90
+ Consumer-specific compatibility profiles belong in the consuming application or
91
+ service unless the capability becomes generic PDTF package functionality.
92
+ Consumers should pin/hash supplied schemas and use their own target-profile
93
+ configuration for API calls and webhooks.
94
+
95
+ See `docs/branch-release-workflow.md` for the full workflow.
96
+
97
+ ## Important Notes
98
+
99
+ - All schemas use JSON Schema Draft 07
100
+ - The repository publishes to npm as `@pdtf/schemas`
101
+ - Overlays may contain fields from licensed forms (BASPI, PIQ, Law Society) - ensure compliance when rendering data
package/README.md CHANGED
@@ -7,7 +7,12 @@ The Property Data Trust Framework (PDTF) Schemas provide standardized JSON Schem
7
7
 
8
8
  ## Project Goals & Status
9
9
 
10
- **Current Version:** 3.5.0 (3.5.1-1 available as a pre-release on branch/package-tag `next`)
10
+ **Current Version:** 3.5.0 on `main` / npm `latest`.
11
+
12
+ Additional release channels are available for earlier adoption:
13
+
14
+ - `next` branch / npm `next`: tested capabilities proposed for the next PDTF release.
15
+ - `dev` branch / npm `dev`: fast-moving integration work for Moverly and other early adopters. This channel may include changes that are not yet accepted as PDTF standard capability.
11
16
 
12
17
  This schema framework aims to support the [Home Buying and Selling Group](https://homebuyingandsellinggroup.co.uk) 'Property Pack' initiative, encompassing all requirements starting with the Buyers and Sellers Property Information set ([BASPI v4.0](https://homebuyingandsellinggroup.co.uk/baspi/)).
13
18
 
@@ -62,7 +67,7 @@ if (!isValid) {
62
67
 
63
68
  - **🏗️ Modular Schema System** - Base schemas with flexible overlay composition
64
69
  - **📋 Multiple Form Support** - BASPI, NTS, Law Society TA forms, and more
65
- - **🧩 Extension Overlays** - Granular NTS2 features as individual modules
70
+ - **🧩 Extension Overlays** - Granular NTS2 and SEF25 features as individual modules
66
71
  - **✅ JSON Schema Validation** - Full JSON Schema Draft 07 support with AJV
67
72
  - **🔗 Verified Claims** - Support for verified data provenance tracking
68
73
  - **📚 Comprehensive Documentation** - Detailed usage guides and examples
@@ -82,7 +87,7 @@ if (!isValid) {
82
87
  │ │ │ │ └── extensions/ # Modular NTS2 extensions
83
88
  │ │ │ │ ├── jk.json # Japanese Knotweed
84
89
  │ │ │ │ ├── tf.json # Transfer Fees
85
- │ │ │ │ └── ... # 16 total extensions
90
+ │ │ │ │ └── ... # NTS2 + SEF25 extensions
86
91
  │ │ │ └── combined.json # Master schema for generation
87
92
  │ │ ├── v2/ # Legacy schema version
88
93
  │ │ ├── verifiedClaims/ # Verified claims schemas
@@ -163,31 +168,56 @@ const errors = validateVerifiedClaims(verifiedClaims, schemaId, ["nts2023"]);
163
168
 
164
169
  #### Extension Overlays
165
170
 
166
- Modular NTS2 features for selective adoption:
171
+ Modular features for selective adoption. Extensions are merged on top of an NTS base overlay.
167
172
 
168
173
  ```javascript
169
- // Individual extensions
170
- const schema = getTransactionSchema(schemaId, ["nts2023", "jk", "tf"]);
171
-
172
- // Multiple specialist issues
173
- const schema = getTransactionSchema(schemaId, [
174
- "nts2023",
175
- "as",
176
- "dr",
177
- "jk",
178
- "sb",
179
- ]);
174
+ // NTS2 extensions
175
+ const schema = getTransactionSchema(schemaId, ["nts2023", "jk", "tf", "ma"]);
176
+
177
+ // SEF25 extensions (Seller Enquiry Form)
178
+ const sef25 = ["sc", "pc", "ph", "dk", "rw", "sd", "lc", "wg", "ic", "nd", "mi", "tr"];
179
+ const schema = getTransactionSchema(schemaId, ["nts2023", ...sef25]);
180
180
  ```
181
181
 
182
- | Extension | Code | Description |
183
- | ----------------- | ---- | -------------------------------- |
184
- | Japanese Knotweed | `jk` | Knotweed presence and management |
185
- | Transfer Fees | `tf` | Additional leasehold fees |
186
- | Managing Agent | `ma` | Leasehold managing agent details |
187
- | Solar Panels | `sl` | Solar panel ownership details |
188
- | Asbestos | `as` | Asbestos presence and management |
182
+ **NTS2 Extensions:**
189
183
 
190
- [View all extensions →](src/schemas/v3/overlays/README.md#extension-overlays)
184
+ | Extension | Code | Description |
185
+ | --- | --- | --- |
186
+ | Japanese Knotweed | `jk` | Knotweed presence and management |
187
+ | Asbestos | `as` | Asbestos presence and management |
188
+ | Dry Rot | `dr` | Dry rot treatment |
189
+ | Subsidence | `sb` | Subsidence or structural fault |
190
+ | Health & Safety | `hs` | Ongoing health or safety issues |
191
+ | Outside Areas | `oa` | Outside areas details |
192
+ | Main Construction | `mc` | Construction type if standard form |
193
+ | Loft Access | `la` | Loft access and details |
194
+ | Spray Foam | `sf` | Spray foam insulation |
195
+ | Solar Panels | `sl` | Solar panel ownership details |
196
+ | Heating Installed | `hi` | Central heating installation date |
197
+ | Flood Defences | `fd` | Flood defence information |
198
+ | Estate Rentcharges | `er` | Estate rentcharges for freehold |
199
+ | Managing Agent | `ma` | Leasehold managing agent details |
200
+ | Transfer Fees | `tf` | Additional leasehold fees |
201
+ | Onward Chain | `oc` | Other property in chain |
202
+
203
+ **SEF25 Extensions (Seller Enquiry Form):**
204
+
205
+ | Extension | Code | Description |
206
+ | --- | --- | --- |
207
+ | Supply Costs | `sc` | Private water/sewerage costs |
208
+ | Parking Permit Cost | `pc` | Parking permit frequency |
209
+ | Property Hazards | `ph` | 4 hazard Yes/No questions |
210
+ | Dropped Kerb | `dk` | Dropped kerb access to parking |
211
+ | Private Right of Way | `rw` | Private right of way |
212
+ | Storm/Fire/Flood Damage | `sd` | Storm, fire or flood damage |
213
+ | Solar Lease Costs | `lc` | Solar panel lease costs |
214
+ | Warranties & Guarantees | `wg` | 7 warranty categories upfront |
215
+ | Insurance Claims | `ic` | Insurance claims upfront |
216
+ | Neighbour Development | `nd` | Neighbour development |
217
+ | Material Issue | `mi` | Other material issue upfront |
218
+ | Title Restrictions | `tr` | Title restrictions for freehold |
219
+
220
+ [View full SEF25 UI spec →](docs/sef25-extensions-ui-spec.md) | [View all extensions →](src/schemas/v3/overlays/README.md#extension-overlays)
191
221
 
192
222
  ## Usage Examples
193
223
 
@@ -204,7 +234,7 @@ const legalSchema = getTransactionSchema(schemaId, ["ta6ed4", "ta7ed3"]);
204
234
  const ntsSchema = getTransactionSchema(schemaId, ["nts2023"]);
205
235
  ```
206
236
 
207
- ### Modular NTS2 Features
237
+ ### Modular Extension Features
208
238
 
209
239
  ```javascript
210
240
  // Selective NTS2 adoption
@@ -215,15 +245,9 @@ const partialNts2 = getTransactionSchema(schemaId, [
215
245
  "ma", // Managing Agent
216
246
  ]);
217
247
 
218
- // Full specialist issues
219
- const specialistIssues = getTransactionSchema(schemaId, [
220
- "nts2023",
221
- "as",
222
- "dr",
223
- "jk",
224
- "sb",
225
- "hs",
226
- ]);
248
+ // SEF25 Seller Enquiry Form extensions
249
+ const sef25 = ["sc", "pc", "ph", "dk", "rw", "sd", "lc", "wg", "ic", "nd", "mi", "tr"];
250
+ const sellerEnquiry = getTransactionSchema(schemaId, ["nts2023", ...sef25]);
227
251
  ```
228
252
 
229
253
  ### Data Validation
@@ -0,0 +1,180 @@
1
+ # Backend LMS Profile Filtering Spec
2
+
3
+ ## Context
4
+
5
+ Moverly will consume `@pdtf/schemas@dev` for early access to schema changes, but
6
+ LMS should only receive data shaped to the `pdtf-transaction.json` profile they
7
+ currently support.
8
+
9
+ This compatibility layer belongs in Moverly backend services because it is an
10
+ integration-boundary concern. The PDTF schema package should not carry
11
+ LMS-specific profile code unless the capability later becomes generic and useful
12
+ to PDTF consumers.
13
+
14
+ ## Target Profile
15
+
16
+ Initial LMS profile:
17
+
18
+ - Source: LMS-supplied `pdtf-transaction.json`
19
+ - Profile id: `lms-2026-05-08`
20
+ - Schema id: `https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json`
21
+ - Raw SHA-256:
22
+ `5135ffd6158bbe48955ae630cf9cae42ba18f6cd522daed771cd3e44136283d7`
23
+ - Canonical SHA-256:
24
+ `98aeebe4231557c1aa7bc5182cbb5318d28af32cdcbe3b293feb61dca1e8d6f5`
25
+
26
+ The LMS profile is not an official PDTF release. It is a pinned recipient
27
+ profile supplied by LMS. When LMS can support an official PDTF release, move the
28
+ target profile to that release artifact instead.
29
+
30
+ ## Configuration
31
+
32
+ Add a backend environment variable:
33
+
34
+ ```bash
35
+ LMS_PDTF_TARGET_PROFILE=lms-2026-05-08
36
+ ```
37
+
38
+ Behaviour:
39
+
40
+ - Non-production may default to `lms-2026-05-08`.
41
+ - Production must fail startup or alert loudly if the variable is missing or
42
+ unknown.
43
+ - Logs and telemetry must include the selected profile id.
44
+
45
+ ## Scope
46
+
47
+ Apply LMS profile filtering to:
48
+
49
+ - backend endpoints that expose PDTF transaction data to LMS;
50
+ - webhooks sent to LMS;
51
+ - verified claim payloads included in LMS-facing API responses or webhooks.
52
+
53
+ Do not apply LMS filtering to:
54
+
55
+ - stored/source Moverly verified claims;
56
+ - internal Moverly workflows;
57
+ - non-LMS partners;
58
+ - frontend schema rendering, except where frontend displays backend-provided
59
+ compatibility metadata.
60
+
61
+ ## Filtering Rules
62
+
63
+ Treat the target profile as closed for outbound LMS payloads, even though PDTF
64
+ schemas generally do not declare `additionalProperties: false`.
65
+
66
+ For transaction payloads:
67
+
68
+ 1. Build the normal internal Moverly/PDTF payload.
69
+ 2. Filter unknown top-level and nested fields against the selected LMS target
70
+ schema.
71
+ 3. Validate the filtered payload against the selected LMS target schema.
72
+ 4. Send only the filtered payload.
73
+
74
+ For verified claims:
75
+
76
+ 1. Iterate each verified claim envelope.
77
+ 2. Inspect each `claims` path/value pair independently.
78
+ 3. Keep the line item only if:
79
+ - the path exists in the selected LMS target schema; and
80
+ - the value validates against that path's subschema.
81
+ 4. Drop unsupported or invalid line items.
82
+ 5. Preserve the verified claim envelope if at least one line item remains.
83
+ 6. Drop the envelope only if all line items are suppressed.
84
+ 7. Preserve envelope metadata such as `id`, `transactionId`, `schemaVersion`,
85
+ `verification`, and `terms_of_use`.
86
+ 8. Do not mutate the source verified claim.
87
+
88
+ Do not map paths or transform values. If a field needs structural mapping, that
89
+ is a separate business/product decision and should not happen implicitly in this
90
+ filtering layer.
91
+
92
+ ## Selective Disclosure Semantics
93
+
94
+ Suppression means "not disclosed to LMS under this profile".
95
+
96
+ It does not mean "the seller/source did not assert this". Any backend feature
97
+ answering questions such as "did the seller make an assertion about flooding?"
98
+ must query the source verified claims or explicit suppression metadata, not the
99
+ LMS-filtered payload.
100
+
101
+ ## Suggested Backend Module
102
+
103
+ Create a small backend-owned module, for example:
104
+
105
+ ```text
106
+ src/integrations/lms/pdtfProfile/
107
+ lms-2026-05-08/pdtf-transaction.json
108
+ lms-2026-05-08/metadata.json
109
+ filterTransactionForProfile.ts
110
+ filterVerifiedClaimsForProfile.ts
111
+ profileRegistry.ts
112
+ ```
113
+
114
+ The implementation should:
115
+
116
+ - load the selected profile by id;
117
+ - verify the pinned file hash in tests;
118
+ - use JSON Schema parsing rather than hand-maintained path allowlists;
119
+ - compile validators with the same AJV draft/settings used for PDTF validation;
120
+ - cache subschema validators by `profileId:path`;
121
+ - return suppression metadata without logging claim values.
122
+
123
+ ## Observability
124
+
125
+ Record:
126
+
127
+ - partner: `LMS`;
128
+ - target profile id;
129
+ - profile raw/canonical hash;
130
+ - endpoint or webhook name;
131
+ - transaction id;
132
+ - claim line items before filtering;
133
+ - claim line items after filtering;
134
+ - verified claim envelopes before filtering;
135
+ - verified claim envelopes after filtering;
136
+ - envelopes dropped;
137
+ - unsupported path count;
138
+ - invalid value count;
139
+ - suppressed paths, where safe;
140
+ - validation errors, without sensitive values.
141
+
142
+ ## Tests
143
+
144
+ Backend tests should cover:
145
+
146
+ - selected profile id is read from env;
147
+ - unknown production profile id fails loudly;
148
+ - profile metadata hashes match the bundled LMS schema file;
149
+ - transaction filtering removes unknown top-level fields;
150
+ - transaction filtering removes unknown nested fields;
151
+ - filtered transaction validates against the LMS target profile;
152
+ - a field valid in `@pdtf/schemas@dev` but absent from LMS is suppressed;
153
+ - verified claim line items are filtered independently;
154
+ - verified claim envelope metadata is preserved;
155
+ - envelopes are dropped only when all line items are suppressed;
156
+ - source verified claims are not mutated;
157
+ - suppression metadata is returned and contains no claim values.
158
+
159
+ ## Rollout
160
+
161
+ 1. Publish and install `@pdtf/schemas@dev` in Moverly backend.
162
+ 2. Add the LMS target profile module and tests.
163
+ 3. Set `LMS_PDTF_TARGET_PROFILE=lms-2026-05-08` in non-production.
164
+ 4. Run LMS endpoint and webhook regression tests.
165
+ 5. Deploy on Monday morning behind normal backend release controls.
166
+ 6. Monitor suppression and validation telemetry.
167
+ 7. Set the production env var and complete go-live.
168
+ 8. Keep the previous behaviour available for rollback until LMS confirms the new
169
+ payloads are accepted.
170
+
171
+ ## Future Profiles
172
+
173
+ For a new LMS-supported PDTF release:
174
+
175
+ 1. Add the official released `pdtf-transaction.json` artifact or reference.
176
+ 2. Give it a clear profile id, for example `pdtf-3.6.0`.
177
+ 3. Add metadata and hash tests.
178
+ 4. Update `LMS_PDTF_TARGET_PROFILE`.
179
+ 5. Deploy backend and monitor telemetry.
180
+ 6. Retain the previous profile until rollback is no longer needed.
@@ -0,0 +1,138 @@
1
+ # Branch And Release Workflow
2
+
3
+ This repository uses three long-lived release channels for `@pdtf/schemas`.
4
+
5
+ ## Branches And npm Tags
6
+
7
+ | Branch | npm dist-tag | Purpose |
8
+ | --- | --- | --- |
9
+ | `main` | `latest` | Stable PDTF releases for broad industry use. |
10
+ | `next` | `next` | Tested capabilities intended for the next managed PDTF point release. |
11
+ | `dev` | `dev` | Unstable coal face for faster-moving integration work and early adopters. |
12
+
13
+ `dev` is not the standard. It is a proving ground for changes that may later be
14
+ promoted to `next` through focused PRs. Consumers who need the stable standard
15
+ should use `@pdtf/schemas` from `latest`/`main`.
16
+
17
+ ## Versioning
18
+
19
+ Every npm publish must have a unique semver version.
20
+
21
+ - `main` publishes normal release versions, for example `3.5.0`, on `latest`.
22
+ - `next` publishes prerelease versions on the `next` tag.
23
+ - `dev` publishes prerelease versions on the `dev` tag, using a `-dev.N`
24
+ suffix, for example `3.6.0-dev.0`.
25
+
26
+ Do not publish `dev` or `next` builds to `latest`.
27
+
28
+ ## Dev Fast-Path Workflow
29
+
30
+ Use this workflow when work needs to move faster than the managed PDTF release
31
+ cycle, or when a change needs practical integration testing before it is proposed
32
+ for the standards-track path.
33
+
34
+ 1. Open a PR against `dev`.
35
+ 2. Treat `dev` as the unstable coal face. Keep the change reviewable and, where
36
+ possible, structured so that accepted parts can later be promoted to `next`.
37
+ 3. Change `src/schemas/v3/combined.json` for schema changes, then run both
38
+ extraction scripts:
39
+
40
+ ```bash
41
+ npm run extract-overlays
42
+ npm run extract-extension-overlays
43
+ ```
44
+
45
+ 4. Add or update tests for schema, overlay, path-validation, and utility
46
+ behaviour.
47
+ 5. Bump the package version to the next unique `-dev.N` version if the PR will
48
+ be published from `dev`.
49
+ 6. If the change should not enter the `next` review queue after it has landed in
50
+ `dev`, add the `no-promote-next` label before merging.
51
+ 7. Merge to `dev`.
52
+ 8. If publishing the dev channel, publish from `dev`:
53
+
54
+ ```bash
55
+ npm run publish:dev
56
+ ```
57
+
58
+ 9. Consumers can use `@pdtf/schemas@dev`, or pin the exact dev version in
59
+ lockfiles when deterministic rollout is required.
60
+
61
+ ## Automated Promotion To next
62
+
63
+ The `.github/workflows/promote-dev-to-next.yml` workflow can open the matching
64
+ `next` PR automatically.
65
+
66
+ Trigger:
67
+
68
+ - A PR is merged into `dev`.
69
+ - The merged PR does not have the `no-promote-next` label.
70
+
71
+ Behaviour:
72
+
73
+ 1. Check out `next`.
74
+ 2. Create a branch named `promote/dev-pr-<number>-to-next`.
75
+ 3. Cherry-pick the merged dev PR's effective diff onto that branch.
76
+ 4. Open a PR into `next` with a title and body referencing the original dev PR.
77
+
78
+ If the cherry-pick conflicts, the workflow creates an issue instead of a PR so a
79
+ maintainer can promote the change manually.
80
+
81
+ The promotion PR is intentionally still reviewed. Before merging to `next`,
82
+ maintainers should:
83
+
84
+ - confirm the change is appropriate for the managed release path;
85
+ - remove any dev-only scaffolding;
86
+ - adjust package version metadata from `-dev.N` to the correct `next`
87
+ prerelease version where needed;
88
+ - run tests and schema extraction checks.
89
+
90
+ ## Manual Promotion To next
91
+
92
+ If automation is not used, or if the automated cherry-pick conflicts:
93
+
94
+ 1. Branch from `next`.
95
+ 2. Cherry-pick the merged dev PR commit or recreate the focused diff.
96
+ 3. Remove dev-only changes.
97
+ 4. Bump to the next unique `next` prerelease version if the PR will be published
98
+ from `next`.
99
+ 5. Open a PR into `next` that links back to the original dev PR.
100
+ 6. Merge to `next` after review.
101
+ 7. Publish from `next`:
102
+
103
+ ```bash
104
+ npm run publish:next
105
+ ```
106
+
107
+ The `next` channel should remain tested and coherent. It can be ahead of
108
+ `main`, but it should not contain unrelated experimental work merely because it
109
+ exists on `dev`.
110
+
111
+ ## Promotion To main
112
+
113
+ When the PDTF point-release cycle is ready:
114
+
115
+ 1. Select accepted `next` changes for the point release.
116
+ 2. Merge or cherry-pick the accepted changes into `main`.
117
+ 3. Bump to the release version, for example `3.6.0`.
118
+ 4. Publish from `main`:
119
+
120
+ ```bash
121
+ npm run publish:latest
122
+ ```
123
+
124
+ Long-running `dev` work should not be merged wholesale into `main` unless the
125
+ full contents have been reviewed and accepted for the PDTF release.
126
+
127
+ ## Consumer Compatibility Profiles
128
+
129
+ Consumer-specific compatibility profiles are owned by the consuming application
130
+ or service unless and until they become a reusable PDTF capability.
131
+
132
+ Consumers may pin exact supplied schemas, hash them, and filter outbound API
133
+ calls or webhooks accordingly. That code should not be added to this schema
134
+ package unless the capability is generic and appropriate for PDTF consumers.
135
+
136
+ If a consumer later supports an official PDTF release, its target profile should
137
+ move from the consumer-specific schema to the relevant published
138
+ `@pdtf/schemas` release or prerelease.