Skip to content

fix(overview-metrics): scans read every page or report nothing; a failed viewer count is None - #565

Merged
dwolfson merged 3 commits into
odpi:mainfrom
dwolfson:fix/capped-scans-and-viewer-none
Nov 9, 2026
Merged

dwolfson merged 3 commits into
odpi:mainfrom
dwolfson:fix/capped-scans-and-viewer-none

Conversation

@dwolfson

@dwolfson dwolfson commented Nov 9, 2026

Copy link
Copy Markdown
Member

Scans read every page, or report nothing; a failed viewer count is None, not 0. For pyegeria 6.2.28. This follows the Architect's HIGH finding in the 6.2.27 live read-back (READBACK-6.2.27-live-2026-11-08.md, lines 34–43), in the same area as #555.

Branch fix/capped-scans-and-viewer-none off upstream/main 0fdf951 (#563). Two commits:

  • 507e873 (B): a failed viewer count is None with a note, never 0.
  • 0013963 (A): scans read every page, or report nothing.

No Egeria writes. No version bump.

A. Capped scans reported as numbers

A figure computed from a scan is only a figure when the scan read everything.

  • orphan_glossary_terms read one 500-relationship SemanticAssignment page. That page held 8 distinct terms, so orphanCount read 1,053. All 747 relationships hold 77 terms, so the count is 984 (confirmed live, below).
    • The new _all_relationships() pages until Egeria returns an empty page. Egeria's paging contract: a short page is not the last page.
    • It dedupes by relationship GUID.
    • It always puts startFrom/pageSize (and asOfTime) in the body. ClassificationExplorer.get_relationships ignores its start_from/page_size arguments whenever a body is given, so the old as_of scans were not paging at all.
  • stale_assets reported staleCount 0 from a full 500-Asset page, beside a not-measured assetTotal. A full page of Assets is a sample, not the catalog. staleCount is now None with an unmeasured note. The Asset population (about 27,000) is too large to page through on every dashboard load.
  • A scan that cannot finish is not measured. That means more than MAX_SCAN_PAGES pages (40 × 500), or a server that repeats its page (startFrom ignored). The result is None with a note, never a figure from the part the scan read.

Audit: every analytic routine that scans a page and reports a count

routine what it scanned now
orphan_glossary_terms one SemanticAssignment page fixed: paged to an empty page; incomplete → None + note
stale_assets one Asset find page now None + note when the page is full
ai_ready_assets one Asset find page + one DataFlow page now None + note (capped: true) when the Asset page is full; DataFlow paged
drl_readiness_gates same as ai_ready_assets now None + note (capped: true); DataFlow paged
governed_coverage one find page (governedCount 500, governedCapped: true) fixed: paged (_all_elements); governedCapped false when measured
ownership_coverage one find page fixed: paged
karma_leaderboard one ContributionRecord page (top-N of one page) fixed: paged; incomplete → [] + note
certifications_summary one Certification page fixed: paged; incomplete → active/expiring90 None + note
contextualised_coverage one ImplementedBy page fixed: paged
solution_component_realisation one ImplementedBy page fixed: paged
active_contributors one page per feedback type fixed: paged; incomplete type → None, contributors None
engagement_series one page per feedback type; a failed type read as zeros fixed: paged; failed or incomplete type → None in every week, and so is each week's total
count_relationships (viewer population) one page, None + note when full (#555) fixed: paged, so a viewer count past 500 is now a number
count_elements / _by_property viewer fallback one find page, None + note when full (#555) already None + note; unchanged (a count has no reason to page the find)
term_definition_completeness, semantic_grounding, context_readiness_funnel, business_value_signals, feedback_summary (repository) native counts since #556 already native, no scan

Registry cost lines, completeness labels (governedCapped, ownershipCapped, capped), the stale_assets measure and its not_measured sentence, and the demo-spec descriptions now say what is read.

B. A failed viewer count is None, not 0

  • _element_count in the viewer population (or scope=None) returned 0 when the find fallback itself failed, unless strict=True. It is now None with an unmeasured note, strict or not, as a failed repository count already was.
  • strict is still accepted and changes nothing. The registry's strict param says so.
  • Docs:
  • Callers that do arithmetic, checked in pyegeria:
    • sum_counts gives total None when any row is None.
    • contextualised_coverage guards its pct on a truthy total.
    • people_counts, usage_context_counts and counts_by_type only place the value in a dict.
    • _count_cell (asset_composition) already handles None.
    • No demo spec divides a viewer count.
    • The Portal and ai-context have been None-safe since egeria-workspaces#807.

Live before/after (read-only)

Method:

  • 2026-11-09, qs-view-server, user resourceexplorernpa, default 30 s client timeout.
  • Before = upstream/main 0fdf951, loaded as a separate module. After = this branch.
  • The same EgeriaTech serves both slots.
routine before (0fdf951) after (this PR)
orphan_glossary_terms 14.8 s: termTotal 1,061, referenced 8, orphans 1,053 16.2 s: termTotal 1,061, referenced 77, orphans 984 (matches the read-back's paged figure)
stale_assets 34.4 s: staleCount 0, assetTotal None 38.1 s: staleCount None, assetTotal None. Note: "the find stopped at its 500-element page cap, so this figure would describe only the first 500 elements"
ai_ready_assets 20.9 s: aiReadyCount 0, total 500, capped true 2.1 s: aiReadyCount None, total None, capped true, with a note. It no longer reads DataFlow for a sample
drl_readiness_gates 17.3 s: total 500, aiReady 0, recent 0 2.1 s: all None, capped true, with a note
governed_coverage 4.6 s: governedCount 500, capped true, fully 10, zone-only 490 6.6 s: governedCount 884, capped false, fully 11, zone-only 873
ownership_coverage 4.0 s: 422 3.4 s: 422 (was under one page)
certifications_summary 12.5 s: active 10, expiring 0, licenses 243, exceptions 252 13.2 s: unchanged
contextualised_coverage 45.4 s: contextualisedCount 120 (Asset viewer total timed out) 94.5 s: contextualisedCount 258 (same timeout)
solution_component_realisation 42.2 s: total 673, realised 10 49.5 s: total 673, realised 222
active_contributors 2.7 s: 2 2.3 s: 2
engagement_series (12 weeks) 5.4 s: sum 61 3.1 s: sum 61
karma_leaderboard 0.7 s: top Peter Profile 23,929 1.8 s: same top (under one page)
B: count_elements(population="viewer") whose query fails (unknown type) 0 None, with the note "the native count failed (PyegeriaAPIException), and the find fallback failed"

Five routines reported a different number: orphan terms, governed elements, contextualised Assets, realised components, and (as not measured) stale/AI-ready. The others were already under one page live, so they are unchanged.

Cost: solution_component_realisation runs the same paged ImplementedBy scan, and it is 7 s slower (42.2 → 49.5 s). So that is roughly what reading every page costs on this catalog. contextualised_coverage went from 45.4 to 94.5 s. Most of that gap is its viewer Asset total (a 30 s native timeout, then the find fallback), which varies between runs and is not changed here. That total is the existing mixed-population item listed under Follow-ups.

Tests

  • uv run -p 3.13 pytest tests/micro-tests/ (Python 3.13.2), JUnit counts: at 0013963, 2,398 collected, 2,395 passed, 3 skipped, 0 failed. At 507e873 (B alone): 2,379 collected, 2,376 passed, 3 skipped, 0 failed.
  • New test_capped_scans_not_counts.py (16 tests). Every one except test_a_short_asset_page_is_counted (a control) fails on the old module (checked). It covers:
    • orphan terms paged to 77/984;
    • a short page is not the last page;
    • an incomplete scan is None with its words;
    • the body carries startFrom/pageSize/asOfTime;
    • a full Asset page is not a stale count;
    • ai_ready/drl on a full page measure nothing;
    • lineage found on page 2;
    • governed/ownership/karma/certifications/ImplementedBy/contributors page past 500;
    • an engagement type that failed is None, never zeros.
  • test_capped_count_not_measured.py:
    • A failed viewer count is None with a note, strict or not.
    • A viewer relationship count reads every page.
    • A server that repeats its page is not a count.
    • MAX_SCAN_PAGES stops a scan, with its note.
  • test_issue_123_strict_counts.py: the viewer zero contract is now None.
  • Existing fakes now page like Egeria (rows from startFrom, then an empty page): _pages/_by_type in test_overview_metrics.py, and the _clients() fixture in test_rs_w2_1a. Sequence-based fakes are now keyed by relationship type.
  • ruff: clean on the changed code. The one remaining finding (an unused Callable import) pre-exists.

Consumers (not changed here)

  • Output shapes are unchanged. The values that change are these:
    • ai_ready_assets/drl_readiness_gates → None + capped: true on a full Asset page (live, every time today).
    • stale_assets.staleCount → None on a full Asset page.
    • engagement_series fields → None for a failed type.
    • karma_leaderboard → [] + a note when its scan cannot finish.
  • Any consumer that renders those must handle None (the #807 rule).
  • Cost: the relationship scans now read every page. ImplementedBy, for example, is now several pages instead of one; see the times in the table.

Follow-ups (not changed here)

  • The Asset-scan routines (stale_assets, ai_ready_assets, drl_readiness_gates) cannot be measured on a catalog over 500 Assets. Making them measurable needs native counts Egeria does not offer yet: an update-time filter, and "has DataFlow". Alternatively a bounded background scan could cache the answer.
  • contextualised_coverage (and stale_assets) divide by a viewer-population Asset total. Live, that count times out at 30 s and then fills a find page, so contextualisedPct is never measured on this catalog. That is unchanged since feat(overview-metrics): totals count the whole repository (push-down) by default #556; it needs the zone-aware push-down.
  • _find() in overview_metrics has no callers left.

🤖 Generated with Claude Code

…er 0

count_elements / count_elements_by_property (and counts_by_type,
people_counts, usage_context_counts) returned 0 in the viewer population
when the find fallback itself failed, unless strict=True. A 0 there reads
as "none of them". It is now None with an unmeasured note, strict or not,
as a failed repository count already was. strict is still accepted and
changes nothing; the registry's strict param says so.

Docs: the odpi#562 sentence in output-formats-and-report-specs.md and the
6.2.27 release note no longer say the viewer 0 survives; new 6.2.28
release note.

pyegeria's own callers are None-safe: sum_counts gives total None when a
row is None, contextualised_coverage's pct guards on a truthy total, and
the composites only place the value in a dict.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
A figure computed from a scan is only a figure when the scan read
everything (Architect read-back, READBACK-6.2.27-live-2026-11-08).

- orphan_glossary_terms read one 500-relationship SemanticAssignment
  page, which held 8 distinct terms, and reported 1,053 orphans; all 747
  relationships hold 77 terms, so 984. New _all_relationships() pages
  until Egeria returns an EMPTY page (a short page is not the last page),
  dedupes by relationship GUID, and always puts startFrom/pageSize (and
  asOfTime) in the body: get_relationships ignores start_from/page_size
  whenever a body is given, so the as_of scans were not paging at all.
- stale_assets reported staleCount 0 from a full 500-Asset page beside a
  not-measured assetTotal. A full Asset page is a sample: staleCount is now
  None plus an unmeasured note. ai_ready_assets and drl_readiness_gates do
  the same (capped: true) instead of reporting the sample's figures.
- Every other page scan is paged to exhaustion: certifications_summary,
  contextualised_coverage, solution_component_realisation,
  active_contributors, engagement_series, the DataFlow lineage scans,
  count_relationships in the viewer population, and the governed /
  ownership / karma finds (new _all_elements()).
- A scan that cannot finish -- more than MAX_SCAN_PAGES (40) pages, or a
  server that repeats its page -- is None plus a note, never a figure
  from the part it read.
- engagement_series: a failed type was a row of zeros; it is now None in
  every week, as is each week's total.

Registry cost lines, completeness labels and demo-spec descriptions say
what is read now. Tests: test_capped_scans_not_counts.py (each fails on
the old module), and the existing fakes now page like Egeria.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	docs/release-notes/6.2.28.md
@dwolfson
dwolfson merged commit d182efe into odpi:main Nov 9, 2026
6 checks passed
dwolfson added a commit to dwolfson/egeria-python that referenced this pull request Nov 9, 2026
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	docs/release-notes/6.2.28.md
dwolfson added a commit to dwolfson/egeria-python that referenced this pull request Nov 9, 2026
…ilter-kwargs

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	docs/release-notes/6.2.28.md
#	pyegeria/omvs/asset_catalog.py
#	pyegeria/view/format_set_executor.py
#	pyegeria/view/microflow.py
#	tests/micro-tests/test_rs_egeria_tier.py
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.

1 participant