[l10n/automation] Manifest contract and catalog diff engine#940
Open
Chaitanya-Keyal wants to merge 1 commit into
Open
[l10n/automation] Manifest contract and catalog diff engine#940Chaitanya-Keyal wants to merge 1 commit into
Chaitanya-Keyal wants to merge 1 commit into
Conversation
This was referenced Jun 22, 2026
671b9b8 to
fb2170b
Compare
Adds the review-manifest JSON Schema -- the contract for the data passed from the untrusted PR diff job to the trusted comment job -- and pot_diff.py, which computes a translator-meaningful diff between two gettext catalogs (keyed on msgctxt + msgid + plural, ignoring source-location and header churn) and assembles a manifest conforming to that schema. Includes tests.
fb2170b to
e9ca7cd
Compare
8 tasks
wolgwang1729
reviewed
Jul 5, 2026
| @@ -0,0 +1,119 @@ | |||
| { | |||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | |||
| "$id": "https://seedsigner.com/l10n/schema/review-manifest.schema.json", | |||
There was a problem hiding this comment.
What was the reasoning behind using https://seedsigner.com/l10n/schema/review-manifest.schema.json as the $id? The URL isn't reachable right now. Do you plan to host the schema there eventually?
Comment on lines
+197
to
+202
| payload = json.dumps(manifest, indent=2, ensure_ascii=False) | ||
| if args.out == "-": | ||
| print(payload) | ||
| else: | ||
| with open(args.out, "w", encoding="utf-8") as fh: | ||
| fh.write(payload + "\n") |
There was a problem hiding this comment.
Since ensure_ascii=False is used here, payload can contain raw non-ASCII characters. If the runner's stdout happens to be bound to ASCII, print(payload) would crash with a UnicodeEncodeError.
The file-output path below already handles this correctly with encoding="utf-8".
Should the stdout path do something similar (e.g. writing to sys.stdout.buffer with explicit UTF-8 encoding)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
One of the l10n source-string automation PRs (#940, #941, #942, #943, #944). This PR has no dependencies on the others.
Description
Problem or Issue being addressed
To tell reviewers and translators what a PR changes, we need
(a) a stable, machine-checkable contract for that data and
(b) a diff between two gettext catalogs that reports only translator-meaningful changes, ignoring source-location moves and header churn.
Solution
Adds the foundation for the source-string automation:
schema/review-manifest.schema.json-- the "review manifest" contract (JSON Schema draft 2020-12) for the data passed from the untrusted PR diff job to the trusted comment job. It is strict by design:additionalProperties: false, aconstversion, bounded array/string lengths, and SHA/owner/namepatterns on the trust-anchor fields.pot_diff.py-- keys catalog entries on(msgctxt, msgid)and reports added/removed/changed strings, then assembles a manifest conforming to the schema. Counts are always exact; the per-bucket example lists are capped (and flaggedtruncated) so a huge diff cannot produce an unbounded manifest. The committedmessages.potis never read -- the catalog is extracted fresh from base and head source -- so the result is correct regardless of whether the committed catalog is current.This pull request is categorized as a:
Checklist
I ran
pytestlocally(
python -m pytest l10n/automation/tests-- these tests live outside the project's defaulttestpathsand are run explicitly.)I included screenshots of any new or modified screens
I added or updated tests
I tested this PR hands-on on the following platform(s):
I have reviewed these notes: