Skip to content

Unblock publishing: reset + cap oversized history.jsonl - #82

Merged
marblom007 merged 2 commits into
meshery:masterfrom
marblom007:fm/qa-history-cap
Aug 2, 2026
Merged

marblom007 merged 2 commits into
meshery:masterfrom
marblom007:fm/qa-history-cap

Conversation

@marblom007

@marblom007 marblom007 commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Problem

The Publish Report to GitHub Pages workflow has been failing on every run. Its "Commit & push updated history" step pushes history.jsonl back to master, but the file had grown to ~101 MB (83 run snapshots) - over GitHub's 100 MB per-file push limit - so every push was rejected (pre-receive hook declined), the build job failed, and deploy was skipped. No report has deployed for hours; every dashboard view (including the new Connection Lifecycle report) is stale and https://qa.meshery.io/connections/ 404s.

Root cause

allure generate (historyPath: "./history.jsonl" in allurerc.mjs) appends one run snapshot per line and never bounds the file. Each snapshot also embeds the full knownTestCaseIds set, so it grows both per run and per test (83 lines x ~1.26 MB).

Fix (reset + cap)

  • Reset: remove the oversized committed history.jsonl. The next publish regenerates a fresh, small one - report-build already treats a missing file as "first run". Only historical trend charts are lost; no test results are affected.
  • Cap: add a Cap Allure trend history step before the commit step that keeps only the most recent runs, bounded by both a run count (MAX_RUNS=25) and a hard byte budget (MAX_BYTES=80 MB), so the file can never approach the 100 MB limit again. The byte budget also guards against a single snapshot ballooning as the suite grows.

Verified the cap on the real 83-run/105 MB file: -> 25 runs / 32 MB, every retained line valid JSON, newest snapshot preserved.

Minimal and qa-scoped; no git-history rewrite (past large blobs are a separate, optional cleanup that does not block publishing).

Post-merge

