Skip to content

DM-54689: push_processor cleanups — bool(changed_paths) + Sequence[str]; payload.get(..., {}) chain #268

@jonathansick

Description

@jonathansick

Metadata

Field Value
Parent PRD #232
Jira Key DM-54689
Jira URL https://rubinobs.atlassian.net/browse/DM-54689
Task Order 23
Type AFK
Blocked by None
Parallel with #266, #267, #269
Branch tickets/DM-54689-github-webhook

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

  • _root_path_matches parameter typed Sequence[str]; body uses bool(changed_paths).
  • process reads repository and owner via two-arg .get(..., {}).
  • Existing push_processor tests pass without modification.
  • uv run --only-group=nox nox -s typing clean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prd-taskImplementation task from a PRD

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions