Skip to content

test: make the metadata parser linearity check deterministic - #4726

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-flake-metadata-linear
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-flake-metadata-linear

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

tests/integration/test_public_release_metadata.py::test_metadata_parser_scales_linearly flaked on #4712's Integration run 45002906915. It measured a ratio of 18x against a limit of 15, with a 2000-line baseline of 21 ms against 0.38 s. At 21 ms the baseline is mostly process start-up, so millisecond noise decided the ratio.

The test now measures this way, with no change to production code:

  • Both input sizes run well above start-up cost: 10,000 and 40,000 lines, with a fastest sample of about 0.2 to 0.6 s for the small input.
  • Samples of the two sizes are interleaved, so host load hits both alike.
  • Each size keeps its fastest of 5 samples, which is the usual noise-robust estimator.
  • A fourfold input must cost under 8x. A linear parser measures about 4x or less; a quadratic one about 16x.
Check (local, host load 20-40) Ratio (40k / 10k)
Production parser, 3 probe rounds 2.56, 2.96, 2.01
Production parser, 3 full test runs passed each time
Parser made quadratic locally (install.sh awk gains for (i = 0; i < NR / 4; i++) q++; not committed) 8.3 (2.06 s vs 17.07 s): fails

Issue and approved scope

Issue: N/A. This is a CI flake fix that changes only the test (bug class, assigned by the P3 lead for #4712's Integration run).

Human scope-approval comment: test-only flake fix, routed by the P3 lead; no product change.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

I ran pytest tests/integration/test_public_release_metadata.py::test_metadata_parser_scales_linearly -m benchmark three times through the host guard; it passed each time. With the parser made quadratic it failed once, as expected. ruff check and format pass.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md:
    user-visible effect first, 25 words or fewer, ending with (#PR);
    breaking changes only under upgrade notes; no Highlights; see
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

The 2000-line baseline ran in about 20 ms, mostly process start-up, so
host noise moved the tenfold ratio past its limit (18x in run
45002906915). Both sizes now run well above start-up cost (10k and 40k
lines), their samples interleave so load hits both alike, each keeps its
fastest sample, and a fourfold input must cost under 8x: linear parses
measure 2-3x, while a parser made quadratic locally measured 8.3x and
failed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the test-only metadata parser benchmark changes.

No open issues 🎉

What changed in this PR

This test-only PR reduces timing noise in the metadata parser scaling benchmark that flaked during #4712’s integration run. Production code is unchanged.

Changes:

  • Increases input sizes to 10,000 and 40,000 lines to reduce process-startup effects.
  • Interleaves five samples per size and compares the fastest timings against an 8x limit.
  • Raises the subprocess timeout to 30 seconds while preserving output correctness checks.
File Description
tests/​integration/​test_public_release_metadata.py Revises benchmark inputs, sampling, timeout, and scaling threshold; removes the unused statistics import.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the test-only benchmark adjustment.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 33bb8ad into main Nov 23, 2026
72 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-flake-metadata-linear branch November 23, 2026 09:04
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.

2 participants