Skip to content

fix(tools): request updatedAt so the stats events cache can go stale - #1305

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/stats-events-cache-staleness
Sep 21, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/stats-events-cache-staleness

Conversation

@potiuk

@potiuk potiuk commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary

fetch_events.py will not trust a cached events file that is older than the issue's last update:

upd = UPDATED_AT.get(n)
if upd is None or os.path.getmtime(out_path) >= upd:
    return (n, True, "cached")

UPDATED_AT is built from updatedAt in issues.json — but fetch_issues.py never requested that field. So the lookup always yielded None, the upd is None branch always fired, and every issue relabelled after its first fetch kept its stale event history indefinitely.

Nothing errors when this happens. The renderer reconstructs lifecycle bands from labels_open_at(), so the dashboard reports band counts built on outdated label history while looking entirely healthy.

Observed on a live tracker: an issue had needs triage removed hours earlier, and the dashboard still counted it in open_untriaged. Deleting that one cached events file and re-rendering moved it — open_untriaged 8 → 7, open_pr_merged 10 → 11. Every adopter who has run the dashboard more than once is affected for any tracker relabelled since its first fetch.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Test plan

  • tests/test_fetch_fields.py added — pins the coupling between the two scripts
  • Verified the new test fails without the field and passes with it
  • Full tool suite: 139 passed
  • prek run --files <changed> — exit 0, zero failures

The test asserts the coupling rather than either script alone, because the failure mode is silent: if the field is dropped again, no exception is raised anywhere and only the numbers are wrong.

Generated-by: Claude Code (Opus 5)

`fetch_events.py` refuses to trust a cached events file older than the
issue's last update, reading `updatedAt` out of `issues.json`. But
`fetch_issues.py` never requested that field, so the lookup always
yielded `None`, the guard always took its "no timestamp, trust the
cache" branch, and every issue relabelled after its first fetch kept
stale event history indefinitely.

Nothing errors when this happens. The dashboard just reports lifecycle
bands reconstructed from outdated label history -- observed on a tracker
that had moved out of `open_untriaged` hours earlier and still showed
the old count.

Adds the field, and a test that pins the coupling between the two
scripts so the guard cannot be silently disabled again.

Generated-by: Claude Opus 5
@potiuk potiuk added family:tools tools/* capability:fix Implement code change to resolve an issue labels Sep 21, 2026
@potiuk
potiuk merged commit e904893 into apache:main Sep 21, 2026
8 checks passed
@potiuk
potiuk deleted the fix/stats-events-cache-staleness branch September 21, 2026 00:54
potiuk added a commit to potiuk/magpie that referenced this pull request Sep 21, 2026
The marker sat at 0e7012b, where apache#1306 left it, while apache#1305 and
apache#1307-apache#1310 landed on top. Reviewing that delta:

- apache#1305 (stats events cache `updatedAt`) and apache#1307 (dev version bump)
  touch no behaviour any spec describes; no spec references
  `fetch_issues` or the events cache.
- apache#1308, apache#1309 and apache#1310 are the vetted-ops sandbox work, and the
  `excludedCommands` section this branch already rewrites is where
  they belong. That rewrite covers all three.

So the delta is documented and the marker can move. This is the
by-hand route AGENTS.md allows for a small known gap, not a full
`loop.sh update` pass — it reconciles these five commits rather than
re-auditing every skill, tool and modes.md row.

Generated-by: Claude Opus 5
@potiuk potiuk added the substrate:analytics Tool substrate: read-only metrics / dashboards / renderers label Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:fix Implement code change to resolve an issue family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant