Skip to content

test(bundle): drive /label-sync's missing-number guard and already-in-sync report through dist/index.js (src/issueComment/labelSync.ts:20-21,32,35) - #621

Merged
jeefy merged 1 commit into
mainfrom
quality/test-label-sync-command-e2e
Oct 30, 2026
Merged

jeefy merged 1 commit into
mainfrom
quality/test-label-sync-command-e2e

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Two test files under __tests__/bundle/; nothing under src/, dist/, docs or config.

  • __tests__/bundle/missingNumberGuards.test.ts — one matrix row: /label-sync on a comment without an issue number fails naming the guard (src/issueComment/labelSync.ts:20-21). It was the only slash command missing from the 17-row matrix.
  • __tests__/bundle/labelSyncCommandInSync.test.ts — a collaborator's /label-sync against a repository the job already brought into line: the comment is exactly label-sync: created 0, updated 0, unchanged N. with neither Created: nor Updated: line (labelSync.ts:32,35 false arms), stdout reports created 0 [], updated 0 [], unchanged N, failed 0, and nothing is written to the labels API. The repository is seeded from the POST /labels bodies of a first sync run through the same bundle, so the test holds no copy of the built-in label catalog that could drift from the bundle's.

Why. Every bundle /label-sync scenario so far starts from a repository missing labels, so the comment always carries a Created: line; the report a maintainer sees when the job has nothing to do was never produced end to end. Unit coverage of the file is 100 %, the bundle run had DA:21,0 and zero-count BRDA records for lines 20, 32 and 35 (CI artifact coverage-e2e-96433268…, run 40928440920).

Files / cluster claimed — src/issueComment/labelSync.ts's end-to-end coverage only; __tests__/bundle/missingNumberGuards.test.ts and the new file. Disjoint from the cronJobs/labelSync.ts sync-algorithm scenarios (labelSyncCatalog, labelSyncFailureArms, labelSyncNullDescription, labelSyncUnprefixedAllowlist) and from everything else in flight.

Testing

At 36aecfa (rebased onto main@4f97e30, after #611 and #619):

  • npx vitest run __tests__/bundle/labelSyncCommandInSync.test.ts __tests__/bundle/missingNumberGuards.test.ts — 2 files, 20 passed
  • npm run test:coverage:e2e (at 9643326, before the rebase) — 92 files, 550 passed; branches 1702/1714 → 1705/1714, lines 2489/2494 → 2490/2494; src/issueComment/labelSync.ts leaves the uncovered table, exit 0
  • npx eslint on both files and npm run typecheck — clean
  • each test fails without its arm, with dist/ rebuilt via tsc && ncc build --no-cache: issueNumber === undefined made unreachable → the matrix row fails (not a collaborator debug line, exit 0 instead of the guard); result.created.length > 0 → >= 0 → the in-sync test fails on the comment body (Created: line appears)

Related Issue

Closes #620 — both boxes of the finding are in this PR.


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

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

…-sync report through dist/index.js

Every bundle /label-sync scenario starts from a repository missing labels, so
the comment always carries a Created: line, and /label-sync was the one slash
command absent from the missing-number guard matrix. The new scenario seeds the
fake repository from what a first sync creates, so the test holds no copy of the
built-in label catalog that could drift from the bundle's, then asserts the
zero-count report and that nothing is written to the labels API.

Closes #620

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 29, 2026 21:40
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 29, 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.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read the diff against the tree at 36aecfa. This looks correct to me — test-only, and every claim in the body checks out against the source:

  • The new matrix row drives the guard at src/issueComment/labelSync.ts:20-22 (issueNumber === undefined → throw naming the guard), and it was indeed the only slash command missing from the missingNumberGuards.test.ts matrix (17 rows before, 18 after).
  • The in-sync scenario exercises the false arms at src/issueComment/labelSync.ts:32 and :35: with created/updated empty, the comment is exactly label-sync: created 0, updated 0, unchanged N. with no Created:/Updated: lines — matching the assertion on the single POST /issues/1/comments body.
  • The asserted stdout line matches src/cronJobs/labelSync.ts:87 verbatim (created 0 [], updated 0 [], unchanged N, failed 0).
  • The seed-then-replay design is sound against the drift logic: drift() (src/cronJobs/labelSync.ts:124-135) skips color when the desired label has none and compares description against current.description ?? '', so echoing the seed run's own POST /labels bodies back (with color ?? 'ededed', description ?? null) necessarily yields zero writes — and the test asserts no POST/PATCH/DELETE reached the API. No copy of the built-in catalog is held, as the body claims.
  • e2e-coverage, build-test and DCO are green at this head.

No findings from any perspective. Scope matches #620 exactly (two test files, nothing under src/). The hold label is this lane's procedural gate — nothing in the change itself needs a decision.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

@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.

Drives the two e2e-dark arms #620 named through dist/index.js; additive, no src/. Closes the gap honestly rather than exempting it.

@jeefy

jeefy commented Oct 30, 2026

Copy link
Copy Markdown
Member

/kind cleanup

@jeefy jeefy removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 30, 2026
@jeefy
jeefy merged commit e9f2f38 into main Oct 30, 2026
17 checks passed
@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 30, 2026
@jeefy
jeefy deleted the quality/test-label-sync-command-e2e branch October 30, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

1 participant