The publish workflow does not trigger on .github/** changes, so I will dispatch a Publish Report to GitHub Pages run after merge and confirm it succeeds and that https://qa.meshery.io/connections/ returns 200 with the Connection Lifecycle report.

Summary by CodeRabbit

  • Chores
    • Improved Allure report publishing by limiting history to the newest configured runs.
    • Prevented history files from exceeding configured size limits, with a 95 MiB failsafe to protect report publishing.
    • Added automatic cleanup of older history entries while preserving recent report data.
    • Added logging for history entry counts and file sizes before and after cleanup.

The "Publish Report to GitHub Pages" workflow failed on every run: its
"Commit & push updated history" step pushes history.jsonl back to master, and
the file had grown to ~101 MB (83 run snapshots), over GitHub's 100 MB per-file
push limit, so every push was rejected and no report deployed (qa.meshery.io
reports went stale; /connections/ 404'd).

Root cause: allure generate (historyPath: ./history.jsonl in allurerc.mjs)
appends one run snapshot per line and never bounds the file. Each snapshot also
carries the full knownTestCaseIds set, so it grows both per run and per test.

Fix (captain-approved reset + cap; no test results affected, only trend charts):
- Remove the oversized committed history.jsonl. The next publish regenerates a
  fresh, small one (the seed step already handles a missing file as "first run").
- Add a "Cap Allure trend history" step before the commit step that keeps only
  the most recent runs, bounded by BOTH a run count (25) and a hard byte budget
  (80 MB) so it can never approach the 100 MB limit again - the byte budget also
  guards against a single snapshot ballooning as the suite grows.

Past large blobs remain in history (a separate, optional cleanup) but do not
block publishing. No git history rewrite.

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 2, 2026 23:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Unblocks the GitHub Pages publish workflow by preventing history.jsonl from exceeding GitHub’s per-file push limit, via a pre-commit capping step.

Changes:

  • Add a workflow step to cap history.jsonl by maximum run count and maximum byte size before committing/pushing.
  • Document the rationale and constraints directly in the workflow for future maintainers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +76
while [ "$(wc -c < "$HIST.capped")" -gt "$MAX_BYTES" ] && [ "$(wc -l < "$HIST.capped")" -gt 1 ]; do
tail -n +2 "$HIST.capped" > "$HIST.capped.tmp"
mv "$HIST.capped.tmp" "$HIST.capped"
done
Comment on lines +67 to +68
MAX_RUNS=25
MAX_BYTES=$((80 * 1024 * 1024))
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@marblom007, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eab9b603-859c-4813-be33-89c64abb1b72

📥 Commits

Reviewing files that changed from the base of the PR and between abc9ecb and 0f1fbfb.

📒 Files selected for processing (2)
  • .github/workflows/publish-allure-report.yml
  • cap-history.sh
📝 Walkthrough

Walkthrough

The publishing workflow now bounds history.jsonl before and after Allure report generation. The new script retains recent runs, applies soft and hard byte limits, handles missing files, and replaces the history file atomically.

Changes

Allure history publishing

Layer / File(s) Summary
Implement history bounding
cap-history.sh
The script supports configurable run and byte limits, retains the newest runs, trims oversized history, resets an oversized snapshot, handles missing files, and performs an atomic replacement.
Bound history before publishing
.github/workflows/publish-allure-report.yml
The workflow defines an 80 MiB soft limit and a 95 MiB hard limit. It runs cap-history.sh before report generation and after generation appends a new snapshot.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: resetting and capping oversized history.jsonl to unblock publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish-allure-report.yml:
- Around line 73-76: Update the history-capping loop around HIST.capped so
MAX_BYTES is enforced even when the remaining record is a single oversized line.
After trimming records, validate the final file size before moving it into
place; remove the oversized final record or explicitly fail the job instead of
allowing an oversized file to be written.
- Around line 59-60: Update the workflow steps around “Cap Allure trend history”
and make report-build so history.jsonl is capped before make report-build runs,
ensuring the generated allure-report uses bounded history; retain the final byte
cap if it is still required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 48765cd6-a4b9-45d8-8e58-dc76372f0cd9

📥 Commits

Reviewing files that changed from the base of the PR and between 19d0126 and b9eb8e9.

📒 Files selected for processing (2)
  • .github/workflows/publish-allure-report.yml
  • history.jsonl

Comment thread .github/workflows/publish-allure-report.yml Outdated
Comment thread .github/workflows/publish-allure-report.yml Outdated
marblom007 added a commit to marblom007/qa that referenced this pull request Aug 2, 2026
Review on meshery#82 (CodeRabbit + Copilot):
- CodeRabbit (major): `make report-build` generated the deployed report BEFORE
  the cap ran, so the report could embed uncapped history. Now the cap runs on
  BOTH sides of report-build - before (report built from a bounded seed) and
  after (the file committed/pushed is re-bounded after allure appends this run).
- CodeRabbit/Copilot: the size loop could stop at one line still over budget and
  push an oversized file. Added a hard-limit failsafe that resets to a fresh
  history if a single retained snapshot still exceeds HISTORY_HARD_BYTES
  (95 MiB, < GitHub's 100 MB limit) - losing one pathological snapshot beats
  blocking every deploy.
- Copilot: lifted the caps to job-level env (HISTORY_MAX_RUNS / MAX_BYTES /
  HARD_BYTES) and extracted the logic into cap-history.sh so tuning needs no
  script edits and the before/after steps share one implementation.

Verified all paths: normal 83->25 runs, missing-file no-op, single-oversized-
line failsafe reset to empty.

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
marblom007 added a commit to marblom007/qa that referenced this pull request Aug 2, 2026
Review on meshery#82 (CodeRabbit + Copilot):
- CodeRabbit (major): `make report-build` generated the deployed report BEFORE
  the cap ran, so the report could embed uncapped history. Now the cap runs on
  BOTH sides of report-build - before (report built from a bounded seed) and
  after (the file committed/pushed is re-bounded after allure appends this run).
- CodeRabbit/Copilot: the size loop could stop at one line still over budget and
  push an oversized file. Added a hard-limit failsafe that resets to a fresh
  history if a single retained snapshot still exceeds HISTORY_HARD_BYTES
  (95 MiB, < GitHub's 100 MB limit) - losing one pathological snapshot beats
  blocking every deploy.
- Copilot: lifted the caps to job-level env (HISTORY_MAX_RUNS / MAX_BYTES /
  HARD_BYTES) and extracted the logic into cap-history.sh so tuning needs no
  script edits and the before/after steps share one implementation.

Verified all paths: normal 83->25 runs, missing-file no-op, single-oversized-
line failsafe reset to empty.

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
@marblom007

Copy link
Copy Markdown
Member Author

Thanks @coderabbitai and @copilot - all four points addressed in abc9ecb:

  1. (CodeRabbit, major) Report built from bounded history: the cap now runs on both sides of make report-build - a Cap Allure trend history (seed) step before generation (so the deployed report is built from a bounded trend) and a (post-generate) step after (so the file committed/pushed is re-bounded after allure generate appends this run).
  2. (CodeRabbit + Copilot) Single oversized snapshot: added a hard-limit failsafe - if a single retained snapshot still exceeds HISTORY_HARD_BYTES (95 MiB, under GitHub's 100 MB limit), the history is reset to fresh rather than pushing an oversized file. Losing one pathological snapshot beats blocking every deploy.
  3. (Copilot) Configurable caps: lifted HISTORY_MAX_RUNS / HISTORY_MAX_BYTES / HISTORY_HARD_BYTES to job-level env:.
  4. Extracted the logic into cap-history.sh so the before/after steps share one implementation and tuning needs no script edits.

Tested all paths locally against the real 83-run/105 MB file: normal cap -> 25 runs/32 MB, missing-file no-op, and the single-oversized-line failsafe resets to empty.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git show --stat --oneline abc9ecb
git show --format= --name-only abc9ecb

printf '\n--- Candidate files ---\n'
fd -HI '^(publish-allure-report\.yml|cap-history\.sh)$' . || true

printf '\n--- Workflow outline ---\n'
workflow="$(fd -HI '^publish-allure-report\.yml$' . | head -n1)"
if [ -n "$workflow" ]; then
  ast-grep outline "$workflow" --items all || true
  printf '\n--- Workflow relevant sections ---\n'
  rg -n -C 8 'HISTORY_(MAX_RUNS|MAX_BYTES|HARD_BYTES)|cap-history\.sh|report-build|Cap Allure trend history' "$workflow" || true
fi

printf '\n--- Script content ---\n'
script="$(fd -HI '^cap-history\.sh$' . | head -n1)"
if [ -n "$script" ]; then
  nl -ba "$script"
fi

printf '\n--- Commit patch ---\n'
git show --format= --find-renames abc9ecb -- \
  '.github/workflows/publish-allure-report.yml' \
  ':(glob)**/cap-history.sh'

