synology_apm_repo.sdk.dedup.verify_report module

Grouping and a stable render order for a batch of Findings from one Repository.verify()/Catalog.verify() run — the presentation-adjacent logic that turns a flat list into “same root cause” groups, shared by every frontend that lists Findings this way (the CLI’s own verify command and the TUI’s own diagnostics screen both use it).

Kept here, next to verify_checks.py’s own Finding/Stage/ Symptom definitions, rather than in presentation/ — that package is a true leaf with zero internal imports of its own (see ARCHITECTURE.md’s Presentation section), and this module needs Finding, which lives one layer up, in dedup.

synology_apm_repo.sdk.dedup.verify_report.sort_key(finding)

A stable, deterministic order for a batch of Findings: chronological (by the version-display-name timestamp embedded in path) for a genuine per-version finding, alphabetical by whole path for everything else (RepoInfo/FileMap/Composition/EncryptKey, a Bucket finding not tied to one version, and a Stage.VERSION finding that isn’t per-version either — a connection/workload enumeration failure or a PC/PS per-disk failure, neither of which ends in a timestamp). Also what makes --level full’s own multiprocess bucket sweep produce a stable order despite not otherwise guaranteeing one.

class synology_apm_repo.sdk.dedup.verify_report.AugmentedFinding(finding, ref_value, template, variable_parts)

Bases: object

One Finding plus the ref/template/variable-parts signal group_findings’s own grouping and every caller’s rendering both need, computed once here rather than independently re-derived once per consumer (once during grouping, again per group representative at render time).

Variables:
  • finding (synology_apm_repo.sdk.dedup.verify_checks.Finding) – The underlying Finding.

  • ref_value (str | None) – This finding’s own embedded [ref=...] value, or None for the minority of raise sites that never attach one (units/fs.py, units/saas/objectdb.py).

  • template (str) – finding.detail with its instance-specific values placeholdered away, keeping an embedded [ref=...] tag visible exactly when ref_value is not None — this one keep_ref choice is what lets a single field serve both group_findings’s own ref_value is None fallback discriminator and a group header’s own display, which wants the ref tag kept visible when there is one.

  • variable_parts (str) – The instance-specific values template replaced, in order, joined for display under a group’s shared header — the part of finding.detail that still differs per instance, with ref_value itself omitted (the header already shows it once).

finding: Finding
ref_value: str | None
template: str
variable_parts: str
synology_apm_repo.sdk.dedup.verify_report.group_findings(findings)

Buckets findings (expected already sorted by sort_key) by _group_key — findings that resolve to the same key (the same ref, or the same normalized-template fallback) land in the same group. Groups themselves are then sorted by that same key (stage, then symptom, then the ref/template discriminator itself) rather than left in first-member-encountered order: two groups sharing a stage and symptom otherwise interleave by whichever member happened to sort chronologically first, which — for a SaaS stream’s own sequential ref values — can put e.g. .../1/16/saas_obj ahead of .../1/14/saas_obj merely because one workload’s display name happens to sort before the other’s. Sorting groups by their own ref/template value directly avoids that, at the cost of no longer being purely chronological across groups (each group’s own members stay chronological either way, unaffected by this).

Returns:

Each finding wrapped in its own AugmentedFinding, so the ref/template/variable-parts signal is computed once here instead of being re-derived independently by each caller that renders these groups.

Return type:

list[list[AugmentedFinding]]

synology_apm_repo.sdk.dedup.verify_report.group_count_label(group)

"<N> version(s)" for a per-version Stage.VERSION group, else "<N> occurrence(s)" — the pluralized member-count label every group_findings renderer shows under a group’s own header.