Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Three jobs run independently:

| Job | Coverage |
| --- | --- |
| Tests and static checks | `make ci-tests`: naming, lint, the complete Python suite, Node UI/native-adapter tests and the fixture smoke test |
| Tests and static checks | `make ci-tests`: review guidance, naming, lint, the complete Python suite, Node UI/native-adapter tests and the fixture smoke test |
| Installation and packaging | Base installation and CLI language checks, sdist/pip installation, wheel smoke checks and all existing optional installation profiles |
| Rendered reference and report checks | Chromium reference capture, report interactions and Web Search visual checks |

The Python suite uses two workers with `--dist loadfile`, keeping each test file in one process. Slow-test durations appear in the job log. Local `make ci` remains serial by default; use `make ci PYTEST_ARGS='-n 2 --dist loadfile --durations=20'` for the same test scheduling.

The checks job also verifies the pinned shared review guide and synchronization tool against `review-guidelines.lock.json`, and confirms that OCR loads the shared guide alongside its built-in rules. This offline integrity check needs no cross-repository credentials. Use `uv run --frozen python scripts/review_guidelines.py check --source <ai-template-py-checkout>` to also compare the files with their recorded source commit. Shared requirements are maintained in `lexmount/ai-template-py`; Browser Eval's review supplement remains in `.opencodereview/review-rules.md`.
`make review-check`, part of both `make ci-tests` and local `make ci`, verifies the pinned shared review guide and synchronization tool against `review-guidelines.lock.json`, and confirms that OCR loads the guide alongside its built-in rules. This offline integrity check needs no cross-repository credentials. Use `uv run --frozen python scripts/review_guidelines.py check --source <ai-template-py-checkout>` to also compare the files with their recorded source commit. Shared requirements are maintained in `lexmount/ai-template-py`; Browser Eval's review supplement is the section after the repository supplement marker at the end of `docs/references/review-guidelines.md`; the lock covers only the text before it, and synchronization preserves it.

The existing `Python 3.11` status succeeds only when all three jobs succeed. A failed, cancelled or skipped job fails that status. New commits cancel obsolete CI runs for the same pull request. Main and tag runs each have a unique concurrency group, so a newer run cannot replace an earlier pending run.

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
node-version: "22"
cache: npm
- run: make setup-test
- name: Verify shared review guidance
run: uv run --frozen --no-sync python scripts/review_guidelines.py check
- run: make ci-tests PYTEST_ARGS='-n 2 --dist loadfile --durations=20'

package:
Expand Down
7 changes: 0 additions & 7 deletions .opencodereview/review-rules.md

This file was deleted.

9 changes: 5 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Code review

Use [Shared Review Guidelines](docs/references/review-guidelines.md) and the
[repository supplement](.opencodereview/review-rules.md). The shared guide is
generated from the commit recorded in `review-guidelines.lock.json`; change
common requirements in `lexmount/ai-template-py` and synchronize the copy.
Use [Review Guidelines](docs/references/review-guidelines.md). Its shared text and
`scripts/review_guidelines.py` are synchronized from the commit recorded in
`review-guidelines.lock.json`; change them in `lexmount/ai-template-py`. Browser
Eval's own requirements follow the repository supplement marker at the end of the
guide and are edited here.

# Benchmark ownership

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ fixture-smoke: runtime-check

test: test-python test-ui test-native-adapters

.PHONY: ci-tests
ci-tests: naming-check lint-check test fixture-smoke
.PHONY: review-check ci-tests
review-check: runtime-check
$(PY) scripts/review_guidelines.py check

ci-tests: review-check naming-check lint-check test fixture-smoke

ci: ci-tests package-check

Expand Down
18 changes: 15 additions & 3 deletions docs/references/review-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ The canonical version of this document lives in `lexmount/ai-template-py` at
`docs/references/review-guidelines.md`. Consumer repositories synchronize their
copies with `scripts/review_guidelines.py` and pin the source revision in
`review-guidelines.lock.json`. Change the canonical document rather than editing
a synchronized copy.
a synchronized copy. A consumer adds its own requirements only after the
repository review supplement marker at the end of its copy; synchronization
preserves that section.

OCR's official rules remain the foundation. This document adds shared review,
scope, and feedback requirements. Read the repository's local review supplement
for its domain requirements. Use the review language required by the user or
scope, and feedback requirements. The repository supplement at the end of this
document, when present, adds the consumer's domain requirements and entry points. Use the review language required by the user or
repository; preserve code identifiers, commands, schema values, and product names.

## Establish the review basis
Expand Down Expand Up @@ -231,3 +233,13 @@ Touching more files during a fix does not require cleaning up every old problem
in those files. The work can close when valid in-scope findings are resolved and
necessary verification passes. Add task requirements only when the user or
repository maintainer explicitly changes the goal.

<!-- Repository review supplement: maintained locally; synchronization preserves the text below. -->

## Browser Eval review supplement

Follow the repository review constraints in `AGENTS.md` and `CONTRIBUTING.md`. The following requirements belong to Browser Eval and supplement the shared criteria above and OCR's built-in rules.

### Repository checks

