Skip to content

test(bundle): drive createCommentOnce's already-carries-marker arm through dist/index.js - #349

Closed
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-comment-once
Closed

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-comment-once

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/commentOnce.test.ts (3 tests, new file only — no production, dist/, helpers.ts, fakeGithub.ts or config change), driving src/utils/comments.ts createCommentOnce()'s "already carries the marker → return false" arm (lines 58–60) through the committed dist/index.js via both of its callers:

  • pull_request labeled lgtm by a bot, lgtm not bound (src/plugins/lgtmBinding.ts stripStaleLgtm): GET …/issues/1/comments already holds a github-actions[bot] comment with <!-- prow-github-actions/lgtm-stale: <sha7> --> → label stripped, status set pending, ::debug::#1 already carries … logged, no POST …/comments; exact request sequence asserted.
  • counter-case: the same marker quoted by a type: User comment, plus a bot marker for a different head → neither counts, the explanation is posted once with the marker.
  • lgtm cron, fork pr refused 403 over workflow files (src/plugins/tide.ts explainForkWorkflows): GET …/issues/2/comments already carries <!-- prow-github-actions/fork-workflows: <sha7> --> → skipping pr #2: fork pull request with workflow changes…, debug line logged, no second comment; exact sequence asserted.

Imports configReads, helpersFor, ownersProbe, queueRead, repo, token from ./helpers (all merged in #273).

Coverage (npm run test:coverage:e2e, main @ 3fc21f2, Node v26.10.0, vitest 5.0.3)

file before after
src/utils/comments.ts 70 % lines (uncovered 34, 59–60) only 34 uncovered (that is createComment's throw, driven by held #244)

Unit coverage of the file was already 100 %; this is end-to-end-only evidence.

Disjoint from every open held bundle PR (#230–#347): every existing bundle case routes the comments listing as []; #318 drives the stale comment's read failure, #347's "once" is evaluateMerge's per-run dedupe. npx vitest run __tests__/bundle/commentOnce.test.ts → 3/3; npx eslint clean; npx tsc --noEmit clean.

Related Issue

Closes #348


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1

…rough dist/index.js

Adds __tests__/bundle/commentOnce.test.ts: both callers of createCommentOnce
(the stale-lgtm strip on pull_request labeled, and tide's fork-workflows
explanation on the lgtm cron) run against a fake GitHub whose comment listing
already carries the marker from a bot, asserting no second comment is posted;
plus the counter-case where a human quoting the marker, or a bot marker for
another head, does not count.

Closes #348

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 6, 2026 12:35
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

— hive: agent=quality backend=copilot model=claude-fable-5.1

@github-actions github-actions Bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Oct 6, 2026

@jeefy jeefy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Measured against main plus the other open bundle PRs, this PR covers no lines of its own. comments.ts:59–60 is reached by #328 (pullRequestOwnersArms.test.ts L157/L197). L68 repeats bundle.test.ts:1199, and L90 repeats a path covered at bundle.test.ts:1911. Please close this in favour of #328.

@hivecommons-hive hivecommons-hive Bot closed this Oct 8, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Agreed — pullRequestOwnersArms.test.ts in #328 (the "explaining comment already posted for this head" case) drives createCommentOnce's already-carries-marker arm (comments.ts:59–60), and the other two cases here repeat paths bundle.test.ts already covers. Closing in favour of #328.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

— hive: agent=quality backend=copilot model=claude-fable-5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] createCommentOnce's already-carries-marker arm (comments.ts 59-60) is never driven end-to-end through dist/index.js

1 participant