Skip to content

Fetch only modified source documents when validating modified declarations - #1290

Open
clementbiron wants to merge 4 commits into
mainfrom
validate-only-modified-source-documents
Open

clementbiron wants to merge 4 commits into
mainfrom
validate-only-modified-source-documents

Conversation

@clementbiron

Copy link
Copy Markdown
Member

Validating modified declarations fetched every source document of a modified terms type, twice each, even when a single entry of its combine changed. Adding 4 documents to the Facebook "Advertising Content Policy" combine refetched its 46 documents: the validation of this pull request took 18 minutes on user-rights, and 64 minutes for the one adding Instagram.

ota validate declarations --modified now compares the declaration that each source document effectively gets on the default branch and on the branch, once the terms properties it inherits are applied as when loading the service, and fetches only the documents whose declaration changed. Documents are indexed by location, so reordering the combine fetches nothing and changing a location is treated as a new document. Terms added in the branch, new services and services whose filters changed keep no restriction, as any of their documents may be impacted.

The checks that do not fetch, such as the detection of duplicate source documents, still cover the whole combine, as an unchanged document can conflict with an added one. The number of skipped documents is logged to make the saving visible in the CI logs:

Terms of Service
  (3 of 4 source documents skipped as unchanged)
  ✔ does not declare the same source document more than once
  https://domain.example/tos/payments
    ✔ fetchable URL

Validating modified declarations fetched every source document of a modified terms type, twice each, even when a single entry of its combine changed. Adding 4 documents to the Facebook "Advertising Content Policy" combine refetched its 46 documents: the validation of this pull request took 18 minutes on user-rights, and 64 minutes for the one adding Instagram.

Comparing the declaration that each source document effectively gets, once the terms properties it inherits are applied as when loading the service, tells which documents changed. Indexing them by location rather than by position keeps reordered documents unchanged and treats a changed location as a new document. Terms added in the branch and services whose filters changed keep no restriction, as any of their documents may be impacted.
The checks that do not fetch, such as the detection of duplicate source documents, still cover the whole combine, as an unchanged document can conflict with an added one. The number of skipped documents is logged to make the saving visible in the CI logs.
Loosening these assertions to deep.include left the new servicesTermsSourceDocuments key unchecked for added terms, added or removed declarations and history-only changes, which are the cases where no restriction must apply.
@clementbiron
clementbiron requested a review from Ndpnt October 29, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant