Skip to content

fix(overview_metrics): opt-in strict counts (ISSUE-123) - #448

Merged
dwolfson merged 1 commit into
odpi:mainfrom
dwolfson:fix/issue-123-strict-counts
Oct 13, 2026
Merged

dwolfson merged 1 commit into
odpi:mainfrom
dwolfson:fix/issue-123-strict-counts

Conversation

@dwolfson

Copy link
Copy Markdown
Member

Summary

count_elements and its siblings turn a failed query into 0, so an outage or auth failure looks like an empty catalog (ISSUE-123). This adds an opt-in strict flag and leaves the default alone.

  • strict=False (default): unchanged, a failure counts as 0.
  • strict=True: returns None when the count is not known:
    • the fallback find_metadata_elements query raised;
    • it returned something that is neither a list nor pyegeria's miss string;
    • it returned a full page (DEFAULT_CAP), which is only a lower bound.
  • A native count is trusted as is, even above the cap. A real zero (an empty list, or "No elements found") is still 0.
  • Each None logs a warning that says why.
  • Covers count_elements, count_elements_by_property, counts_by_type, people_counts and usage_context_counts.
  • strict is declared on those five analytic-registry entries, so a report spec can pass it.
  • PYEGERIA_ISSUES.md: ISSUE-123 is moved to Fixed.

Closes #424

Test plan

  • New tests/micro-tests/test_issue_123_strict_counts.py
  • pytest tests/micro-tests: 1085 passed, 1 skipped

🤖 Generated with Claude Code

…ured (ISSUE-123)

count_elements, count_elements_by_property, counts_by_type, people_counts and
usage_context_counts take strict=False by default (unchanged: a failed query
counts as 0). With strict=True they return None when the fallback query
failed or answered unexpectedly, or when it hit DEFAULT_CAP (a lower bound).
A native count and a real zero are still numbers. strict is declared on the
five analytic-registry entries so report specs can pass it.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
@dwolfson
dwolfson merged commit 9d4646d into odpi:main Oct 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

overview_metrics.count_elements returns 0 on any failure (indistinguishable from a real zero)

1 participant