|
| 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 ` ` 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 | +## Technical upgrade markers |
| 119 | + |
| 120 | +Versions created during technical upgrades are marked with: |
| 121 | + |
| 122 | +- `isTechnicalUpgrade: true` in version metadata |
| 123 | +- Commit message specify it by starting by `Apply technical or declaration upgrade on <service_id> <terms_type>` |
| 124 | + |
| 125 | +## Running technical upgrades |
| 126 | + |
| 127 | +Technical upgrades run automatically with `npx ota track`. |
| 128 | + |
| 129 | +To run them separately, see the [apply-technical-upgrades command]({{< relref "api/cli#applying-technical-upgrades" >}}). |
0 commit comments