Length of output: 3565


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- cap-history.sh (numbered) ---'
awk '{ printf "%6d  %s\n", NR, $0 }' cap-history.sh

printf '%s\n' '--- cap-history.sh patch in abc9ecb ---'
git show --format= --find-renames abc9ecb -- cap-history.sh

printf '%s\n' '--- Full relevant workflow block ---'
sed -n '30,80p' .github/workflows/publish-allure-report.yml

printf '%s\n' '--- Path and call-site checks ---'
rg -n -C 3 'history\.jsonl|cap-history\.sh|HISTORY_(MAX_RUNS|MAX_BYTES|HARD_BYTES)' \
  .github/workflows/publish-allure-report.yml cap-history.sh

Length of output: 13776


@marblom007 Verified in abc9ecb.

The seed cap runs before make report-build. The post-generation cap runs before the history commit. Therefore, both the generated report and the pushed history.jsonl use bounded history.

cap-history.sh handles a missing file without error. It retains the newest runs, applies the 80 MiB soft budget, and resets the history if a retained snapshot exceeds the 95 MiB hard limit.

The job-level environment provides the three cap values. Both workflow steps use the same script.

The four review findings are addressed. 🐇


✏️ Learnings added
Learnt from: marblom007
URL: https://github.com/meshery/qa/pull/82

Timestamp: 2026-08-02T23:32:40.572Z
Learning: In the Meshery QA GitHub Pages publishing workflow, `.github/workflows/publish-allure-report.yml` must run `cap-history.sh` both before and after `make report-build`. The pre-generation cap bounds the Allure trend used by the report, and the post-generation cap bounds `history.jsonl` before the workflow commits it.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cap-history.sh`:
- Around line 46-57: The failsafe in cap-history must enforce MAX_BYTES for the
final retained snapshot, not only HARD_BYTES. Update the post-loop check after
the tail/mv loop to reset or fail whenever HIST.capped exceeds MAX_BYTES, and
adjust the warning to reference the configured maximum; preserve the existing
behavior for snapshots within the limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: acac08e3-9c7e-4057-8a0e-c499af09628a

📥 Commits

Reviewing files that changed from the base of the PR and between b9eb8e9 and abc9ecb.

📒 Files selected for processing (2)
  • .github/workflows/publish-allure-report.yml
  • cap-history.sh

Comment thread cap-history.sh Outdated
…e ceiling

Review on meshery#82 (CodeRabbit + Copilot):
- CodeRabbit (major): `make report-build` generated the deployed report BEFORE
  the cap ran, so the report could embed uncapped history. The cap now runs on
  BOTH sides of report-build - before (report built from a bounded seed) and
  after (the file committed/pushed is re-bounded after allure appends this run).
- CodeRabbit/Copilot: the size cap could retain a single snapshot still over
  budget. HISTORY_MAX_BYTES is now a STRICT ceiling: a single-pass, byte-accurate
  (LC_ALL=C) awk keeps only the newest complete lines whose cumulative bytes fit,
  and if even the newest snapshot alone exceeds it the file resets to fresh -
  the file written back is always <= the ceiling (well under GitHub's 100 MB).
- Copilot: lifted the caps to job-level env (HISTORY_MAX_RUNS / MAX_BYTES) and
  extracted the logic into cap-history.sh shared by the before/after steps.

Tested: 83->25 runs normal; byte cap trims to newest lines under budget in one
fast pass; single-oversized-snapshot resets to empty; missing file no-op.

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
@marblom007

Copy link
Copy Markdown
Member Author

Addressed in 0f1fbfb. HISTORY_MAX_BYTES is now a strict ceiling rather than a soft budget with a separate hard limit: a single-pass, byte-accurate (LC_ALL=C) awk keeps only the newest complete lines whose cumulative bytes fit under it, and if even the newest snapshot alone exceeds it the file resets to a fresh history. So the file written back is always at or below HISTORY_MAX_BYTES (default 90 MiB, under GitHub's 100 MB limit) - the 80/95 MiB gap you flagged is gone. Also replaces the previous O(n^2) drop-oldest loop with the single awk pass.

@marblom007
marblom007 merged commit 8aeb8ea into meshery:master Aug 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants