{
  "slug": "grype-library-vulnerability-matching-supports-context-cancellation-1749b943d706",
  "title": "grype library vulnerability matching supports context cancellation",
  "tools": [
    "grype"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-02-03T19:24:39.000Z",
  "announced_at": "2026-02-03T19:24:39.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When integrating Grype’s Go library and matching may need to stop early, call `FindMatchesContext` with a `context.Context`; it checks cancellation before each matcher call and returns on a context error.",
    "examples": [
      "ctx := context.Background() // replace with the workflow's cancellable context\nremainingMatches, ignoredMatches, err := vulnMatcher.FindMatchesContext(ctx, pkgs, pkgContext)"
    ],
    "gotchas": [
      "Version: v0.107.1",
      "ctx (required): `context.Context`; checked for errors before each matcher call for a package. A non-nil error returns immediately.",
      "pkgs (required): Packages to match.",
      "pkgContext (required): Package context used for matching and subsequent VEX matching."
    ]
  },
  "why_it_matters": "Stop long-running vulnerability matching early when integrating Grype into a Go coding workflow.",
  "before": "Call `FindMatches(pkgs, pkgContext)`; it uses `context.Background()` and does not support context cancellation.",
  "sources": [
    "https://github.com/anchore/grype/releases/tag/v0.107.1",
    "https://github.com/anchore/grype/pull/3200",
    "https://raw.githubusercontent.com/anchore/grype/v0.107.1/grype/vulnerability_matcher.go"
  ],
  "rank": 0.90017,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1-20261014",
    "verdict_id": "wave1-20261014:wave1-20261014-38f21f40af78ac61-0:gate",
    "evidence_hash": "72f0221208f938091c5b148b83b229a1274e6cdf06fa7b24b9f14fdd9f0502a3"
  },
  "review": {
    "draft_hash": "6274ac3b61418c6b113e1d924600d68427ce1445cec3a9edbfda24ff72d850aa",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1-20261014:gate",
    "reason": "2 of 3 judge runs approved with p_yes >= 0.9 (mean 0.90 >= 0.9; 2 needed) and Jev gave 0.78 (>= 0.6 needed)."
  }
}
