-
Notifications
You must be signed in to change notification settings - Fork 28
Feat/unified jsonl logs #2371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/unified jsonl logs #2371
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,33 +6,57 @@ import ( | |||||
| "strings" | ||||||
| ) | ||||||
|
|
||||||
| // guardRequiredFields lists the GraphQL selection fields the DIFC guard needs | ||||||
| // for accurate integrity labeling. author{login} enables trusted-bot detection; | ||||||
| // authorAssociation provides the integrity level directly (MEMBER, CONTRIBUTOR, | ||||||
| // etc.) so the guard doesn't need extra enrichment REST round-trips. | ||||||
| var guardRequiredFields = []struct { | ||||||
| // guardFieldSet defines the GraphQL fields the DIFC guard needs for a | ||||||
| // specific class of GitHub objects. | ||||||
| type guardFieldSet struct { | ||||||
| field string // field text to inject | ||||||
| present *regexp.Regexp // pattern that indicates the field is already selected | ||||||
| }{ | ||||||
| } | ||||||
|
|
||||||
| // issueAndPRFields are required for Issue and PullRequest types. | ||||||
| // author{login} enables trusted-bot detection; authorAssociation provides the | ||||||
| // integrity level directly so the guard doesn't need enrichment REST round-trips. | ||||||
| var issueAndPRFields = []guardFieldSet{ | ||||||
| {"author{login}", regexp.MustCompile(`\bauthor\s*\{[^}]*\blogin\b`)}, | ||||||
| {"authorAssociation", regexp.MustCompile(`\bauthorAssociation\b`)}, | ||||||
| } | ||||||
|
|
||||||
| // allGuardFieldsPresent returns true if the query already contains every | ||||||
| // required guard field. | ||||||
| func allGuardFieldsPresent(query string) bool { | ||||||
| for _, f := range guardRequiredFields { | ||||||
| // commitFields are required for Commit types. | ||||||
| // author{user{login}} enables trusted-bot detection. Commits don't have an | ||||||
| // authorAssociation field in the GraphQL schema. | ||||||
| var commitFields = []guardFieldSet{ | ||||||
| {"author{user{login}}", regexp.MustCompile(`\bauthor\s*\{[^}]*\buser\s*\{[^}]*\blogin\b`)}, | ||||||
|
||||||
| {"author{user{login}}", regexp.MustCompile(`\bauthor\s*\{[^}]*\buser\s*\{[^}]*\blogin\b`)}, | |
| {"author{user{login}}", regexp.MustCompile(`(?s)\bauthor\b.*\buser\b.*\blogin\b`)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new
list_commitsGraphQL routing pattern is introduced here, but there isn’t corresponding unit test coverage in the existingTestMatchGraphQLtables to ensure commit-history queries are classified aslist_commits(and that other patterns still win when combined). Adding a focused test case for a typical... on Commit { history(first:...) { nodes { ... } } }query would prevent regressions.