Skip to content

Commit b62f558

Browse files
docushell-devdocushell-admin
andauthored
Tighten fixture golden change guard (#136)
Signed-off-by: docushell-admin <hello@docushell.com> Co-authored-by: docushell-admin <hello@docushell.com>
1 parent 0826e6c commit b62f558

3 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/scripts/check_golden_change_rationale.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ def is_golden_like(path: str) -> bool:
3131
name = Path(path).name
3232
return (
3333
"/goldens/" in path
34+
or (
35+
path.startswith("fixtures/")
36+
and name
37+
in {
38+
"extraction.json",
39+
"layout.json",
40+
"markdown.md",
41+
"tables.json",
42+
"text.txt",
43+
}
44+
)
3445
or "fingerprint" in name
3546
or name.startswith("expected.")
3647
or name.endswith(".golden.json")
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright 2026 The Ethos maintainers
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
from __future__ import annotations
19+
20+
import importlib.util
21+
import unittest
22+
from pathlib import Path
23+
24+
25+
ROOT = Path(__file__).resolve().parent
26+
SCRIPT = ROOT / "check_golden_change_rationale.py"
27+
28+
29+
def load_module():
30+
spec = importlib.util.spec_from_file_location(
31+
"check_golden_change_rationale_under_test",
32+
SCRIPT,
33+
)
34+
if spec is None or spec.loader is None:
35+
raise RuntimeError(f"could not load {SCRIPT}")
36+
module = importlib.util.module_from_spec(spec)
37+
spec.loader.exec_module(module)
38+
return module
39+
40+
41+
CHECK = load_module()
42+
43+
44+
class GoldenChangeRationaleTests(unittest.TestCase):
45+
def test_fixture_stage_goldens_are_golden_like(self) -> None:
46+
for name in [
47+
"extraction.json",
48+
"layout.json",
49+
"markdown.md",
50+
"tables.json",
51+
"text.txt",
52+
]:
53+
with self.subTest(name=name):
54+
self.assertTrue(
55+
CHECK.is_golden_like(f"fixtures/synthetic/simple-text/{name}")
56+
)
57+
58+
def test_fixture_metadata_is_not_golden_like(self) -> None:
59+
self.assertFalse(
60+
CHECK.is_golden_like("fixtures/synthetic/simple-text/fixture.json")
61+
)
62+
self.assertFalse(CHECK.is_golden_like("fixtures/manifest.json"))
63+
64+
def test_existing_golden_patterns_still_match(self) -> None:
65+
self.assertTrue(
66+
CHECK.is_golden_like("examples/verify/goldens/native_grounded_report.json")
67+
)
68+
self.assertTrue(
69+
CHECK.is_golden_like(
70+
"fixtures/foreign/opendataloader/real/expected.verification_report.json"
71+
)
72+
)
73+
74+
75+
if __name__ == "__main__":
76+
unittest.main()

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- boundary-exception: add `ethos doctor` docs pointer for caller-provided PDFium diagnostics; no PDFium posture or support-boundary change.
6+
- process-follow-up: include synthetic fixture stage goldens in the light-lane golden-change rationale guard; no parser output change.
67
- boundary-exception: prune redundant Milestone E command-index, record-index, source-head, and guard-sequence checks from routine prep and CI after light-check absorbed generic validation.
78
- boundary-exception: pilot centralizes public boundary wording and adds local light-lane gates; no release surface or support boundary changes.
89
- process-follow-up: add npm/crate/pyproject boundary-claim surfaces and align golden detection with export fixtures after the pilot lands.

0 commit comments

Comments
 (0)