Skip to content

Commit 634b433

Browse files
committed
Document technical upgrades process
1 parent a0d35a6 commit 634b433

File tree

2 files changed

+150
-1
lines changed

2 files changed

+150
-1
lines changed

content/api/cli.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In these commands:
1414

1515
## Tracking terms
1616

17-
{{< refItem name="ota track" description="Track the current terms of services according to provided declarations. The declarations, snapshots and versions paths are defined in the configuration." example="npx ota track" />}}
17+
{{< refItem name="ota track" description="Track the current terms of services according to provided declarations. The declarations, snapshots and versions paths are defined in the configuration. This command automatically runs a technical upgrade pass first to apply any engine, dependency, or declaration updates before tracking." example="npx ota track" />}}
1818

1919
> Note that the snapshots and versions will be recorded at the moment the command is executed, on top of the existing local history. If a shared history already exists and the goal is to add on top of it, that history has to be downloaded before executing that command.
2020
@@ -26,6 +26,16 @@ In these commands:
2626

2727
{{< refItem name="ota track --schedule [--services <service_id>...] [--types <terms_type>...]" description="Track terms on the schedule defined in the configuration" example="npx ota track --schedule" />}}
2828

29+
## Applying technical upgrades
30+
31+
{{< refItem name="ota apply-technical-upgrades" description="Apply technical upgrades by regenerating versions from existing snapshots with updated declarations/engine. This also fetches missing snapshots for newly added source documents in combined terms. Versions created during this process are labeled as technical upgrades to avoid false notifications." example="npx ota apply-technical-upgrades" />}}
32+
33+
{{< refItem name="ota apply-technical-upgrades --help" description="Show help and available options for apply-technical-upgrades command" example="npx ota apply-technical-upgrades --help" />}}
34+
35+
{{< refItem name="ota apply-technical-upgrades [--services <service_id>...]" description="Apply technical upgrades to specific services only" example="npx ota apply-technical-upgrades --services \"Facebook\" \"LinkedIn\"" />}}
36+
37+
{{< refItem name="ota apply-technical-upgrades [--services <service_id>...] [--types <terms_type>...]" description="Apply technical upgrades to specific terms types of specific services only" example="npx ota apply-technical-upgrades --services \"Facebook\" \"LinkedIn\" --types \"Privacy Policy\" \"Terms of Service\"" />}}
38+
2939
## Validating declarations
3040

3141
{{< refItem name="ota validate declarations [--services <service_id>...] [--types <terms_type>...]" description="Check that all declarations allow recording a snapshot and a version properly. If service IDs are provided, check only those services." example="npx ota validate declarations --services \"Facebook\" --types \"Privacy Policy\"" />}}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: "Technical upgrades"
3+
weight: 5
4+
---
5+
6+
# Technical upgrades
7+
8+
## What is the technical upgrades process
9+
10+
The **technical upgrade** process creates new **versions** by re-extracting content from the **latest snapshots** when there are changes not in service terms content, but in the system that extracts them (declarations, filters, engine, or dependencies).
11+
12+
## Why technical upgrades are important
13+
14+
Technical upgrades solve the critical problem of **distinguishing between actual content changes and extraction improvements**.
15+
16+
Without technical upgrades, improving a declaration would trigger false notifications. For example, if terms have sections A, B, and C but the declaration only extracted A and B, adding section C would make the next version appear to include new content, triggering a notification even though the service's terms never changed.
17+
18+
With technical upgrades, the system re-extracts from the current snapshot using the improved declaration and creates a new version, that includes section C, marked as a technical upgrade. Next regular tracking then compares against this upgraded version, so only actual content changes trigger notifications.
19+
20+
## How technical upgrades work
21+
22+
For each tracked terms:
23+
24+
1. Retrieve the latest snapshot for each source document of the terms
25+
2. Re-extract content using latest declarations and engine code
26+
3. Create a new version marked as a technical upgrade
27+
28+
## Types of changes handled
29+
30+
1. Declaration changes: updates to selectors, filters, or removal rules
31+
2. Engine changes: updates to the core extraction logic
32+
3. Dependency changes: updates to libraries affecting extraction (e.g., HTML-to-Markdown conversion)
33+
34+
## Behavior for different scenarios
35+
36+
### Selector or filter changes
37+
38+
**Example:**
39+
40+
```json
41+
// Before: missing section C
42+
{
43+
"Privacy Policy": {
44+
"fetch": "https://example.com/privacy",
45+
"select": ".section-a, .section-b"
46+
}
47+
}
48+
49+
// After: includes all relevant sections
50+
{
51+
"Privacy Policy": {
52+
"fetch": "https://example.com/privacy",
53+
"select": ".section-a, .section-b, .section-c"
54+
}
55+
}
56+
```
57+
58+
**What happens:**
59+
60+
- Retrieves the latest snapshot
61+
- Re-extracts content using updated selectors and/or filters
62+
- Creates a new version marked as a technical upgrade
63+
64+
### Adding new source documents to combined terms
65+
66+
**Example:**
67+
68+
```json
69+
// Before: 2 source documents
70+
{
71+
"Community Guidelines": {
72+
"combine": [
73+
{ "id": "main", "fetch": "https://example.com/community" },
74+
{ "id": "hate-speech", "fetch": "https://example.com/community/hate-speech" }
75+
]
76+
}
77+
}
78+
79+
// After: 3 source documents
80+
{
81+
"Community Guidelines": {
82+
"combine": [
83+
{ "id": "main", "fetch": "https://example.com/community" },
84+
{ "id": "hate-speech", "fetch": "https://example.com/community/hate-speech" },
85+
{ "id": "violence", "fetch": "https://example.com/community/violence" } // NEW
86+
]
87+
}
88+
}
89+
```
90+
91+
**What happens:**
92+
93+
- Fetches and records snapshots **only for new source documents**
94+
- Retrieves latest snapshots for existing source documents
95+
- Extracts all documents and creates one new combined version marked as a technical upgrade
96+
97+
### Location changes
98+
99+
**What happens:**
100+
101+
Nothing, technical upgrades do not fetch from new locations. Location changes represent a genuine change in how the service publishes their terms and should be tracked as a regular content change.
102+
103+
### Engine and dependency changes
104+
105+
When you upgrade the engine or dependencies, extraction logic may change even if declarations remain the same.
106+
107+
**Examples:**
108+
109+
- Engine improves HTML entity decoding so `&nbsp;` entities are converted to regular spaces instead of appearing literally in versions
110+
- Library improves table support so complex tables preserve their structure as Markdown tables instead of being converted to plain text
111+
112+
**What happens:**
113+
114+
- Retrieves the latest snapshot for each terms
115+
- Re-extracts using updated code
116+
- Creates a new version marked as a technical upgrade if output differs
117+
118+
### Special cases
119+
120+
**No existing version:** For terms that have never been tracked before, the technical upgrade is skipped because there is no existing version to upgrade.
121+
122+
**Missing snapshots:** Technical upgrades cannot extract content without snapshots. If a source document has no snapshot, no version can be created. However, for combined terms, if you add a new source document to the declaration, technical upgrades will fetch and record snapshots only for these newly added documents, then combine them with existing snapshots to create the upgraded version.
123+
124+
## Technical upgrade markers
125+
126+
Versions created during technical upgrades are marked with:
127+
128+
- `isTechnicalUpgrade: true` in version metadata
129+
- Commit message specify it by starting by `Apply technical or declaration upgrade on …`
130+
131+
## Running technical upgrades
132+
133+
Technical upgrades run automatically with `npx ota track`.
134+
135+
To run them separately:
136+
137+
```bash
138+
npx ota apply-technical-upgrades
139+
```

0 commit comments

Comments
 (0)