Keep provider execution and reporting in the harness; use benchmark-owned definitions and scoring. Trace scored answers to native evidence. Verify populations, timing and certification against the selected track contract. Preserve frozen evidence and report targets, keep private run data outside Git, and check report views agree with their evidence.
6 changes: 3 additions & 3 deletions review-guidelines.lock.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": 1,
"repository": "lexmount/ai-template-py",
"revision": "6188715448dfc3f54e721715fd5147daac5b400e",
"revision": "984b8d5319ab3f87b13c2aae38ea9a7c795a3adf",
"files": {
"docs/references/review-guidelines.md": "8eb5da2e3a6a7ea9766bb4131b1d1cc9e6191a49fde8f745bd6148196ced51e1",
"scripts/review_guidelines.py": "c38b6d5d229d875393ed7514d00e11365b98c0c58c4279115c49bd18ace0eaf7"
"docs/references/review-guidelines.md": "98f93a11aefd1e003a778d889a77d9283b49ea786d7db3c38ed04005561cba06",
"scripts/review_guidelines.py": "6732c01ba592f098f32f76bad3ad5bde7d23002fc70a9acde2b16a48f6c0f96c"
}
}
53 changes: 43 additions & 10 deletions scripts/review_guidelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REPOSITORY = "lexmount/ai-template-py"
FILES = ("docs/references/review-guidelines.md", "scripts/review_guidelines.py")
LOCK = "review-guidelines.lock.json"
# A consumer's copy of the guide may end with its own requirements after this
# line. The lock and source comparison cover only the shared text above it.
SUPPLEMENT = b"<!-- Repository review supplement: maintained locally; synchronization preserves the text below. -->"


def git(root: Path, *args: str) -> bytes:
Expand All @@ -23,14 +26,32 @@ def git(root: Path, *args: str) -> bytes:
).stdout


def repository_root(path: Path) -> Path:
return Path(git(path, "rev-parse", "--show-toplevel").decode().strip()).resolve()


def is_source(root: Path) -> bool:
remote = git(root, "remote", "get-url", "origin").decode().strip()
return remote.removesuffix(".git") in (
remote = git(root, "remote", "get-url", "origin").decode().strip().rstrip("/")
remote = remote.removesuffix(".git").replace("ssh://git@github.com/", "git@github.com:")
return remote in (
f"git@github.com:{REPOSITORY}",
f"https://github.com/{REPOSITORY}",
)


def shared_part(path: str, content: bytes) -> bytes:
if path != FILES[0]:
return content
shared, marker, _ = content.partition(SUPPLEMENT)
# Blank lines before the marker separate the sections and are not shared text.
return shared.rstrip(b"\n") + b"\n" if marker else shared


def local_part(path: str, content: bytes) -> bytes:
index = content.find(SUPPLEMENT) if path == FILES[0] else -1
return b"" if index < 0 else b"\n" + content[index:]


def managed_path(root: Path, relative: str) -> Path:
path = root / relative
if path.exists() and not path.is_file():
Expand All @@ -56,7 +77,10 @@ def source_files(source: Path, revision: str) -> dict[str, bytes]:
raise ValueError(f"Source origin must be {REPOSITORY}")
if git(source, "cat-file", "-t", revision).strip() != b"commit":
raise ValueError("The source revision must identify a commit")
return {path: git(source, "show", f"{revision}:{path}") for path in FILES}
contents = {path: git(source, "show", f"{revision}:{path}") for path in FILES}
if local_part(FILES[0], contents[FILES[0]]):
raise ValueError("The canonical guide must not contain a repository supplement")
return contents


def check_routing(root: Path) -> None:
Expand All @@ -74,8 +98,11 @@ def check(root: Path, source: Path | None = None) -> None:
if not is_source(root):
raise ValueError(f"Missing {LOCK}; synchronize from {REPOSITORY}")
for path in FILES:
if not managed_path(root, path).read_bytes().strip():
content = managed_path(root, path).read_bytes()
if not content.strip():
raise ValueError(f"Empty source file: {path}")
if local_part(path, content):
raise ValueError("The canonical guide must not contain a repository supplement")
else:
lock = json.loads(lock_path.read_text())
if lock.get("repository") != REPOSITORY or lock.get("version") != 1:
Expand All @@ -87,7 +114,7 @@ def check(root: Path, source: Path | None = None) -> None:
raise ValueError("The lock must cover the guide and synchronization tool")
upstream = source_files(source, revision) if source is not None else None
for path in FILES:
local = managed_path(root, path).read_bytes()
local = shared_part(path, managed_path(root, path).read_bytes())
if digest(local) != lock["files"][path]:
raise ValueError(f"Local drift: {path}; synchronize, do not edit the copy")
if upstream is not None and local != upstream[path]:
Expand All @@ -104,15 +131,20 @@ def sync(source: Path, revision: str, targets: list[Path]) -> None:
"revision": revision,
"files": {path: digest(data) for path, data in contents.items()},
}
payloads = {**contents, LOCK: (json.dumps(lock, indent=2) + "\n").encode()}
# Validate every destination before changing any of them.
prepared = []
# Validate every destination before writing; repositories are then updated in turn.
for root in targets:
if is_source(root):
raise ValueError("Edit the canonical source directly; do not sync over it")
payloads = {**contents, LOCK: (json.dumps(lock, indent=2) + "\n").encode()}
for path in payloads:
managed_path(root, path)
guide = root / FILES[0]
if guide.exists():
payloads[FILES[0]] += local_part(FILES[0], guide.read_bytes())
check_routing(root)
for root in targets:
prepared.append((root, payloads))
for root, payloads in prepared:
with TemporaryDirectory(prefix=".review-guidelines-", dir=root) as directory:
staged = Path(directory)
for path, data in payloads.items():
Expand All @@ -137,9 +169,10 @@ def main() -> int:
args = parser.parse_args()
try:
if args.command == "check":
check(Path.cwd().resolve(), args.source.resolve() if args.source else None)
source = repository_root(args.source) if args.source else None
check(repository_root(Path.cwd()), source)
else:
sync(args.source.resolve(), args.ref, [p.resolve() for p in args.targets])
sync(repository_root(args.source), args.ref, [repository_root(p) for p in args.targets])
except (OSError, ValueError, KeyError, TypeError, subprocess.CalledProcessError) as exc:
print(f"Review guidance error: {exc}", file=sys.stderr)
return 1
Expand Down
Loading