Skip to content

Commit 762eb01

Browse files
committed
docs: add plan to sync SDK up to lexicons beta.13
1 parent e1ea5a1 commit 762eb01

1 file changed

Lines changed: 266 additions & 0 deletions

File tree

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
# Lexicon Sync Plan: v0.10.0-beta.11 → v0.10.0-beta.13
2+
3+
This document outlines the step-by-step plan for syncing the SDK with the latest lexicon changes, following on from
4+
`v0.10.0-beta.4-v0.10.0-beta.11.md`.
5+
6+
Each change must be implemented, validated, and reviewed before proceeding to the next.
7+
8+
## Current Status
9+
10+
- **Old version**: 0.10.0-beta.11
11+
- **New version**: 0.10.0-beta.13
12+
- **Dependency updated**: ⏳ Not yet
13+
- **Build status**: ⏳ Not yet tested
14+
- **Test status**: ⏳ Not yet tested
15+
16+
## Changes to Implement
17+
18+
### Change 1: Simplify workScope to union of strongRef and string (beta.12)
19+
20+
**CHANGELOG Reference**: PR #125 - Simplify workScope to union of strongRef and string
21+
22+
**What Changed**:
23+
24+
- The `workScope` field in `org.hypercerts.claim.activity` is now a union of:
25+
- `com.atproto.repo.strongRef`: A reference to a work-scope logic record for structured, nested work scope definitions
26+
- `org.hypercerts.claim.activity#workScopeString`: A free-form string for simple or legacy scopes
27+
- **Removed** from `org.hypercerts.defs`:
28+
- `workScopeAll` (logical AND operator)
29+
- `workScopeAny` (logical OR operator)
30+
- `workScopeNot` (logical NOT operator)
31+
- `workScopeAtom` (atomic scope reference)
32+
33+
This simplification allows work scope complexity to be managed via referenced records while still supporting simple
34+
string-based scopes for straightforward use cases.
35+
36+
**SDK Tasks**:
37+
38+
- [ ] Remove type exports that were added for work scope expression types:
39+
- Remove `HypercertWorkScopeAll` type (if it exists)
40+
- Remove `HypercertWorkScopeAny` type (if it exists)
41+
- Remove `HypercertWorkScopeNot` type (if it exists)
42+
- Remove `HypercertWorkScopeAtom` type (if it exists)
43+
- Remove `HypercertWorkScopeExpression` union type (if it exists)
44+
- [ ] Remove type exports for work scope tag (if they exist):
45+
- Remove `CreateWorkScopeTagParams` (if it exists)
46+
- Remove `UpdateWorkScopeTagParams` (if it exists)
47+
- Remove `WorkScopeTagParams` (if it exists)
48+
- [ ] Verify `CreateHypercertParams.workScope` supports the new union type (string | StrongRef)
49+
- [ ] Update documentation about work scope to reflect the simplified approach
50+
- [ ] Update usage examples to show:
51+
- Simple string-based work scope
52+
- StrongRef to a work scope logic record
53+
- [ ] Update/remove tests for work scope expressions (they should now reference external records)
54+
- [ ] Build and test
55+
- [ ] Create changeset (major - breaking change, removed types)
56+
57+
**Validation**:
58+
59+
- [ ] Format check passes (`pnpm format:check`)
60+
- [ ] Lint passes (`pnpm lint`)
61+
- [ ] Typecheck passes (`pnpm typecheck`)
62+
- [ ] Build passes (`pnpm build`)
63+
- [ ] Tests pass (`pnpm test`)
64+
- [ ] Types export correctly
65+
- [ ] Work scope types are correct (string | StrongRef)
66+
67+
**Status**: ⏳ Pending
68+
69+
---
70+
71+
### Change 2: Refactor measurement lexicon schema (beta.12)
72+
73+
**CHANGELOG Reference**: PR #120 - Refactor measurement lexicon schema: add unit field, date ranges, and locations array
74+
75+
**What Changed**:
76+
77+
- Changed required fields: removed `measurers` from required, added `unit` as required
78+
- Added `unit` field (required, string, maxLength: 50): The unit of the measured value (e.g. kg CO₂e, hectares, %, index
79+
score)
80+
- Added `startDate` field (optional, datetime): The start date and time when the measurement began
81+
- Added `endDate` field (optional, datetime): The end date and time when the measurement ended
82+
- Changed `location` (single strongRef) to `locations` (array of strongRefs, maxLength: 100)
83+
- Moved `measurers` from required to optional field
84+
- Added `comment` field (optional, string): Short comment suitable for previews and list views
85+
- Added `commentFacets` field (optional, array): Rich text annotations for `comment` (mentions, URLs, hashtags, etc.)
86+
- Updated field descriptions for `metric` and `value` with more detailed examples
87+
88+
**SDK Tasks**:
89+
90+
- [ ] Update `CreateMeasurementParams` type to reflect:
91+
- `unit` is now required
92+
- `measurers` is now optional
93+
- `location` renamed to `locations` (array of StrongRef/LocationParams)
94+
- Add `startDate` (optional datetime)
95+
- Add `endDate` (optional datetime)
96+
- Add `comment` (optional string)
97+
- Add `commentFacets` (optional array of RichTextFacet)
98+
- [ ] Update `UpdateMeasurementParams` accordingly
99+
- [ ] Update `createMeasurement()` method to handle new required `unit` field
100+
- [ ] Update `createMeasurement()` and `updateMeasurement()` methods to handle `locations` array
101+
- [ ] Add JSDoc documentation about the new fields (unit, startDate, endDate, comment, commentFacets)
102+
- [ ] Add usage examples showing:
103+
- Creating measurements with unit (required)
104+
- Adding date ranges (startDate/endDate)
105+
- Using locations array
106+
- Adding comments with facets
107+
- [ ] Add/update tests for measurements with new fields
108+
- [ ] Build and test
109+
- [ ] Create changeset (major - breaking change, required field added, location → locations)
110+
111+
**Validation**:
112+
113+
- [ ] Format check passes (`pnpm format:check`)
114+
- [ ] Lint passes (`pnpm lint`)
115+
- [ ] Typecheck passes (`pnpm typecheck`)
116+
- [ ] Build passes (`pnpm build`)
117+
- [ ] Tests pass (`pnpm test`)
118+
- [ ] Types export correctly
119+
120+
**Status**: ⏳ Pending
121+
122+
---
123+
124+
### Change 3: Rename evidence lexicon to attachment (beta.13)
125+
126+
**CHANGELOG Reference**: PR #118 - Rename evidence lexicon to attachment and refactor schema structure
127+
128+
**What Changed**:
129+
130+
- **Lexicon ID change:**
131+
- `org.hypercerts.claim.evidence``org.hypercerts.claim.attachment`
132+
- **Schema structure changes (`org.hypercerts.claim.attachment`):**
133+
- Changed `subject` (single strongRef) to `subjects` (array of strongRefs, maxLength: 100)
134+
- Changed `content` from single union (uri/blob) to array of unions (maxLength: 100)
135+
- Added `contentType` field (string, maxLength: 64) to specify attachment type
136+
- Added `location` field (optional strongRef) to associate location metadata
137+
- Removed `relationType` field (previously used to indicate supports/challenges/clarifies)
138+
- Removed `contributors` field
139+
- Removed `locations` field
140+
- Added rich text support: `shortDescriptionFacets` and `descriptionFacets` (arrays of `app.bsky.richtext.facet`)
141+
- Updated required fields: `["title", "content", "createdAt"]` (content is now required)
142+
- **Common definitions (`org.hypercerts.defs`):**
143+
- Added `weightedContributor` def for contributor references with optional weights
144+
- Added `contributorIdentity` def for string-based contributor identification
145+
146+
**SDK Tasks**:
147+
148+
- [ ] Rename all SDK references from "evidence" to "attachment":
149+
- Type exports: `HypercertEvidence``HypercertAttachment`
150+
- Type exports: `CreateEvidenceParams``CreateAttachmentParams`
151+
- Type exports: `UpdateEvidenceParams``UpdateAttachmentParams`
152+
- Type exports: `EvidenceParams``AttachmentParams`
153+
- Interface methods (if they exist): `createEvidence``createAttachment`
154+
- Interface methods (if they exist): `updateEvidence``updateAttachment`
155+
- Interface methods (if they exist): `deleteEvidence``deleteAttachment`
156+
- Interface methods (if they exist): `listEvidence``listAttachments`
157+
- [ ] Update `CreateAttachmentParams` type to reflect:
158+
- `subject``subjects` (array of StrongRef/ActivityParams/CollectionParams)
159+
- `content` is now array of unions (uri/blob) and required
160+
- Add `contentType` (optional string)
161+
- Add `location` (optional StrongRef/LocationParams)
162+
- Remove `relationType`
163+
- Remove `contributors`
164+
- Remove `locations` (note: there's a new singular `location` field)
165+
- Add `shortDescriptionFacets` (optional array)
166+
- Add `descriptionFacets` (optional array)
167+
- [ ] Update `UpdateAttachmentParams` accordingly
168+
- [ ] Add type exports for new common definitions:
169+
- `HypercertWeightedContributor` = `OrgHypercertsDefs.WeightedContributor`
170+
- `HypercertContributorIdentity` = `OrgHypercertsDefs.ContributorIdentity`
171+
- [ ] Update CRUD methods to handle schema changes
172+
- [ ] Add JSDoc documentation about attachment fields and migration from evidence
173+
- [ ] Add usage examples showing:
174+
- Creating attachments with subjects array
175+
- Using content array with contentType
176+
- Adding location to attachments
177+
- Using weighted contributors
178+
- [ ] Add/update tests for attachments
179+
- [ ] Build and test
180+
- [ ] Create changeset (major - breaking change, renamed lexicon and schema changes)
181+
182+
**Validation**:
183+
184+
- [ ] Format check passes (`pnpm format:check`)
185+
- [ ] Lint passes (`pnpm lint`)
186+
- [ ] Typecheck passes (`pnpm typecheck`)
187+
- [ ] Build passes (`pnpm build`)
188+
- [ ] Tests pass (`pnpm test`)
189+
- [ ] Types export correctly
190+
191+
**Status**: ⏳ Pending
192+
193+
---
194+
195+
### Change 4: Add inline string format to app.certified.location (beta.13)
196+
197+
**CHANGELOG Reference**: PR #131 - Add inline string format to app.certified.location schema with documentation and
198+
examples
199+
200+
**What Changed**:
201+
202+
- `app.certified.location` now supports inline string format in addition to the structured object format
203+
- This allows locations to be specified as simple strings for convenience
204+
205+
**SDK Tasks**:
206+
207+
- [ ] Verify `CreateLocationParams` supports both string and structured object format
208+
- [ ] Update `createLocation()` method to handle string format
209+
- [ ] Update documentation to show both formats:
210+
- Simple string format: `"New York, NY, USA"`
211+
- Structured object format: `{ country: "USA", city: "New York", ... }`
212+
- [ ] Add usage examples for both formats
213+
- [ ] Add tests for location string format
214+
- [ ] Build and test
215+
- [ ] Create changeset (minor - new feature, backward compatible)
216+
217+
**Validation**:
218+
219+
- [ ] Format check passes (`pnpm format:check`)
220+
- [ ] Lint passes (`pnpm lint`)
221+
- [ ] Typecheck passes (`pnpm typecheck`)
222+
- [ ] Build passes (`pnpm build`)
223+
- [ ] Tests pass (`pnpm test`)
224+
- [ ] Types export correctly
225+
226+
**Status**: ⏳ Pending
227+
228+
---
229+
230+
### Change 5: Update dependency and final validation
231+
232+
**Tasks**:
233+
234+
- [ ] Update `@hypercerts-org/lexicon` dependency from `0.10.0-beta.11` to `0.10.0-beta.13` in
235+
`packages/sdk-core/package.json`
236+
- [ ] Run `pnpm install` to update the dependency
237+
- [ ] Review all individual changesets created in steps 1-4
238+
- [ ] Consider whether they should be combined into a single changeset or kept separate
239+
- [ ] Update any top-level documentation if needed
240+
- [ ] Final build and test of entire SDK
241+
- [ ] Prepare summary of all changes for user review
242+
243+
**Validation**:
244+
245+
- [ ] Format check passes (`pnpm format:check`)
246+
- [ ] Lint passes (`pnpm lint`)
247+
- [ ] Typecheck passes (`pnpm typecheck`)
248+
- [ ] All builds pass (`pnpm build` - sdk-core and sdk-react)
249+
- [ ] All tests pass (`pnpm test`)
250+
- [ ] Changesets are properly formatted
251+
- [ ] Documentation is complete
252+
253+
**Status**: ⏳ Pending
254+
255+
---
256+
257+
## Notes
258+
259+
- **Breaking changes**: This sync includes several major breaking changes:
260+
1. WorkScope simplified to union of string | StrongRef (removes complex expression types)
261+
2. Measurement `unit` field now required, `location``locations` array
262+
3. Evidence lexicon renamed to Attachment with schema changes
263+
- Each change will be implemented, validated, and reviewed before proceeding to the next
264+
- The evidence → attachment rename is particularly significant and will require careful migration
265+
- Work scope simplification reverses the complexity added in beta.8, so we may need to remove code that was added in the
266+
previous sync

0 commit comments

Comments
 (0)