Skip to content

test(bundle): serve comment.body and label.name absent to drive the '?? ""' folds through dist/index.js - #508

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-absent-optional-fields
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-absent-optional-fields

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files claimed: __tests__/bundle/absentOptionalFields.test.ts (new, test-only). Functions: src/utils/comments.ts createCommentOnce (line 58, comment.body ?? ''), src/plugins/requireMatchingLabel.ts botCommentsWithMarker (line 248, comment.body ?? ''), src/issueComment/trigger.ts okToTestOnPullRequest (line 181, label?.name ?? ''). No src/, dist/ or workflow change.

The REST schema types issue-comment.body as optional and the object form of issue.labels[] with an optional name, but every bundle scenario serves both fields, so at main@1062ce7 npm run test:coverage:e2e reports the three folds with zero hits (coverage-e2e/lcov.info: BRDA:58,2,1,0, BRDA:248,32,1,0, BRDA:181,29,1,0); the unit suite covers all three files at 100 / 100 / 100 / 100.

Four cases, each serving the field absent and driving dist/index.js:

  • pull_request synchronize with labels: [{ id: 2 }, { name: 'ok-to-test' }]: the nameless object is skipped, the action_required run on the head is still approved; request sequence asserted.
  • the same with labels: [{ id: 2 }] alone: ::debug::trigger: the pull request does not carry ok-to-test, no actions/runs read.
  • pull_request labeled lgtm by a bot (no binding) whose GET /issues/1/comments lists one bot comment with no body: the label is stripped and the stale-lgtm notice with its marker is posted once (the bodyless comment is not taken as already carrying it); full request sequence asserted.
  • issues labeled kind/bug with needs-kind present whose comments list holds a bodyless bot comment (id 11) and the marker comment (id 12): needs-kind is removed and only comment 12 is deleted.

Verification (local, this branch, main @ 1062ce7)

  • npx eslint __tests__/bundle/absentOptionalFields.test.ts clean
  • npx vitest run __tests__/bundle/absentOptionalFields.test.ts: 4 passed
  • npm run test:coverage:e2e: 79 files / 491 tests pass (was 78 / 487); Branches 97.96 % → 98.14 % (1633 → 1636 / 1667); comments.ts and requireMatchingLabel.ts now 100 % branches; trigger.ts 98.96 % with only line 323 (errorStatus, unreachable through Octokit) left
  • Unit suite untouched

Disjoint from the open held PRs: #497 (approve.ts, meow.ts), #498 (tideOptionalFields.test.ts: tide.ts, sweep.ts), #500/#502 (thresholds), #501 (docs YAML), #504 (octokit.ts), #505 (nullIssueUser.test.ts: issueComment/approve.ts, close.ts, reopen.ts).

Related Issue

Refs #507 (needs-human: the issue's own item, dropping or v8-ignoring the getErrorDetails non-object arm at auth.ts:24, is a production-code change the quality lane does not PR; this PR lands the folded finding on that issue — the three ?? '' folds — and ticks its four boxes)
Refs #466 (tracker for every dist/index.js e2e-coverage finding)


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

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

…?? ""' folds through dist/index.js

Every bundle scenario serves body on each listed comment and name on
each label object, so the folds that stand in for the REST schema's
optional fields never ran through the packed bundle:

- src/utils/comments.ts:58 createCommentOnce  (comment.body ?? '')
- src/plugins/requireMatchingLabel.ts:248 botCommentsWithMarker (comment.body ?? '')
- src/issueComment/trigger.ts:181 okToTestOnPullRequest (label?.name ?? '')

Four cases drive them: synchronize with a nameless label object next to
ok-to-test (runs approved) and alone (no runs read); a bot-applied lgtm
with no binding whose only bot comment has no body (stale notice still
posted); and labeled kind/bug whose comments hold a bodyless bot comment
and a marker comment (only the marker comment deleted).

Refs #507

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 17, 2026 23:04
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 17, 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. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

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.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

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. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants