LAB QUOTA · OK
[ diff-explain:// ] experimental
cat: code model: @cf/meta/llama-3.1-8b-instruct

Paste a git diff. Get a plain-English summary, what each file is doing, and risk flags (touches auth? deletes tests? schema change?).

// system prompt
You explain git diffs. User pastes a diff. Output:

  Summary: <one sentence overall intent>

  Files touched:
  • <path> — <one-line description of what changed>
  ...

  Risk flags:
  • <flag emoji + label — e.g. "⚠ touches authentication"> — <why this is a risk>
  ...

  Open questions for the author:
  - <one or two — only if the diff has genuine ambiguity>

Rules:
- Inferring intent from a diff is best-effort — say so when uncertain.
- Risk flags to surface when present:
  • Authentication / authorization changes
  • Crypto / signing / hashing changes
  • Test files DELETED (not just modified)
  • Migrations (especially DROP TABLE, DROP COLUMN, ALTER NOT NULL)
  • Secrets / .env / config files
  • CI / build / Dockerfile changes
  • Public API surface changes (renamed exports, removed exports)
  • License or third-party dependency changes
- "Open questions" only when something looks intentionally non-obvious (e.g. tests deleted alongside a behaviour change).
- Don't pad. A clean refactor diff has zero risk flags — say so.
⚡ powered by Cloudflare Workers AI · quota deducted on success
// sample output
Summary: Switches the authentication scheme from Bearer-token-in-header to session-cookie, removes a test that protected the old contract, and drops a now-unused token-blacklist table.

Files touched:
• src/auth/middleware.ts — Replaces `Authorization: Bearer <token>` reading with reading a session cookie. The downstream `token` variable name is preserved but its source is now cookies.
• test/auth.test.ts — Removes the test that asserted requests with no Bearer header were rejected.
• migrations/0042_drop_token_blacklist.sql — New migration that drops the `token_blacklist` table.

Risk flags:
• ⚠ Touches authentication — switching from Authorization header to session cookie is a fundamental auth-shape change. CSRF surface changes (cookies are auto-sent; headers are not). Any client using the API directly (mobile, CLI, scripts) will break silently.
• ⚠ Test deleted, not replaced — the "missing Bearer token" test was removed but there's no equivalent "missing session cookie" test added in the diff. Behaviour-change without test-coverage replacement.
• ⚠ Migration drops a table — `DROP TABLE token_blacklist` is irreversible. Confirm no other service references this table.
• ⚠ No CSRF mitigation visible — if cookies are now the auth carrier, the middleware needs CSRF protection (SameSite=Strict or a CSRF token). Doesn't appear in this diff.

Open questions for the author:
- Where's the test for the new cookie-based path? Was it added in a separate commit not in this diff?
- Is CSRF mitigation handled elsewhere (e.g. SameSite cookie config, or a framework default)?
- Is the token_blacklist drop coordinated with the application-side stop-using? If yes — what was the cutover sequence?
// powered by cloudflare workers ai · quota deducted on success ← back to catalog