fix: map author_association NONE to unapproved integrity#4430
Merged
Conversation
GitHub's author_association NONE means 'no association with the repo'
which does NOT imply the user is established or trustworthy. Previously
NONE mapped to the lowest integrity level (none), same as FIRST_TIMER.
Now NONE maps to unapproved (reader_integrity), matching
FIRST_TIME_CONTRIBUTOR and CONTRIBUTOR, since all three represent users
who are not brand-new to GitHub but have no special repo relationship.
Only FIRST_TIMER ('has not previously committed to GitHub') and
unknown/missing values remain at the none baseline.
Also fixes pre-existing TestRegisterFlagCompletions failures by checking
GetFlagCompletionFunc instead of flag.Annotations (RegisterFlagCompletionFunc
does not populate annotations).
Closes #4419
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts GitHub Guard integrity labeling to treat author_association: NONE as unapproved integrity (rather than none), aligning behavior with GitHub’s semantics and preventing established-but-new-to-repo contributors from being overly filtered.
Changes:
- Update Rust guard author-association mapping so
NONEmaps tounapproved(reader integrity) and add a focused regression test. - Update Rust labeling tests to reflect the new
NONE→unapprovedbehavior across issue/PR/commit scenarios. - Update documentation to clarify the rationale and tables for
NONEvsFIRST_TIMER, and fix a Go flag-completion test to validate completion functions via Cobra APIs.
Show a summary per file
| File | Description |
|---|---|
| internal/cmd/flags_test.go | Fixes completion tests to assert via GetFlagCompletionFunc instead of flag annotations. |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Changes author_association mapping (NONE → reader) and adds a dedicated unit test. |
| guards/github-guard/rust-guard/src/labels/mod.rs | Updates expectations/comments in label/integrity tests for NONE → reader integrity. |
| guards/github-guard/docs/INTEGRITY_TAG_SPEC.md | Updates spec mapping tables and adds rationale clarifying NONE vs FIRST_TIMER. |
| guards/github-guard/docs/TESTING.md | Updates testing documentation to match new mapping and explain rationale. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Maps GitHub
author_association: NONEto unapproved integrity instead of none.Problem
GitHub's
author_associationenum valueNONEmeans "Author has no association with the repository" (docs). This is intentionally vague and does not mean the user is established or trustworthy — only that they are notFIRST_TIMER.Previously, the guard mapped
NONEto the lowest integrity level (none), identical toFIRST_TIMER("Author has not previously committed to GitHub" — a brand-new account). This incorrectly treated users with existing GitHub activity the same as completely new accounts.Changes
Rust guard (core logic)
author_association_floor_from_strinhelpers.rs: Added"NONE"to the unapproved match arm alongsideCONTRIBUTORandFIRST_TIME_CONTRIBUTORtest_author_association_none_maps_to_unapprovedtest"NONE"and expectednone_integrity()→ now expectreader_integrity()Documentation
NONEdoes not mean establishedNONE(unapproved) fromFIRST_TIMER(none)NONEfrom the none group to unapprovedGo test fix (pre-existing)
flags_test.go: FixedTestRegisterFlagCompletionstests that checkedflag.Annotations(not populated byRegisterFlagCompletionFunc) — now usesGetFlagCompletionFuncto verify completionsMapping (after this change)
OWNER,MEMBER,COLLABORATORCONTRIBUTOR,FIRST_TIME_CONTRIBUTOR,NONEFIRST_TIMER, unknown/missingCloses #4419