Skip to content

test(bundle): drive removeFixedLabels' no-op and failed-labels-read arms through dist/index.js - #300

Merged
github-actions[bot] merged 1 commit into
mainfrom
quality/test-bundle-fixed-label-arms
Oct 7, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
quality/test-bundle-fixed-label-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/fixedLabelArms.test.ts (one new file; nothing else touched), running the committed bundle against the fake GitHub for the two arms of src/labels/fixed.ts removeFixedLabels no bundle suite reaches:

  • /remove-good-first-issue with none of its labels on the issue: exit 0, one GET /issues/1, then the post-command config sweep, no DELETE/POST (lines 58–60)
  • /remove-help with GET /issues/1 → 500: exit 1, the failure names could not get labels from issue, no DELETE (lines 54–56)

Both import comment/helpersFor/repo/token from the shared helpers.ts (#273).

Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/labels/fixed.ts e2e lines 7/21 → 19/21 (33.3 % → 90.5 %). Line 63 (the removeLabels write on the happy path) is #246's ground and is not claimed here; line 70 (requireIssueNumber throw) is unreachable from an issue_comment payload. Unit coverage of the file is already 100 %.

Disjoint from every open held bundle PR: #246 drives the /remove-help happy path in labelCommands.test.ts; this file drives only the no-op and failure arms.

Related Issue

Closes #299


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

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

…rms through dist/index.js

__tests__/bundle/fixedLabelArms.test.ts runs the shipped bundle against the fake
GitHub for the two arms of src/labels/fixed.ts removeFixedLabels that no bundle
suite reaches: a /remove- form whose labels are not on the issue (one GET
/issues/1, no DELETE or POST, exit 0) and a 500 on that read (exit 1, the error
names 'could not get labels from issue'). npm run test:coverage:e2e: fixed.ts
7/21 -> 19/21 lines.

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 4, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 4, 2026 10:30
@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 hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


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

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

@jeefy

jeefy commented Oct 7, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 7, 2026
@github-actions github-actions Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2026
@github-actions
github-actions Bot merged commit c92ec7d into main Oct 7, 2026
13 checks passed
jeefy added a commit to jeefy/prow-github-actions that referenced this pull request Oct 7, 2026
…remove-help and /remove-good-first-issue

The fixed label commands now read the configuration for
authorization.labels before writing, and the needs-* re-check that
follows finds it memoized. The two bundle cases main gained in cncf#246 and
cncf#300 pinned the configuration reads after the command; they now pin
them ahead of the unchanged command sequence, as bundle.test.ts does
for /help.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>
jeefy added a commit that referenced this pull request Oct 7, 2026
…view commands (#367)

* feat(auth): opt-in authorization policy for label, hold, close and review commands

A new top-level `authorization` section in prow.yaml decides who may run the
label commands (`labels`), /hold (`hold`), /close and /reopen (`close`), and,
on repositories without OWNERS files, /lgtm, /approve, /retest, /test and
/ok-to-test (`review`). Policies are anyone | collaborators | members |
trusted; `trusted` adds the `users` list and the root OWNERS reviewers and
approvers. `review` accepts only members | trusted.

Defaults reproduce today's gates exactly (labels/hold anyone, close
collaborators, review members, users []). Per key the repository tier wins
over the organization tier, except `users`, which is unioned
case-insensitively.

`anyone` makes no API call. /close, /reopen and the review fallback keep
their existing checks and request order and read the configuration only
when those checks refuse, which is exact because every policy admits
collaborators (close) and members/collaborators (review). /help and
/good-first-issue now read the configuration before writing, as the
prefixed label commands already did.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>

* docs: document the authorization section

Adds the `### authorization` section to docs/configuration.md (fields,
policies, the `users` union, review only applying without OWNERS files,
the OWNERS side-effect warning and the missing_comment note), the policy
column and refusal behaviour in docs/commands.md, a parity row in
docs/prow-for-your-org.md and a commented-out block in templates/prow.yaml.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>

* fix(auth): fail closed when the authorization config cannot be loaded

Security review follow-ups for the authorization section:

- the review fallback of assertAuthorizedByOwnersOrMembership logs a
  warning and falls back to the default `members` policy when the
  configuration cannot be loaded, so the refusal comment carries the
  usual `members` message and never the configuration error;
- closePolicyAllows logs a warning and refuses when the configuration
  cannot be loaded, keeping a refused /close or /reopen silent;
- policyAllows refuses an empty login before anything else;
- authorization.users entries are trimmed and must be GitHub logins
  (optionally with a `[bot]` suffix); a leading `@`, inner spaces,
  underscores or teams are rejected;
- docs: the org tier supplies defaults, not floors (use rulesets for
  enforcement), the `config` input may point at a ref or URL, review
  applies to issues without a root OWNERS file, and the refusal
  behaviour when the configuration cannot be loaded.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>

* test(bundle): expect the authorization.labels config reads ahead of /remove-help and /remove-good-first-issue

The fixed label commands now read the configuration for
authorization.labels before writing, and the needs-* re-check that
follows finds it memoized. The two bundle cases main gained in #246 and
#300 pinned the configuration reads after the command; they now pin
them ahead of the unchanged command sequence, as bundle.test.ts does
for /help.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>

---------

Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@mrbobbytables
mrbobbytables deleted the quality/test-bundle-fixed-label-arms branch October 9, 2026 17:31
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. lgtm "Looks good to me", indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] removeFixedLabels' no-op and failed-labels-read arms are never driven through dist/index.js

1 participant