Skip to content

Commit 0a36ee0

Browse files
committed
fix(docs): Improve formatting and clarity in Conditions documentation
1 parent 721f7ec commit 0a36ee0

File tree

3 files changed

+102
-45
lines changed

3 files changed

+102
-45
lines changed

docs/src/architecture/08_concepts/signed_doc/docs/conditions.md

Lines changed: 88 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Conditions
22

33
> **DRAFT STATUS**
4-
> This document is currently in **DRAFT** status. Development should **NOT** begin until this specification is formally released.
4+
> This document is currently in **DRAFT** status.
5+
> Development should **NOT** begin until this specification is formally released.
56
> This specification is subject to change without notice.
67
78
## Description
89

9-
Conditions documents are simple document types published by authoritative parties (such as Catalyst admins) to define terms and conditions that users must accept before submitting documents to the system.
10+
Conditions documents are simple document types published by authoritative parties
11+
(such as Catalyst admins) to define terms and conditions that users must accept
12+
before submitting documents to the system.
1013

1114
The Conditions document type supports multiple condition documents for different purposes, such as:
1215

@@ -17,11 +20,21 @@ The Conditions document type supports multiple condition documents for different
1720
* Privacy policies
1821
* Other legal or operational requirements
1922

20-
The payload of a Conditions document contains the text of the terms and conditions, typically in Markdown or HTML format. This allows for rich formatting while maintaining human readability.
23+
The payload of a Conditions document contains the text of the terms and
24+
conditions, typically in Markdown or HTML format.
25+
This allows for rich formatting while maintaining human readability.
2126

22-
Conditions documents are versioned and can be revoked, enabling administrators to update terms over time while maintaining an auditable history of what terms were in effect at any given time.
27+
Conditions documents are versioned and can be revoked, enabling administrators to
28+
update terms over time while maintaining an auditable history of what terms were
29+
in effect at any given time.
2330

24-
Conditions documents are referenced by parameter documents (Brand, Campaign, Category, and Contest Parameters) to specify which conditions are required at each level of the system hierarchy. User-submitted documents (such as Proposals and Comments) must reference all required conditions from their parameter hierarchy, with the act of listing these references and signing the document serving as the user's digital signature and acceptance.
31+
Conditions documents are referenced by parameter documents (Brand, Campaign,
32+
Category, and Contest Parameters) to specify which conditions are required at each
33+
level of the system hierarchy.
34+
User-submitted documents (such as Proposals and Comments) must reference all
35+
required conditions from their parameter hierarchy, with the act of listing these
36+
references and signing the document serving as the user's digital signature and
37+
acceptance.
2538

2639
<!-- markdownlint-disable max-one-sentence-per-line -->
2740

@@ -34,11 +47,16 @@ Conditions documents are referenced by parameter documents (Brand, Campaign, Cat
3447

3548
### Validation
3649

37-
The Conditions document *MUST* be a valid signed document according to the Signed Document Standard.
50+
The Conditions document *MUST* be a valid signed document according to the
51+
Signed Document Standard.
3852

39-
When a Conditions document is referenced in a parameter document's [`conditions`](../metadata.md#conditions) metadata field, the referenced document *MUST* exist and be of type "Conditions".
53+
When a Conditions document is referenced in a parameter document's
54+
[`conditions`](../metadata.md#conditions) metadata field, the referenced document
55+
*MUST* exist and be of type "Conditions".
4056

41-
When a Conditions document is referenced in a user-submitted document's [`conditions`](../metadata.md#conditions) metadata field, the referenced document *MUST* exist, be of type "Conditions", and not be revoked.
57+
When a Conditions document is referenced in a user-submitted document's
58+
[`conditions`](../metadata.md#conditions) metadata field, the referenced document
59+
*MUST* exist, be of type "Conditions", and not be revoked.
4260

4361
### Business Logic
4462

@@ -56,13 +74,18 @@ Front-end applications should:
5674

5775
Back-end validation must:
5876

59-
* Verify that all Conditions documents referenced in user-submitted documents exist and are valid
60-
* Collect all required conditions from the parameter hierarchy (Brand → Campaign → Category → Contest)
61-
* Ensure user-submitted documents include exactly the union of all required conditions from their parameter hierarchy
77+
* Verify that all Conditions documents referenced in user-submitted documents
78+
exist and are valid
79+
* Collect all required conditions from the parameter hierarchy
80+
(Brand → Campaign → Category → Contest)
81+
* Ensure user-submitted documents include exactly the union of all required
82+
conditions from their parameter hierarchy
6283
* Reject documents that reference revoked Conditions documents
63-
* Reject documents that are missing required conditions or include conditions not in the parameter hierarchy
84+
* Reject documents that are missing required conditions or include conditions not
85+
in the parameter hierarchy
6486

65-
The decentralized system (Hermes) will also reject documents without the required conditions, ensuring validation occurs at multiple layers.
87+
The decentralized system (Hermes) will also reject documents without the required
88+
conditions, ensuring validation occurs at multiple layers.
6689

6790
## [COSE Header Parameters][RFC9052-HeaderParameters]
6891

@@ -144,7 +167,9 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
144167
Reference to a Linked Document or Documents.
145168

146169
This field may be used to reference related documents, such as:
147-
* Related Conditions documents (e.g., a privacy policy that references a terms of use)
170+
171+
* Related Conditions documents (e.g., a privacy policy that references a terms of
172+
use)
148173
* Legal documents or regulations that the conditions are based on
149174
* Other relevant documentation
150175

@@ -199,9 +224,11 @@ The payload *MUST* be valid according to the content type specified in the COSE
199224
* If `content-type` is `text/markdown`, the payload must be valid Markdown
200225
* If `content-type` is `text/html`, the payload must be valid HTML5
201226

202-
The payload is compressed using Brotli compression (`br` encoding) as specified in the `content-encoding` header.
227+
The payload is compressed using Brotli compression (`br` encoding) as specified
228+
in the `content-encoding` header.
203229

204230
The payload content should be human-readable and clearly state:
231+
205232
* The purpose of the conditions
206233
* What users are agreeing to
207234
* Any obligations or restrictions
@@ -217,20 +244,27 @@ The following Admin roles may sign documents of this type:
217244
* Category Admin
218245
* Contest Admin
219246

220-
The specific admin role required depends on the level at which the Conditions document is intended to be used. For example:
247+
The specific admin role required depends on the level at which the Conditions
248+
document is intended to be used.
249+
For example:
250+
221251
* Brand-level conditions should be signed by Brand Admin
222252
* Campaign-level conditions should be signed by Campaign Admin or Brand Admin
223-
* Category-level conditions should be signed by Category Admin or a parent-level admin
224-
* Contest-level conditions should be signed by Contest Admin or a parent-level admin
253+
* Category-level conditions should be signed by Category Admin or a parent-level
254+
admin
255+
* Contest-level conditions should be signed by Contest Admin or a parent-level
256+
admin
225257

226258
Updates are allowed by the original author and from the 'collaborators' metadata field
227259
of the previous submitted document's version.
228260

229261
## JSON Specification Requirements
230262

231263
> **DRAFT STATUS**
232-
> The following JSON specification changes are documented here but **MUST NOT** be implemented until this specification is formally released.
233-
> The `signed_doc.json` file is the source of truth for code generation and must be marked as `draft: true` when these changes are added.
264+
> The following JSON specification changes are documented here but **MUST NOT** be
265+
> implemented until this specification is formally released.
266+
> The `signed_doc.json` file is the source of truth for code generation and must
267+
> be marked as `draft: true` when these changes are added.
234268
235269
### Required Changes to `signed_doc.json`
236270

@@ -319,56 +353,74 @@ Add a new entry to the `docs` section with the following structure:
319353
```
320354

321355
**Important Notes:**
322-
- Generate a new UUIDv4 for the `type` field
323-
- Set `draft: true` as required by Steven Johnson
324-
- The `value` for `content type` may be `text/markdown` or `text/html` (consider supporting both)
356+
357+
* Generate a new UUIDv4 for the `type` field
358+
* Set `draft: true` as required by Steven Johnson
359+
* The `value` for `content type` may be `text/markdown` or `text/html`
360+
(consider supporting both)
325361

326362
#### 2. Add "conditions" Metadata Field
327363

328364
Add the `conditions` metadata field to the following document types in their `metadata` sections:
329365

330-
**Parameter Documents** (Brand Parameters, Campaign Parameters, Category Parameters, Contest Parameters):
366+
**Parameter Documents** (Brand Parameters, Campaign Parameters, Category
367+
Parameters, Contest Parameters):
368+
331369
```json
332370
"conditions": {
333371
"description": "An array of references to Conditions documents that define terms and conditions required at this level.",
334372
"format": "Document Reference",
335373
"required": "optional",
336374
"multiple": true,
337375
"type": ["Conditions"],
338-
"validation": "If present, must be an array of valid Conditions document references. All referenced documents must exist and be of type 'Conditions'. The array must be sorted according to CBOR Deterministic Encoding rules."
376+
"validation": "If present, must be an array of valid Conditions document
377+
references. All referenced documents must exist and be of type 'Conditions'. The
378+
array must be sorted according to CBOR Deterministic Encoding rules."
339379
}
340380
```
341381

342382
**User-Submitted Documents** (Proposal, Proposal Comment, etc.):
383+
343384
```json
344385
"conditions": {
345-
"description": "An array of references to all Conditions documents that the user has accepted. Must include ALL conditions required by the parameter hierarchy (Brand → Campaign → Category → Contest).",
386+
"description": "An array of references to all Conditions documents that the
387+
user has accepted. Must include ALL conditions required by the parameter
388+
hierarchy (Brand → Campaign → Category → Contest).",
346389
"format": "Document Reference",
347390
"required": "optional",
348391
"multiple": true,
349392
"type": ["Conditions"],
350-
"validation": "Must exactly match the union of all required conditions from the parameter hierarchy. All referenced documents must exist, be valid, and not be revoked. The array must be sorted according to CBOR Deterministic Encoding rules."
393+
"validation": "Must exactly match the union of all required conditions from
394+
the parameter hierarchy. All referenced documents must exist, be valid, and not
395+
be revoked. The array must be sorted according to CBOR Deterministic Encoding
396+
rules."
351397
}
352398
```
353399

354400
**Important Notes:**
355-
- Set `multiple: true` to allow arrays of document references
356-
- Set `required: "optional"` (but required when conditions are specified in parameter hierarchy for user documents)
357-
- The validation logic for user documents requires transitive collection from parameter hierarchy
401+
402+
* Set `multiple: true` to allow arrays of document references
403+
* Set `required: "optional"` (but required when conditions are specified in
404+
parameter hierarchy for user documents)
405+
* The validation logic for user documents requires transitive collection from
406+
parameter hierarchy
358407

359408
#### 3. Update Document Types Table
360409

361410
The `types.md` file will be automatically regenerated from the JSON specification once these changes are made. Ensure the Conditions document type appears in the generated table.
362411

363412
### Code Generation Impact
364413

365-
Once these changes are made to `signed_doc.json` and the specification is released (draft status removed), the following code will need to be updated:
414+
Once these changes are made to `signed_doc.json` and the specification is
415+
released (draft status removed), the following code will need to be updated:
366416

367-
- **Rust**: Add `conditions` field to metadata structs and implement validation rules
368-
- **Python**: Add `conditions` to `DocType` enum and metadata handling
369-
- **Dart**: Add `conditions` to `DocumentType` enum
370-
- **Backend Validation**: Implement transitive condition collection and matching logic
371-
- **CLI Tools**: Add condition querying and acceptance prompts
417+
* **Rust**: Add `conditions` field to metadata structs and implement validation
418+
rules
419+
* **Python**: Add `conditions` to `DocType` enum and metadata handling
420+
* **Dart**: Add `conditions` to `DocumentType` enum
421+
* **Backend Validation**: Implement transitive condition collection and matching
422+
logic
423+
* **CLI Tools**: Add condition querying and acceptance prompts
372424

373425
## Copyright
374426

@@ -390,4 +442,3 @@ Once these changes are made to `signed_doc.json` and the specification is releas
390442
[RFC9052-HeaderParameters]: https://www.rfc-editor.org/rfc/rfc8152#section-3.1
391443
[CC-BY-4.0]: https://creativecommons.org/licenses/by/4.0/legalcode
392444
[RFC9562-V7]: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7
393-

docs/src/architecture/08_concepts/signed_doc/metadata.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ hierarchy they are all valid.
417417
### `conditions`
418418

419419
> **DRAFT STATUS**
420-
> This metadata field is currently in **DRAFT** status. Development should **NOT** begin until this specification is formally released.
420+
> This metadata field is currently in **DRAFT** status.
421+
> Development should **NOT** begin until this specification is formally released.
421422
> This specification is subject to change without notice.
422423
423424
<!-- markdownlint-disable MD033 -->
@@ -460,9 +461,10 @@ The validation process for user-submitted documents involves transitive collecti
460461
1. Extract the [`parameters`](metadata.md#parameters) reference from the user document
461462
2. Follow the parameter chain: Contest → Category → Campaign → Brand
462463
3. Collect all `conditions` arrays from each parameter level in the hierarchy
463-
4. Union all condition references (removing duplicates based on document ID and version)
464-
5. Sort the unioned list according to [CBOR Deterministic Encoding][CBOR-LFD-ENCODING]
465-
6. Compare the user document's `conditions` array with this unioned, sorted list
464+
4. Union all condition references (removing duplicates based on document ID and
465+
version)
466+
5. Sort the unified list according to [CBOR Deterministic Encoding][CBOR-LFD-ENCODING]
467+
6. Compare the user document's `conditions` array with this unified, sorted list
466468
7. Validation succeeds only if they match exactly
467469

468470
**Validation Rules:**
@@ -476,8 +478,11 @@ The validation process for user-submitted documents involves transitive collecti
476478
**Validation Failures:**
477479

478480
The document will be rejected if:
479-
* Missing required conditions (conditions specified in parameter hierarchy but not in user document)
480-
* Includes extra conditions (conditions in user document not in parameter hierarchy)
481+
482+
* Missing required conditions (conditions specified in parameter hierarchy but not
483+
in user document)
484+
* Includes extra conditions (conditions in user document not in parameter
485+
hierarchy)
481486
* Array is not sorted correctly
482487
* Any referenced condition document doesn't exist or is invalid
483488
* Any referenced condition document is revoked
@@ -494,6 +499,7 @@ The document will be rejected if:
494499
**Example:**
495500

496501
A user submitting a Proposal to a Category must accept:
502+
497503
* All conditions from the Contest Parameters (if any)
498504
* All conditions from the Category Parameters (if any)
499505
* All conditions from the Campaign Parameters (if any)

0 commit comments

Comments
 (0)