Skip to content

Add weekly metrics workflow (AFP coverage + performance) published to the README#12

Merged
christiankissig merged 4 commits into
masterfrom
metrics-action
Jun 3, 2026
Merged

Add weekly metrics workflow (AFP coverage + performance) published to the README#12
christiankissig merged 4 commits into
masterfrom
metrics-action

Conversation

@christiankissig

Copy link
Copy Markdown
Owner

Summary

A new metrics GitHub Actions workflow that measures parser coverage and performance against the latest AFP release and publishes the figures into the README. Independent of normal CI.

When it runs

  • Weekly cron — 0 4 * * 1 (Mon 04:00 UTC)
  • Manual workflow_dispatch (with an optional sample size input)
  • Not on push, so it never interferes with the test workflow.

What it measures (metrics/measure.py)

A seeded random sample of AFP .thy files is parsed with a per-file timeout; results → metrics/metrics.json:

  • Parse coverage (% of sampled files that parse OK)
  • Timeout % (Earley blow-up guard)
  • Throughput (files/s, MB/s) and median parse time

The corpus

metrics/fetch_corpus.sh downloads afp-current.tar.gz and extracts it to corpus/ (gitignored). Cached with a per-ISO-week key — refreshes weekly, reused for same-week re-runs; a new week is a genuine miss that pulls the latest release.

Publishing into the README

metrics/update_readme.py rewrites the block between .. METRICS:START / .. METRICS:END markers in README.rst with an RST list-table. The job commits it back:

  • pushes with the default GITHUB_TOKEN (does not retrigger workflows) + [skip ci] belt-and-suspenders;
  • || { echo "no changes"; exit 0; } keeps no-op weeks green;
  • permissions: contents: write.

Notes

  • Scheduled workflows run from the default branch (master), so this takes effect once merged.
  • Local end-to-end test against the 2026-06 AFP produced a valid, docutils-clean RST table.
  • metrics/*.py pass ruff / ruff format / isort / mypy.
  • Code coverage continues to go to Codecov from the existing CI; this workflow is specifically the AFP corpus coverage + performance.

🤖 Generated with Claude Code

christiankissig and others added 4 commits June 3, 2026 09:51
A new `metrics` GitHub Actions workflow measures parser coverage and
performance against the latest AFP release and publishes the figures into
the README:

- Triggers: weekly cron (Mon 04:00 UTC) + manual workflow_dispatch (with
  an optional sample-size input). Not on push, so normal CI is unaffected.
- Corpus: downloads afp-current.tar.gz via metrics/fetch_corpus.sh,
  cached per ISO week (refreshes weekly, reused for same-week re-runs).
- Measurement: metrics/measure.py parses a seeded random sample with a
  per-file timeout and records coverage %, timeout %, throughput, and
  median parse time to metrics/metrics.json.
- Publishing: metrics/update_readme.py rewrites the block between the
  `.. METRICS:START` / `.. METRICS:END` markers in README.rst with an RST
  table; the job commits it back with the default GITHUB_TOKEN and
  `[skip ci]` (no workflow retrigger), staying green on no-op weeks.

corpus/ is gitignored. The metrics scripts pass ruff/isort/mypy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI's mypy flagged the re.subn lambda's overload resolution as bytes.
Replace the regex-callable replacement with a plain marker splice; drop
the now-unused re import.
Found by actually running the fetch: 'tar -tzf | head -1' under
set -o pipefail makes tar receive SIGPIPE (head closes early), failing
the pipeline and aborting before extraction. Detect the release name
from the extracted directory instead (drop --strip-components so the
afp-* dir is present); verified end-to-end against the live AFP tarball
(10098 .thy files, version afp-2026-06-01, idempotent re-run).
@christiankissig christiankissig merged commit 874eba7 into master Jun 3, 2026
6 checks passed
@christiankissig christiankissig deleted the metrics-action branch June 3, 2026 09:28
christiankissig added a commit that referenced this pull request Jul 7, 2026
… the README (#12)

* Add weekly metrics workflow (AFP coverage + performance)

A new `metrics` GitHub Actions workflow measures parser coverage and
performance against the latest AFP release and publishes the figures into
the README:

- Triggers: weekly cron (Mon 04:00 UTC) + manual workflow_dispatch (with
  an optional sample-size input). Not on push, so normal CI is unaffected.
- Corpus: downloads afp-current.tar.gz via metrics/fetch_corpus.sh,
  cached per ISO week (refreshes weekly, reused for same-week re-runs).
- Measurement: metrics/measure.py parses a seeded random sample with a
  per-file timeout and records coverage %, timeout %, throughput, and
  median parse time to metrics/metrics.json.
- Publishing: metrics/update_readme.py rewrites the block between the
  `.. METRICS:START` / `.. METRICS:END` markers in README.rst with an RST
  table; the job commits it back with the default GITHUB_TOKEN and
  `[skip ci]` (no workflow retrigger), staying green on no-op weeks.

corpus/ is gitignored. The metrics scripts pass ruff/isort/mypy.


* ci: re-trigger checks [empty]

* Fix mypy str/bytes error in update_readme (avoid re.subn overload)

CI's mypy flagged the re.subn lambda's overload resolution as bytes.
Replace the regex-callable replacement with a plain marker splice; drop
the now-unused re import.

* Fix fetch_corpus.sh aborting on tar|head SIGPIPE under pipefail

Found by actually running the fetch: 'tar -tzf | head -1' under
set -o pipefail makes tar receive SIGPIPE (head closes early), failing
the pipeline and aborting before extraction. Detect the release name
from the extracted directory instead (drop --strip-components so the
afp-* dir is present); verified end-to-end against the live AFP tarball
(10098 .thy files, version afp-2026-06-01, idempotent re-run).

---------
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