Skip to content

refactor: extract evidence-matching helpers in maintainer.ts (fixes #416)#421

Open
Shiva210Jyoti wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Shiva210Jyoti:fix/evidence-matching-dedup-416
Open

refactor: extract evidence-matching helpers in maintainer.ts (fixes #416)#421
Shiva210Jyoti wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Shiva210Jyoti:fix/evidence-matching-dedup-416

Conversation

@Shiva210Jyoti

Copy link
Copy Markdown

Fixes #416

What

The flag.evidence as any → parse items → item.repo || item.repoFullName → compare repos pattern was duplicated 3 times in src/app/actions/maintainer.ts.

Changes

Added 3 helpers just above getFlaggedAccounts:

  • repoFromEvidenceItem(item) — extracts repo or repoFullName as a string
  • filterEvidenceItemsByRepos(flag, repos) — returns matching evidence items (needed by the response builder to sum xpDelta)
  • flagTouchesRepos(flag, repos) — boolean, delegates to the above

Call sites updated

  1. allowedFlags filter → return flagTouchesRepos(flag, repos);
  2. Response map → const filteredItems = filterEvidenceItemsByRepos(flag, repos);
  3. resolveFlaggedAccount auth check → const isAuthorized = flagTouchesRepos(flag, repos);

Notes

Pure refactor - zero behavior change. tsc, eslint, and vitest all pass.

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@Shiva210Jyoti is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Shiva210Jyoti

Copy link
Copy Markdown
Author

@jakharmonika364 The PR is ready for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flagged account evidence matching logic is now duplicated three times

1 participant