Metadata
Origin
Review of PR #264
What to build
Two small style fixes in src/docverse/services/dashboard_templates/push_processor.py:
_root_path_matches at line ~196 uses any(True for _ in changed_paths) to non-emptiness-check changed_paths. The parameter is currently typed Iterable[str]. Replace the expression with bool(changed_paths) and narrow the type to Sequence[str] so the bool check is sound (a generator is consumed by any; bool() on a generator is always True).
process at line ~75 chains payload.get("repository") or {} and repo.get("owner") or {}. The two-arg .get(..., {}) form reads cleaner.
The two callers of _root_path_matches already pass the materialized list[str] from _resolve_changed_paths, so narrowing to Sequence[str] is safe — no caller changes required.
Approach sketch
_root_path_matches(root_path: str, changed_paths: Sequence[str]) -> bool. Use bool(changed_paths) for the empty-check branch.
process reads repository = payload.get("repository", {}) and owner = repository.get("owner", {}).
Acceptance criteria
Metadata
tickets/DM-54689-github-webhookOrigin
Review of PR #264
What to build
Two small style fixes in
src/docverse/services/dashboard_templates/push_processor.py:_root_path_matchesat line ~196 usesany(True for _ in changed_paths)to non-emptiness-checkchanged_paths. The parameter is currently typedIterable[str]. Replace the expression withbool(changed_paths)and narrow the type toSequence[str]so the bool check is sound (a generator is consumed byany;bool()on a generator is alwaysTrue).processat line ~75 chainspayload.get("repository") or {}andrepo.get("owner") or {}. The two-arg.get(..., {})form reads cleaner.The two callers of
_root_path_matchesalready pass the materializedlist[str]from_resolve_changed_paths, so narrowing toSequence[str]is safe — no caller changes required.Approach sketch
_root_path_matches(root_path: str, changed_paths: Sequence[str]) -> bool. Usebool(changed_paths)for the empty-check branch.processreadsrepository = payload.get("repository", {})andowner = repository.get("owner", {}).Acceptance criteria
_root_path_matchesparameter typedSequence[str]; body usesbool(changed_paths).processreadsrepositoryandownervia two-arg.get(..., {}).push_processortests pass without modification.uv run --only-group=nox nox -s typingclean.