BNN-13 feat: validate bounty submission requirements#46
Conversation
|
@shuibui is attempting to deploy a commit to the Bounty Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis pull request introduces a bounty requirement validation system and integrates it into fake-bounty detection. A new 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/bounty-requirements.ts (1)
1-18: ⚡ Quick winAdd JSDoc to exported interfaces and functions.
All exported items in this module lack JSDoc documentation. Since this module is part of the public API (re-exported from
packages/core/src/index.ts), adding documentation will improve the developer experience for consumers.As per coding guidelines, "Use JSDoc for exported functions/types only."
📝 Suggested JSDoc additions
+/** + * Represents a single requirement criterion extracted from a bounty description. + */ export interface BountyRequirementCriterion { id: string sourceHeading: string text: string } +/** + * Represents a matched requirement criterion with the terms found in the submission. + */ export interface BountyRequirementMatch { criterion: BountyRequirementCriterion matchedTerms: string[] } +/** + * Validation result for a bounty submission against extracted requirement criteria. + */ export interface BountyRequirementValidation { status: "no_criteria" | "valid" | "missing_requirements" coverage: number requiredCount: number matched: BountyRequirementMatch[] missing: BountyRequirementCriterion[] } +/** + * Extracts requirement criteria from a bounty body by detecting requirement sections + * and parsing list items and paragraphs under those headings. + * + * `@param` body - The markdown body of the bounty description + * `@returns` Array of extracted requirement criteria + */ export function extractBountyRequirementCriteria( body: string ): BountyRequirementCriterion[] { +/** + * Validates a submission's text against the requirements extracted from a bounty body. + * Uses term-based matching to determine coverage of requirement criteria. + * + * `@param` opts.bountyBody - The markdown body of the bounty description + * `@param` opts.submissionText - The text content of the submission to validate + * `@returns` Validation result with status, coverage, and matched/missing criteria + */ export function validateBountySubmissionRequirements(opts: { bountyBody: string submissionText: string }): BountyRequirementValidation { +/** + * Formats a validation result into a human-readable message listing missing criteria. + * Returns null if the validation status is not "missing_requirements". + * + * `@param` validation - The validation result to format + * `@returns` Formatted message string or null + */ export function formatBountyRequirementValidation( validation: BountyRequirementValidation ): string | null {Also applies to: 121-162, 179-213, 215-233
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/bounty-requirements.ts` around lines 1 - 18, Add JSDoc comments to all exported types and functions in this module (e.g., BountyRequirementCriterion, BountyRequirementMatch, BountyRequirementValidation and any exported functions or other exported interfaces referenced in the file) so they are documented in the public API; for each exported symbol provide a one-line description, document properties/params and return types where applicable, and include any important notes or expected invariants; follow the project's JSDoc style used elsewhere (brief summary + `@param/`@returns/@remarks as appropriate) and apply the same to the other exported blocks mentioned (lines ~121-162, 179-213, 215-233) so every exported item in the file has JSDoc.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/core/src/bounty-requirements.ts`:
- Around line 1-18: Add JSDoc comments to all exported types and functions in
this module (e.g., BountyRequirementCriterion, BountyRequirementMatch,
BountyRequirementValidation and any exported functions or other exported
interfaces referenced in the file) so they are documented in the public API; for
each exported symbol provide a one-line description, document properties/params
and return types where applicable, and include any important notes or expected
invariants; follow the project's JSDoc style used elsewhere (brief summary +
`@param/`@returns/@remarks as appropriate) and apply the same to the other
exported blocks mentioned (lines ~121-162, 179-213, 215-233) so every exported
item in the file has JSDoc.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7ea0cdfe-7518-4345-b086-e5f226163f87
📒 Files selected for processing (5)
apps/web/src/routes/api/github/webhook.tspackages/core/src/bounty-requirements.test.tspackages/core/src/bounty-requirements.tspackages/core/src/fake-bounty.tspackages/core/src/index.ts
Summary
Refs #42
Validation
corepack pnpm install --frozen-lockfilecorepack pnpm --filter @tripwire/core test -- bounty-requirementscorepack pnpm --filter @tripwire/core typecheckcorepack pnpm exec prettier --check packages/core/src/bounty-requirements.ts packages/core/src/bounty-requirements.test.ts packages/core/src/fake-bounty.ts apps/web/src/routes/api/github/webhook.ts packages/core/src/index.tsReview Notes
requirements:and checkbox criteria, covering the review gap from the previously closed PR Validate bounty submission requirements #44.