Repository navigation
AG-58737 Fix incorrect "Closed as stale" count in stats report - #32
Conversation
Resolve bin/ conflicts by untracking the generated Rollup bundles: they are rebuilt by 'yarn build' in every CI workflow, so committed copies only go stale and cause recurring merge conflicts.
The package is not published to npm anymore, so the 'bin' field is vestigial (it only creates npm install symlinks). Remove it and rename the Rollup output directory to dist/ to match the standard convention for generated build output. Update package.json scripts, .gitignore, .eslintignore, AGENTS.md, and DEVELOPMENT.md accordingly.
slvvko
left a comment
There was a problem hiding this comment.
Fresh-eyes pass over the changes — mostly small things, the ones that matter are the actor guard, the close-partition gap, and the npm/dist consequences. Will address them in a follow-up commit.
|
README.md:69-79 and |
|
README.md:35 still says activity points include "Issue closed (unless marked as Stale)" — that's the old rule. |
|
Quick check on the PR description: "134 of 135 stale-labelled closes over the last 30 days were manual" — the local collection (30 daily files, 2026-08-11..2026-09-09) shows 119 stale-labelled closes, 118 manual + 1 bot. The other figures (18 → 0, Resolved 180) reproduce exactly. Probably a different window or REST-reconcile data; worth correcting the number in the description. |
|
nit: the |
- Use EXCLUDED_USERNAMES for the stale-bot actor check instead of a duplicated STALE_BOT_USERNAMES list; move the predicate to events-utils next to the other event predicates and guard against a null actor. - Make 'resolved' and 'closed as stale' exact complements so bot closes of non-stale-labelled issues are counted as resolutions instead of being dropped; cover bot variants and contributor-level exclusion in tests. - Add prepoll/prestats/prepublish build hooks; update README and examples to the build-from-source flow now that the npm bin field is gone.
|
All four points addressed in d32c3a8:
|
The link pointed to a nonexistent '#github-stats-cli-app' anchor; the 'Activity points' section carries the 'activity_count' anchor.
|
@maximtop let's remove the package from npm https://www.npmjs.com/package/@adguard/github-stats, shall we? it was deployed only once and never since that + works fine as is (within the repo) |
Every CI workflow runs 'yarn build' explicitly before invoking the CLIs, and the local flow is documented in DEVELOPMENT.md, so the pre-hooks add nothing. 'prepublish' additionally fires on every 'yarn install' with Yarn Classic, needlessly rebuilding during installs.
maximtop
left a comment
There was a problem hiding this comment.
Please correct the Slack publish command in the example and README, and replace the broken link to the generated dist directory.
maximtop
left a comment
There was a problem hiding this comment.
lgtm — one small suggestion inline.
Extract the duplicated stale-close check into a single isClosedAsStale predicate in events-utils.js and derive both repo-level counters from it and its negation, so the partition cannot drift out of sync. Add unit tests for the predicate covering bot/human x stale/non-stale closes.
AG-58737
Fixes the incorrect
Closed as stalecount in the Filters stats collector report.Problem
The
Closed as stalemetric counted every issue closed while carrying theStalelabel, regardless of who closed it. The stale bot only adds theStalelabel; maintainers routinely close those labelled issues manually during triage, so the metric systematically over-reported bot closures (e.g. 18 on 07.09.2026 when the bot closed nothing, and 118 of 119 stale-labelled closes over the last 30 days were manual).Fix
src/tools/events-utils.js: newisStaleBotActorpredicate — an issue close counts as "closed as stale" only when a stale bot account (adguard-bot,github-actions[bot], i.e.EXCLUDED_USERNAMES) closed aStale-labelled issue. Contributor-levelResolved issuescredits human closes of stale-labelled issues consistently with the repo-level metric (bot closes are excluded viaEXCLUDED_USERNAMES).src/prepare-stats/prepare-repo-stat.js:Closed as staleandResolved issuesare computed from the partition above — every close lands in exactly one counter: a maintainer closing a stale-labelled issue during triage counts as resolved, and so does a bot close of a non-stale-labelled issue.CHANGELOG.mdupdated (v1.1.1),package.jsonbumped to 1.1.1.Merge conflict resolution
Merged
masterand resolved the conflicts. All conflicts were in the generated Rollup bundles underbin/, which were rebuilt fromsrc/by the poll-events bot and dragged into every "Events collection update" commit. Since every CI workflow runsyarn buildbefore invoking the CLI,bin/is now fully gitignored and untracked (previously only the hashed chunks were ignored) — this removes the recurring conflict source for open PRs.AGENTS.mdandDEVELOPMENT.mdupdated to reflect the new policy.Dropped npm
binfield, renamed build dirbin/→dist/The package was published to npm only once (1.0.0) and is not published anymore, so the
binfield (which only creates npm install symlinks) is vestigial. Removed it frompackage.jsonand renamed the Rollup output directory frombin/todist/to follow the standard convention for generated build output.package.jsonscripts,.gitignore,.eslintignore,AGENTS.md, andDEVELOPMENT.mdupdated accordingly.Verification
yarn lintpasses,yarn test38/38 pass,yarn buildsucceeds (outputs todist/).Closed as stale: 0(was 18),Resolved: 180.Review fixes (2026-09-10)
6b0b8011a— addresses the [P2] review comment:yarn run publisheverywhere the Slack publish script is invoked from docs and examples (previouslyyarn publishfell back to Yarn Classic's built-in npm publish command). Scoped lines + identical occurrences inAGENTS.md/DEVELOPMENT.md.94e641dad— addresses the [P3] review comment:AGENTS.mdno longer links to the gitignoreddist/directory; it is rendered as inline code.30efa131b— fixes a pre-existing markdownlint (MD060) table misalignment inAGENTS.mdfound while addressing the review.