@humanbased/crosscheck 1.2.0-beta.80 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +388 -149
- package/README.zh.md +1 -1
- package/crosscheck.config.example.yml +2 -63
- package/dist/__tests__/codex.test.js +27 -14
- package/dist/__tests__/codex.test.js.map +1 -1
- package/dist/__tests__/comment-bodies.test.js +1 -49
- package/dist/__tests__/comment-bodies.test.js.map +1 -1
- package/dist/__tests__/conflict-resolve.test.js +1 -44
- package/dist/__tests__/conflict-resolve.test.js.map +1 -1
- package/dist/__tests__/fix.test.js +0 -33
- package/dist/__tests__/fix.test.js.map +1 -1
- package/dist/__tests__/onboard-preservation.test.js +0 -5
- package/dist/__tests__/onboard-preservation.test.js.map +1 -1
- package/dist/__tests__/optimize.test.js +0 -2
- package/dist/__tests__/optimize.test.js.map +1 -1
- package/dist/__tests__/repo-picker.test.js +1 -7
- package/dist/__tests__/repo-picker.test.js.map +1 -1
- package/dist/__tests__/review-comment-body.test.js +0 -35
- package/dist/__tests__/review-comment-body.test.js.map +1 -1
- package/dist/__tests__/review-models.test.js +3 -19
- package/dist/__tests__/review-models.test.js.map +1 -1
- package/dist/__tests__/runner.test.js +1 -29
- package/dist/__tests__/runner.test.js.map +1 -1
- package/dist/cli.js +0 -29
- package/dist/cli.js.map +1 -1
- package/dist/commands/onboard.d.ts +0 -11
- package/dist/commands/onboard.d.ts.map +1 -1
- package/dist/commands/onboard.js +2 -88
- package/dist/commands/onboard.js.map +1 -1
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +6 -65
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +3 -23
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -53
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +6 -52
- package/dist/commands/watch.js.map +1 -1
- package/dist/config/loader.d.ts +1 -3
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +0 -13
- package/dist/config/loader.js.map +1 -1
- package/dist/config/review-model-tiers.json +3 -3
- package/dist/config/schema.d.ts +10 -254
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +2 -62
- package/dist/config/schema.js.map +1 -1
- package/dist/github/client.d.ts +1 -6
- package/dist/github/client.d.ts.map +1 -1
- package/dist/github/client.js +7 -15
- package/dist/github/client.js.map +1 -1
- package/dist/issues/ticket-ref.d.ts.map +1 -1
- package/dist/issues/ticket-ref.js +5 -6
- package/dist/issues/ticket-ref.js.map +1 -1
- package/dist/lib/clone.d.ts +0 -1
- package/dist/lib/clone.d.ts.map +1 -1
- package/dist/lib/clone.js +10 -32
- package/dist/lib/clone.js.map +1 -1
- package/dist/lib/comment-bodies.d.ts +0 -35
- package/dist/lib/comment-bodies.d.ts.map +1 -1
- package/dist/lib/comment-bodies.js +9 -43
- package/dist/lib/comment-bodies.js.map +1 -1
- package/dist/lib/repo-picker.d.ts +0 -3
- package/dist/lib/repo-picker.d.ts.map +1 -1
- package/dist/lib/repo-picker.js +9 -45
- package/dist/lib/repo-picker.js.map +1 -1
- package/dist/lib/review-models.d.ts +2 -15
- package/dist/lib/review-models.d.ts.map +1 -1
- package/dist/lib/review-models.js +6 -26
- package/dist/lib/review-models.js.map +1 -1
- package/dist/lib/runner.d.ts +0 -12
- package/dist/lib/runner.d.ts.map +1 -1
- package/dist/lib/runner.js +42 -186
- package/dist/lib/runner.js.map +1 -1
- package/dist/lib/workflow.d.ts +0 -9
- package/dist/lib/workflow.d.ts.map +1 -1
- package/dist/lib/workflow.js +0 -20
- package/dist/lib/workflow.js.map +1 -1
- package/dist/reviewers/claude.d.ts +1 -4
- package/dist/reviewers/claude.d.ts.map +1 -1
- package/dist/reviewers/claude.js +7 -39
- package/dist/reviewers/claude.js.map +1 -1
- package/dist/reviewers/codex.d.ts +1 -3
- package/dist/reviewers/codex.d.ts.map +1 -1
- package/dist/reviewers/codex.js +70 -76
- package/dist/reviewers/codex.js.map +1 -1
- package/dist/reviewers/conflict-resolve.d.ts +1 -3
- package/dist/reviewers/conflict-resolve.d.ts.map +1 -1
- package/dist/reviewers/conflict-resolve.js +6 -21
- package/dist/reviewers/conflict-resolve.js.map +1 -1
- package/dist/reviewers/fix.d.ts +2 -5
- package/dist/reviewers/fix.d.ts.map +1 -1
- package/dist/reviewers/fix.js +10 -26
- package/dist/reviewers/fix.js.map +1 -1
- package/get-started.md +4 -139
- package/package.json +3 -4
- package/assets/icon-256.png +0 -0
- package/assets/linear-comment.svg +0 -18
- package/assets/linear-onboard.svg +0 -30
- package/assets/linear-status.svg +0 -23
- package/assets/linear-test.svg +0 -34
- package/assets/skills/code-review/.crosscheck-skill.json +0 -9
- package/assets/skills/code-review/LICENSE +0 -21
- package/assets/skills/code-review/SKILL.md +0 -89
- package/assets/skills/code-review/agents/openai.yaml +0 -3
- package/assets/skills/code-review-skill/.crosscheck-skill.json +0 -9
- package/assets/skills/code-review-skill/LICENSE +0 -21
- package/assets/skills/code-review-skill/SKILL.md +0 -231
- package/assets/skills/code-review-skill/assets/pr-review-template.md +0 -137
- package/assets/skills/code-review-skill/assets/review-checklist.md +0 -123
- package/assets/skills/code-review-skill/reference/angular.md +0 -768
- package/assets/skills/code-review-skill/reference/architecture-review-guide.md +0 -472
- package/assets/skills/code-review-skill/reference/c.md +0 -890
- package/assets/skills/code-review-skill/reference/code-quality-universal.md +0 -488
- package/assets/skills/code-review-skill/reference/code-review-best-practices.md +0 -136
- package/assets/skills/code-review-skill/reference/common-bugs-checklist.md +0 -286
- package/assets/skills/code-review-skill/reference/cpp.md +0 -893
- package/assets/skills/code-review-skill/reference/cross-cutting/async-concurrency-patterns.md +0 -515
- package/assets/skills/code-review-skill/reference/cross-cutting/error-handling-principles.md +0 -492
- package/assets/skills/code-review-skill/reference/cross-cutting/n-plus-one-queries.md +0 -309
- package/assets/skills/code-review-skill/reference/cross-cutting/sql-injection-prevention.md +0 -308
- package/assets/skills/code-review-skill/reference/cross-cutting/xss-prevention.md +0 -264
- package/assets/skills/code-review-skill/reference/csharp.md +0 -525
- package/assets/skills/code-review-skill/reference/css-less-sass.md +0 -661
- package/assets/skills/code-review-skill/reference/django.md +0 -985
- package/assets/skills/code-review-skill/reference/fastapi.md +0 -580
- package/assets/skills/code-review-skill/reference/go.md +0 -993
- package/assets/skills/code-review-skill/reference/java.md +0 -409
- package/assets/skills/code-review-skill/reference/java8.md +0 -586
- package/assets/skills/code-review-skill/reference/kotlin.md +0 -1018
- package/assets/skills/code-review-skill/reference/nestjs.md +0 -593
- package/assets/skills/code-review-skill/reference/performance-review-guide.md +0 -816
- package/assets/skills/code-review-skill/reference/php.md +0 -684
- package/assets/skills/code-review-skill/reference/python.md +0 -1073
- package/assets/skills/code-review-skill/reference/qt.md +0 -757
- package/assets/skills/code-review-skill/reference/react.md +0 -871
- package/assets/skills/code-review-skill/reference/ruby.md +0 -964
- package/assets/skills/code-review-skill/reference/rust.md +0 -846
- package/assets/skills/code-review-skill/reference/security-review-guide.md +0 -494
- package/assets/skills/code-review-skill/reference/svelte.md +0 -1064
- package/assets/skills/code-review-skill/reference/swift.md +0 -936
- package/assets/skills/code-review-skill/reference/typescript.md +0 -1016
- package/assets/skills/code-review-skill/reference/vue.md +0 -924
- package/assets/skills/code-review-skill/reference/zig.md +0 -440
- package/assets/skills/code-review-skill/scripts/pr-analyzer.py +0 -435
- package/assets/skills/code-review-skill/scripts/test_pr_analyzer.py +0 -380
- package/assets/skills/codebase-design/.crosscheck-skill.json +0 -9
- package/assets/skills/codebase-design/DEEPENING.md +0 -37
- package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/assets/skills/codebase-design/LICENSE +0 -21
- package/assets/skills/codebase-design/SKILL.md +0 -114
- package/assets/skills/codebase-design/agents/openai.yaml +0 -3
- package/assets/skills/diagnosing-bugs/.crosscheck-skill.json +0 -9
- package/assets/skills/diagnosing-bugs/LICENSE +0 -21
- package/assets/skills/diagnosing-bugs/SKILL.md +0 -134
- package/assets/skills/diagnosing-bugs/agents/openai.yaml +0 -3
- package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -41
- package/dist/__tests__/can-write-verdict.test.d.ts +0 -2
- package/dist/__tests__/can-write-verdict.test.d.ts.map +0 -1
- package/dist/__tests__/can-write-verdict.test.js +0 -31
- package/dist/__tests__/can-write-verdict.test.js.map +0 -1
- package/dist/__tests__/linear-branding.test.d.ts +0 -2
- package/dist/__tests__/linear-branding.test.d.ts.map +0 -1
- package/dist/__tests__/linear-branding.test.js +0 -156
- package/dist/__tests__/linear-branding.test.js.map +0 -1
- package/dist/__tests__/linear-client.test.d.ts +0 -2
- package/dist/__tests__/linear-client.test.d.ts.map +0 -1
- package/dist/__tests__/linear-client.test.js +0 -120
- package/dist/__tests__/linear-client.test.js.map +0 -1
- package/dist/__tests__/linear-comment.test.d.ts +0 -2
- package/dist/__tests__/linear-comment.test.d.ts.map +0 -1
- package/dist/__tests__/linear-comment.test.js +0 -151
- package/dist/__tests__/linear-comment.test.js.map +0 -1
- package/dist/__tests__/linear-identity.test.d.ts +0 -2
- package/dist/__tests__/linear-identity.test.d.ts.map +0 -1
- package/dist/__tests__/linear-identity.test.js +0 -253
- package/dist/__tests__/linear-identity.test.js.map +0 -1
- package/dist/__tests__/linear-notify.test.d.ts +0 -2
- package/dist/__tests__/linear-notify.test.d.ts.map +0 -1
- package/dist/__tests__/linear-notify.test.js +0 -144
- package/dist/__tests__/linear-notify.test.js.map +0 -1
- package/dist/__tests__/linear-ref.test.d.ts +0 -2
- package/dist/__tests__/linear-ref.test.d.ts.map +0 -1
- package/dist/__tests__/linear-ref.test.js +0 -261
- package/dist/__tests__/linear-ref.test.js.map +0 -1
- package/dist/__tests__/linear-test-ref.test.d.ts +0 -2
- package/dist/__tests__/linear-test-ref.test.d.ts.map +0 -1
- package/dist/__tests__/linear-test-ref.test.js +0 -81
- package/dist/__tests__/linear-test-ref.test.js.map +0 -1
- package/dist/__tests__/linear-verify.test.d.ts +0 -2
- package/dist/__tests__/linear-verify.test.d.ts.map +0 -1
- package/dist/__tests__/linear-verify.test.js +0 -132
- package/dist/__tests__/linear-verify.test.js.map +0 -1
- package/dist/__tests__/linear-worker.test.d.ts +0 -2
- package/dist/__tests__/linear-worker.test.d.ts.map +0 -1
- package/dist/__tests__/linear-worker.test.js +0 -83
- package/dist/__tests__/linear-worker.test.js.map +0 -1
- package/dist/__tests__/linear-write-possible.test.d.ts +0 -2
- package/dist/__tests__/linear-write-possible.test.d.ts.map +0 -1
- package/dist/__tests__/linear-write-possible.test.js +0 -30
- package/dist/__tests__/linear-write-possible.test.js.map +0 -1
- package/dist/__tests__/repository-guidance.test.d.ts +0 -2
- package/dist/__tests__/repository-guidance.test.d.ts.map +0 -1
- package/dist/__tests__/repository-guidance.test.js +0 -107
- package/dist/__tests__/repository-guidance.test.js.map +0 -1
- package/dist/__tests__/review-strategy.test.d.ts +0 -2
- package/dist/__tests__/review-strategy.test.d.ts.map +0 -1
- package/dist/__tests__/review-strategy.test.js +0 -195
- package/dist/__tests__/review-strategy.test.js.map +0 -1
- package/dist/__tests__/skill-attribution.test.d.ts +0 -2
- package/dist/__tests__/skill-attribution.test.d.ts.map +0 -1
- package/dist/__tests__/skill-attribution.test.js +0 -53
- package/dist/__tests__/skill-attribution.test.js.map +0 -1
- package/dist/__tests__/skill-broker.test.d.ts +0 -2
- package/dist/__tests__/skill-broker.test.d.ts.map +0 -1
- package/dist/__tests__/skill-broker.test.js +0 -144
- package/dist/__tests__/skill-broker.test.js.map +0 -1
- package/dist/__tests__/skill-catalog.test.d.ts +0 -2
- package/dist/__tests__/skill-catalog.test.d.ts.map +0 -1
- package/dist/__tests__/skill-catalog.test.js +0 -40
- package/dist/__tests__/skill-catalog.test.js.map +0 -1
- package/dist/__tests__/skill-installer.test.d.ts +0 -2
- package/dist/__tests__/skill-installer.test.d.ts.map +0 -1
- package/dist/__tests__/skill-installer.test.js +0 -96
- package/dist/__tests__/skill-installer.test.js.map +0 -1
- package/dist/__tests__/skills-config.test.d.ts +0 -2
- package/dist/__tests__/skills-config.test.d.ts.map +0 -1
- package/dist/__tests__/skills-config.test.js +0 -12
- package/dist/__tests__/skills-config.test.js.map +0 -1
- package/dist/commands/linear-test.d.ts +0 -18
- package/dist/commands/linear-test.d.ts.map +0 -1
- package/dist/commands/linear-test.js +0 -130
- package/dist/commands/linear-test.js.map +0 -1
- package/dist/commands/skill.d.ts +0 -2
- package/dist/commands/skill.d.ts.map +0 -1
- package/dist/commands/skill.js +0 -16
- package/dist/commands/skill.js.map +0 -1
- package/dist/config/review-strategy.json +0 -202
- package/dist/lib/repository-guidance.d.ts +0 -2
- package/dist/lib/repository-guidance.d.ts.map +0 -1
- package/dist/lib/repository-guidance.js +0 -55
- package/dist/lib/repository-guidance.js.map +0 -1
- package/dist/lib/review-strategy.d.ts +0 -62
- package/dist/lib/review-strategy.d.ts.map +0 -1
- package/dist/lib/review-strategy.js +0 -235
- package/dist/lib/review-strategy.js.map +0 -1
- package/dist/linear/client.d.ts +0 -18
- package/dist/linear/client.d.ts.map +0 -1
- package/dist/linear/client.js +0 -67
- package/dist/linear/client.js.map +0 -1
- package/dist/linear/comment.d.ts +0 -20
- package/dist/linear/comment.d.ts.map +0 -1
- package/dist/linear/comment.js +0 -57
- package/dist/linear/comment.js.map +0 -1
- package/dist/linear/identity.d.ts +0 -59
- package/dist/linear/identity.d.ts.map +0 -1
- package/dist/linear/identity.js +0 -187
- package/dist/linear/identity.js.map +0 -1
- package/dist/linear/notify.d.ts +0 -35
- package/dist/linear/notify.d.ts.map +0 -1
- package/dist/linear/notify.js +0 -76
- package/dist/linear/notify.js.map +0 -1
- package/dist/linear/ref.d.ts +0 -13
- package/dist/linear/ref.d.ts.map +0 -1
- package/dist/linear/ref.js +0 -90
- package/dist/linear/ref.js.map +0 -1
- package/dist/linear/verify.d.ts +0 -26
- package/dist/linear/verify.d.ts.map +0 -1
- package/dist/linear/verify.js +0 -67
- package/dist/linear/verify.js.map +0 -1
- package/dist/skills/attribution.d.ts +0 -4
- package/dist/skills/attribution.d.ts.map +0 -1
- package/dist/skills/attribution.js +0 -14
- package/dist/skills/attribution.js.map +0 -1
- package/dist/skills/broker-server.d.ts +0 -2
- package/dist/skills/broker-server.d.ts.map +0 -1
- package/dist/skills/broker-server.js +0 -17
- package/dist/skills/broker-server.js.map +0 -1
- package/dist/skills/broker.d.ts +0 -42
- package/dist/skills/broker.d.ts.map +0 -1
- package/dist/skills/broker.js +0 -285
- package/dist/skills/broker.js.map +0 -1
- package/dist/skills/catalog.d.ts +0 -28
- package/dist/skills/catalog.d.ts.map +0 -1
- package/dist/skills/catalog.js +0 -104
- package/dist/skills/catalog.js.map +0 -1
- package/dist/skills/installer.d.ts +0 -10
- package/dist/skills/installer.d.ts.map +0 -1
- package/dist/skills/installer.js +0 -138
- package/dist/skills/installer.js.map +0 -1
- package/dist/skills/integrity.d.ts +0 -4
- package/dist/skills/integrity.d.ts.map +0 -1
- package/dist/skills/integrity.js +0 -36
- package/dist/skills/integrity.js.map +0 -1
- package/docs/dynamic-thoroughness.md +0 -286
- package/docs/linear-identity-contract.md +0 -139
- package/docs/linear-identity.md +0 -293
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: diagnosing-bugs
|
|
3
|
-
description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Diagnosing Bugs
|
|
7
|
-
|
|
8
|
-
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
9
|
-
|
|
10
|
-
When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
|
11
|
-
|
|
12
|
-
## Phase 1 — Build a feedback loop
|
|
13
|
-
|
|
14
|
-
**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on _this_ bug — you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.
|
|
15
|
-
|
|
16
|
-
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
17
|
-
|
|
18
|
-
### Ways to construct one — try them in roughly this order
|
|
19
|
-
|
|
20
|
-
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
21
|
-
2. **Curl / HTTP script** against a running dev server.
|
|
22
|
-
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
23
|
-
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
24
|
-
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
25
|
-
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
26
|
-
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
27
|
-
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
28
|
-
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
29
|
-
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
|
30
|
-
|
|
31
|
-
Build the right feedback loop, and the bug is 90% fixed.
|
|
32
|
-
|
|
33
|
-
### Tighten the loop
|
|
34
|
-
|
|
35
|
-
Treat the loop as a product. Once you have _a_ loop, **tighten** it:
|
|
36
|
-
|
|
37
|
-
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
38
|
-
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
39
|
-
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
40
|
-
|
|
41
|
-
A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.
|
|
42
|
-
|
|
43
|
-
### Non-deterministic bugs
|
|
44
|
-
|
|
45
|
-
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
46
|
-
|
|
47
|
-
### When you genuinely cannot build a loop
|
|
48
|
-
|
|
49
|
-
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
50
|
-
|
|
51
|
-
### Completion criterion — a tight loop that goes red
|
|
52
|
-
|
|
53
|
-
Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (paste the invocation and its output), and that is:
|
|
54
|
-
|
|
55
|
-
- [ ] **Red-capable** — it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring" — it must be able to _catch this specific bug_.
|
|
56
|
-
- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
|
|
57
|
-
- [ ] **Fast** — seconds, not minutes.
|
|
58
|
-
- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.
|
|
59
|
-
|
|
60
|
-
If you catch yourself reading code to build a theory before this command exists, **stop — jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.
|
|
61
|
-
|
|
62
|
-
## Phase 2 — Reproduce + minimise
|
|
63
|
-
|
|
64
|
-
Run the loop. Watch it go red — the bug appears.
|
|
65
|
-
|
|
66
|
-
Confirm:
|
|
67
|
-
|
|
68
|
-
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
69
|
-
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
70
|
-
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
71
|
-
|
|
72
|
-
### Minimise
|
|
73
|
-
|
|
74
|
-
Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what's load-bearing for the failure.
|
|
75
|
-
|
|
76
|
-
Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.
|
|
77
|
-
|
|
78
|
-
Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green.
|
|
79
|
-
|
|
80
|
-
Do not proceed until you have reproduced **and** minimised.
|
|
81
|
-
|
|
82
|
-
## Phase 3 — Hypothesise
|
|
83
|
-
|
|
84
|
-
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
85
|
-
|
|
86
|
-
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
87
|
-
|
|
88
|
-
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
89
|
-
|
|
90
|
-
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
91
|
-
|
|
92
|
-
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
93
|
-
|
|
94
|
-
## Phase 4 — Instrument
|
|
95
|
-
|
|
96
|
-
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
97
|
-
|
|
98
|
-
Tool preference:
|
|
99
|
-
|
|
100
|
-
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
101
|
-
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
102
|
-
3. Never "log everything and grep".
|
|
103
|
-
|
|
104
|
-
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
105
|
-
|
|
106
|
-
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
107
|
-
|
|
108
|
-
## Phase 5 — Fix + regression test
|
|
109
|
-
|
|
110
|
-
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
111
|
-
|
|
112
|
-
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
113
|
-
|
|
114
|
-
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
115
|
-
|
|
116
|
-
If a correct seam exists:
|
|
117
|
-
|
|
118
|
-
1. Turn the minimised repro into a failing test at that seam.
|
|
119
|
-
2. Watch it fail.
|
|
120
|
-
3. Apply the fix.
|
|
121
|
-
4. Watch it pass.
|
|
122
|
-
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
123
|
-
|
|
124
|
-
## Phase 6 — Cleanup + post-mortem
|
|
125
|
-
|
|
126
|
-
Required before declaring done:
|
|
127
|
-
|
|
128
|
-
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
129
|
-
- [ ] Regression test passes (or absence of seam is documented)
|
|
130
|
-
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
131
|
-
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
132
|
-
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
133
|
-
|
|
134
|
-
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Human-in-the-loop reproduction loop.
|
|
3
|
-
# Copy this file, edit the steps below, and run it.
|
|
4
|
-
# The agent runs the script; the user follows prompts in their terminal.
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# bash hitl-loop.template.sh
|
|
8
|
-
#
|
|
9
|
-
# Two helpers:
|
|
10
|
-
# step "<instruction>" → show instruction, wait for Enter
|
|
11
|
-
# capture VAR "<question>" → show question, read response into VAR
|
|
12
|
-
#
|
|
13
|
-
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
|
14
|
-
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
step() {
|
|
18
|
-
printf '\n>>> %s\n' "$1"
|
|
19
|
-
read -r -p " [Enter when done] " _
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
capture() {
|
|
23
|
-
local var="$1" question="$2" answer
|
|
24
|
-
printf '\n>>> %s\n' "$question"
|
|
25
|
-
read -r -p " > " answer
|
|
26
|
-
printf -v "$var" '%s' "$answer"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
# --- edit below ---------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
step "Open the app at http://localhost:3000 and sign in."
|
|
32
|
-
|
|
33
|
-
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
34
|
-
|
|
35
|
-
capture ERROR_MSG "Paste the error message (or 'none'):"
|
|
36
|
-
|
|
37
|
-
# --- edit above ---------------------------------------------------------
|
|
38
|
-
|
|
39
|
-
printf '\n--- Captured ---\n'
|
|
40
|
-
printf 'ERRORED=%s\n' "$ERRORED"
|
|
41
|
-
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"can-write-verdict.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/can-write-verdict.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { canWriteVerdict } from '../lib/workflow.js';
|
|
3
|
-
describe('canWriteVerdict', () => {
|
|
4
|
-
// Only review and recheck post a verdict, and only a verdict reaches Linear.
|
|
5
|
-
// `crosscheck fix` and `crosscheck resolve` must not abort on a Linear outage.
|
|
6
|
-
it('is true for a workflow containing a review', () => {
|
|
7
|
-
expect(canWriteVerdict([{ type: 'review' }])).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
it('is true for a workflow containing a recheck', () => {
|
|
10
|
-
expect(canWriteVerdict([{ type: 'recheck' }])).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
it('is true for the full loop', () => {
|
|
13
|
-
expect(canWriteVerdict([{ type: 'review' }, { type: 'fix' }, { type: 'recheck' }])).toBe(true);
|
|
14
|
-
});
|
|
15
|
-
it('is false for a fix-only workflow — the `crosscheck fix` alias', () => {
|
|
16
|
-
expect(canWriteVerdict([{ type: 'fix' }])).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
it('is false for conflict-resolve only — the `crosscheck resolve` alias', () => {
|
|
19
|
-
expect(canWriteVerdict([{ type: 'conflict-resolve' }])).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
it('is false for fix plus conflict-resolve', () => {
|
|
22
|
-
expect(canWriteVerdict([{ type: 'conflict-resolve' }, { type: 'fix' }])).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
it('is false for an empty workflow', () => {
|
|
25
|
-
expect(canWriteVerdict([])).toBe(false);
|
|
26
|
-
});
|
|
27
|
-
it('fails open when the steps are unknown, so a real workflow is never starved', () => {
|
|
28
|
-
expect(canWriteVerdict(undefined)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=can-write-verdict.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"can-write-verdict.test.js","sourceRoot":"","sources":["../../src/__tests__/can-write-ver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ACrE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;QACpF,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linear-branding.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/linear-branding.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { renderSignature, renderIcon, resolveLinearAuth } from '../linear/identity.js';
|
|
3
|
-
import { buildLinearCommentBody } from '../linear/comment.js';
|
|
4
|
-
import { notifyLinear } from '../linear/notify.js';
|
|
5
|
-
import { LinearConfigSchema } from '../config/schema.js';
|
|
6
|
-
function cfg(overrides = {}) {
|
|
7
|
-
return LinearConfigSchema.parse({ enabled: true, team_keys: ['IN'], ...overrides });
|
|
8
|
-
}
|
|
9
|
-
const VARS = { actor: 'crosscheck/review', product: 'crosscheck' };
|
|
10
|
-
describe('renderSignature — model and reviewer', () => {
|
|
11
|
-
it('expands {model}', () => {
|
|
12
|
-
expect(renderSignature('🤖 {actor} · {model}', { ...VARS, model: 'claude-opus-4.5' }))
|
|
13
|
-
.toBe('🤖 crosscheck/review · claude-opus-4.5');
|
|
14
|
-
});
|
|
15
|
-
it('expands {reviewer}', () => {
|
|
16
|
-
expect(renderSignature('{reviewer} · {model}', { ...VARS, reviewer: 'codex', model: 'gpt-5' }))
|
|
17
|
-
.toBe('codex · gpt-5');
|
|
18
|
-
});
|
|
19
|
-
it('preserves hyphens in model names', () => {
|
|
20
|
-
// The separator tidier must not touch `-`, or claude-opus-4.5 gets mangled.
|
|
21
|
-
expect(renderSignature('{model}', { ...VARS, model: 'claude-opus-4.5' })).toBe('claude-opus-4.5');
|
|
22
|
-
});
|
|
23
|
-
it('drops the trailing separator when the model is unknown', () => {
|
|
24
|
-
expect(renderSignature('🤖 {actor} · {product} · {model}', VARS)).toBe('🤖 crosscheck/review · crosscheck');
|
|
25
|
-
});
|
|
26
|
-
it('drops a stranded separator in the middle', () => {
|
|
27
|
-
expect(renderSignature('{actor} · {model} · {product}', VARS)).toBe('crosscheck/review · crosscheck');
|
|
28
|
-
});
|
|
29
|
-
it('handles every optional placeholder being empty', () => {
|
|
30
|
-
expect(renderSignature('🤖 {icon} {actor} · {model} · {reviewer}', VARS)).toBe('🤖 crosscheck/review');
|
|
31
|
-
});
|
|
32
|
-
it('is unchanged when the template uses no optional placeholders', () => {
|
|
33
|
-
expect(renderSignature('🤖 {actor} · {product}', VARS)).toBe('🤖 crosscheck/review · crosscheck');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe('renderIcon', () => {
|
|
37
|
-
it('wraps a URL as inline markdown', () => {
|
|
38
|
-
expect(renderIcon('https://example.com/logo.png')).toBe('');
|
|
39
|
-
});
|
|
40
|
-
it('returns empty for an unset or blank URL', () => {
|
|
41
|
-
expect(renderIcon('')).toBe('');
|
|
42
|
-
expect(renderIcon(' ')).toBe('');
|
|
43
|
-
});
|
|
44
|
-
it('composes into a signature', () => {
|
|
45
|
-
const signature = renderSignature('{icon} {actor} · {model}', {
|
|
46
|
-
...VARS, model: 'gpt-5', icon: renderIcon('https://example.com/logo.png'),
|
|
47
|
-
});
|
|
48
|
-
expect(signature).toBe(' crosscheck/review · gpt-5');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('default signature template', () => {
|
|
52
|
-
it('includes the model placeholder', () => {
|
|
53
|
-
expect(cfg().identity.signature).toBe('🤖 {actor} · {model}');
|
|
54
|
-
});
|
|
55
|
-
it('renders cleanly at auth time, when no model is known yet', async () => {
|
|
56
|
-
const auth = await resolveLinearAuth(cfg(), { apiKey: 'k' });
|
|
57
|
-
expect(auth.signature).toBe('🤖 crosscheck');
|
|
58
|
-
});
|
|
59
|
-
it('defaults icon_url to empty so nothing renders unless configured', () => {
|
|
60
|
-
expect(cfg().identity.icon_url).toBe('');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('comment body — model on the verdict line', () => {
|
|
64
|
-
const BASE = {
|
|
65
|
-
signature: '🤖 crosscheck · crosscheck',
|
|
66
|
-
verdict: 'APPROVE',
|
|
67
|
-
reviewer: 'codex',
|
|
68
|
-
origin: 'claude',
|
|
69
|
-
prUrl: 'https://github.com/acme/app/pull/12',
|
|
70
|
-
prTitle: 'feat: widget',
|
|
71
|
-
};
|
|
72
|
-
it('names the model beside the reviewer', () => {
|
|
73
|
-
expect(buildLinearCommentBody({ ...BASE, model: 'gpt-5' }))
|
|
74
|
-
.toContain('**APPROVE** — codex (gpt-5) review of');
|
|
75
|
-
});
|
|
76
|
-
it('omits the parenthetical when the model is `default`', () => {
|
|
77
|
-
const body = buildLinearCommentBody({ ...BASE, model: 'default' });
|
|
78
|
-
expect(body).toContain('**APPROVE** — codex review of');
|
|
79
|
-
expect(body).not.toContain('(default)');
|
|
80
|
-
});
|
|
81
|
-
it('still records the model in the machine-readable annotation', () => {
|
|
82
|
-
expect(buildLinearCommentBody({ ...BASE, model: 'default' })).toContain('model=default');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
describe('notifyLinear — end-to-end branding', () => {
|
|
86
|
-
const AUTH = {
|
|
87
|
-
mode: 'client_credentials',
|
|
88
|
-
token: 'minted',
|
|
89
|
-
bearer: true,
|
|
90
|
-
actor: 'crosscheck/review',
|
|
91
|
-
signature: '🤖 crosscheck/review · crosscheck',
|
|
92
|
-
signatureTemplate: '🤖 {icon} {actor} · {product} · {model}',
|
|
93
|
-
product: 'crosscheck',
|
|
94
|
-
createAsUser: 'crosscheck/review',
|
|
95
|
-
};
|
|
96
|
-
const PR = { branch: 'feat/in-2269-x', title: 'feat: x', body: '', url: 'https://github.com/a/b/pull/1' };
|
|
97
|
-
function scriptedFetch() {
|
|
98
|
-
let call = 0;
|
|
99
|
-
return vi.fn(async () => {
|
|
100
|
-
call++;
|
|
101
|
-
if (call === 1) {
|
|
102
|
-
return new Response(JSON.stringify({
|
|
103
|
-
data: { issues: { nodes: [{ id: 'u1', identifier: 'IN-2269', url: 'https://linear.app/x/i' }] } },
|
|
104
|
-
}), { status: 200 });
|
|
105
|
-
}
|
|
106
|
-
return new Response(JSON.stringify({
|
|
107
|
-
data: { commentCreate: { success: true, comment: { id: 'c1', url: 'https://linear.app/x/c1' } } },
|
|
108
|
-
}), { status: 200 });
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
async function postedFirstLine(config, model) {
|
|
112
|
-
const fetchImpl = scriptedFetch();
|
|
113
|
-
await notifyLinear({ auth: AUTH, config, pr: PR, verdict: 'NEEDS_WORK', reviewer: 'codex', origin: 'claude', model }, { fetchImpl });
|
|
114
|
-
const calls = fetchImpl.mock.calls;
|
|
115
|
-
return JSON.parse(calls[1][1].body).variables.body.split('\n')[0];
|
|
116
|
-
}
|
|
117
|
-
it('puts the real model in the posted signature', async () => {
|
|
118
|
-
expect(await postedFirstLine(cfg(), 'claude-opus-4.5'))
|
|
119
|
-
.toBe('🤖 crosscheck/review · crosscheck · claude-opus-4.5');
|
|
120
|
-
});
|
|
121
|
-
it('renders the configured icon into the posted signature', async () => {
|
|
122
|
-
const config = cfg({ identity: { icon_url: 'https://example.com/logo.png' } });
|
|
123
|
-
expect(await postedFirstLine(config, 'gpt-5'))
|
|
124
|
-
.toBe('🤖  crosscheck/review · crosscheck · gpt-5');
|
|
125
|
-
});
|
|
126
|
-
it('omits the model rather than printing `default`', async () => {
|
|
127
|
-
expect(await postedFirstLine(cfg(), 'default')).toBe('🤖 crosscheck/review · crosscheck');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
describe('separator tidying is limited to empty placeholders', () => {
|
|
131
|
-
// Regression: the tidier collapsed ANY repeated separator, including ones the
|
|
132
|
-
// operator wrote deliberately between two present values.
|
|
133
|
-
it('preserves a separator the operator wrote between present values', () => {
|
|
134
|
-
expect(renderSignature('{actor} :: {product}', VARS)).toBe('crosscheck/review :: crosscheck');
|
|
135
|
-
});
|
|
136
|
-
it('preserves deliberate doubled separators between present values', () => {
|
|
137
|
-
expect(renderSignature('{actor} \u00b7 \u00b7 {product}', VARS)).toBe('crosscheck/review \u00b7 \u00b7 crosscheck');
|
|
138
|
-
});
|
|
139
|
-
it('preserves literal text that looks like a separator', () => {
|
|
140
|
-
expect(renderSignature('{actor} \u2014 built by {product}', VARS))
|
|
141
|
-
.toBe('crosscheck/review \u2014 built by crosscheck');
|
|
142
|
-
});
|
|
143
|
-
it('still removes the gap an empty middle placeholder leaves', () => {
|
|
144
|
-
expect(renderSignature('{actor} \u00b7 {model} \u00b7 {product}', VARS)).toBe('crosscheck/review \u00b7 crosscheck');
|
|
145
|
-
});
|
|
146
|
-
it('still removes a trailing empty placeholder and its separator', () => {
|
|
147
|
-
expect(renderSignature('{actor} \u00b7 {model}', VARS)).toBe('crosscheck/review');
|
|
148
|
-
});
|
|
149
|
-
it('still removes a leading empty placeholder and its separator', () => {
|
|
150
|
-
expect(renderSignature('{icon} {actor}', VARS)).toBe('crosscheck/review');
|
|
151
|
-
});
|
|
152
|
-
it('leaves no sentinel character behind', () => {
|
|
153
|
-
expect(renderSignature('\ud83e\udd16 {icon} {actor} \u00b7 {model}', VARS)).not.toContain('\u0000');
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=linear-branding.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linear-branding.test.js","sourceRoot":"","sources":["../../src/__tests__/linear-branding.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAkB,MAAM,uBAAuB,CAAA;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,SAAS,GAAG,CAAC,YAAqC,EAAE;IAClD,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAA;AACrF,CAAC;AAED,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;AAElE,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,eAAe,CAAC,sBAAsB,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;aACnF,IAAI,CAAC,wCAAwC,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,eAAe,CAAC,sBAAsB,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;aAC5F,IAAI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AAC,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAA;IACrH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,eAAe,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;aAC/D,IAAI,CAAC,8CAA8C,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CAAC,eAAe,CAAC,yCAAyC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAA;IACtH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,CAAC,eAAe,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IACnF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,eAAe,CAAC,4CAA4C,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACrG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linear-client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/linear-client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { linearGraphQL, findIssueByIdentifier, postLinearComment } from '../linear/client.js';
|
|
3
|
-
const API_KEY_AUTH = {
|
|
4
|
-
mode: 'api_key',
|
|
5
|
-
token: 'lin_api_secret',
|
|
6
|
-
bearer: false,
|
|
7
|
-
actor: 'crosscheck',
|
|
8
|
-
signature: '🤖 crosscheck · crosscheck',
|
|
9
|
-
signatureTemplate: '🤖 {actor} · {product}',
|
|
10
|
-
product: 'crosscheck',
|
|
11
|
-
};
|
|
12
|
-
const APP_AUTH = {
|
|
13
|
-
mode: 'client_credentials',
|
|
14
|
-
token: 'minted-token',
|
|
15
|
-
bearer: true,
|
|
16
|
-
actor: 'crosscheck',
|
|
17
|
-
signature: '🤖 crosscheck · crosscheck',
|
|
18
|
-
signatureTemplate: '🤖 {actor} · {product}',
|
|
19
|
-
product: 'crosscheck',
|
|
20
|
-
createAsUser: 'crosscheck',
|
|
21
|
-
};
|
|
22
|
-
function jsonFetch(payload, status = 200) {
|
|
23
|
-
return vi.fn(async () => new Response(JSON.stringify(payload), { status }));
|
|
24
|
-
}
|
|
25
|
-
function lastCall(fetchImpl) {
|
|
26
|
-
const calls = fetchImpl.mock.calls;
|
|
27
|
-
return calls[calls.length - 1];
|
|
28
|
-
}
|
|
29
|
-
describe('linearGraphQL', () => {
|
|
30
|
-
it('sends an api_key as a bare Authorization header', async () => {
|
|
31
|
-
const fetchImpl = jsonFetch({ data: { ok: true } });
|
|
32
|
-
await linearGraphQL(API_KEY_AUTH, 'query { ok }', {}, { fetchImpl });
|
|
33
|
-
const [url, init] = lastCall(fetchImpl);
|
|
34
|
-
expect(url).toBe('https://api.linear.app/graphql');
|
|
35
|
-
expect(init.headers.Authorization).toBe('lin_api_secret');
|
|
36
|
-
});
|
|
37
|
-
it('sends a minted app token as a Bearer header', async () => {
|
|
38
|
-
const fetchImpl = jsonFetch({ data: { ok: true } });
|
|
39
|
-
await linearGraphQL(APP_AUTH, 'query { ok }', {}, { fetchImpl });
|
|
40
|
-
expect(lastCall(fetchImpl)[1].headers.Authorization).toBe('Bearer minted-token');
|
|
41
|
-
});
|
|
42
|
-
it('never puts the token in the URL', async () => {
|
|
43
|
-
const fetchImpl = jsonFetch({ data: { ok: true } });
|
|
44
|
-
await linearGraphQL(API_KEY_AUTH, 'query { ok }', {}, { fetchImpl });
|
|
45
|
-
expect(lastCall(fetchImpl)[0]).not.toContain('lin_api_secret');
|
|
46
|
-
});
|
|
47
|
-
it('sends the query and variables as a JSON body', async () => {
|
|
48
|
-
const fetchImpl = jsonFetch({ data: { ok: true } });
|
|
49
|
-
await linearGraphQL(API_KEY_AUTH, 'query($a: String) { ok }', { a: 'b' }, { fetchImpl });
|
|
50
|
-
const body = JSON.parse(lastCall(fetchImpl)[1].body);
|
|
51
|
-
expect(body.query).toBe('query($a: String) { ok }');
|
|
52
|
-
expect(body.variables).toEqual({ a: 'b' });
|
|
53
|
-
});
|
|
54
|
-
it('throws on a GraphQL error without leaking the token', async () => {
|
|
55
|
-
const fetchImpl = jsonFetch({ errors: [{ message: 'Access denied' }] });
|
|
56
|
-
const err = await linearGraphQL(API_KEY_AUTH, 'query { ok }', {}, { fetchImpl })
|
|
57
|
-
.then(() => null, (e) => e);
|
|
58
|
-
expect(err.message).toContain('Access denied');
|
|
59
|
-
expect(err.message).not.toContain('lin_api_secret');
|
|
60
|
-
});
|
|
61
|
-
it('throws on a non-2xx response without leaking the token', async () => {
|
|
62
|
-
const fetchImpl = jsonFetch({ error: 'unauthorized' }, 401);
|
|
63
|
-
const err = await linearGraphQL(API_KEY_AUTH, 'query { ok }', {}, { fetchImpl })
|
|
64
|
-
.then(() => null, (e) => e);
|
|
65
|
-
expect(err.message).toContain('401');
|
|
66
|
-
expect(err.message).not.toContain('lin_api_secret');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('findIssueByIdentifier', () => {
|
|
70
|
-
it('returns the issue id and url when found', async () => {
|
|
71
|
-
const fetchImpl = jsonFetch({
|
|
72
|
-
data: { issues: { nodes: [{ id: 'uuid-1', identifier: 'IN-2269', url: 'https://linear.app/x/issue/IN-2269' }] } },
|
|
73
|
-
});
|
|
74
|
-
const issue = await findIssueByIdentifier(API_KEY_AUTH, 'IN-2269', { fetchImpl });
|
|
75
|
-
expect(issue).toEqual({ id: 'uuid-1', identifier: 'IN-2269', url: 'https://linear.app/x/issue/IN-2269' });
|
|
76
|
-
});
|
|
77
|
-
it('returns null when the issue does not exist', async () => {
|
|
78
|
-
const fetchImpl = jsonFetch({ data: { issues: { nodes: [] } } });
|
|
79
|
-
expect(await findIssueByIdentifier(API_KEY_AUTH, 'IN-9999', { fetchImpl })).toBeNull();
|
|
80
|
-
});
|
|
81
|
-
it('queries by team key and number parsed from the identifier', async () => {
|
|
82
|
-
const fetchImpl = jsonFetch({ data: { issues: { nodes: [] } } });
|
|
83
|
-
await findIssueByIdentifier(API_KEY_AUTH, 'IN-2269', { fetchImpl });
|
|
84
|
-
const body = JSON.parse(lastCall(fetchImpl)[1].body);
|
|
85
|
-
expect(body.variables).toEqual({ teamKey: 'IN', number: 2269 });
|
|
86
|
-
});
|
|
87
|
-
it('rejects a malformed identifier', async () => {
|
|
88
|
-
const fetchImpl = jsonFetch({ data: { issues: { nodes: [] } } });
|
|
89
|
-
await expect(findIssueByIdentifier(API_KEY_AUTH, 'not-an-id', { fetchImpl })).rejects.toThrow(/identifier/i);
|
|
90
|
-
expect(fetchImpl).not.toHaveBeenCalled();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('postLinearComment', () => {
|
|
94
|
-
const ok = () => jsonFetch({
|
|
95
|
-
data: { commentCreate: { success: true, comment: { id: 'c1', url: 'https://linear.app/x/issue/IN-1#comment-c1' } } },
|
|
96
|
-
});
|
|
97
|
-
it('passes createAsUser in client_credentials mode', async () => {
|
|
98
|
-
const fetchImpl = ok();
|
|
99
|
-
await postLinearComment(APP_AUTH, 'uuid-1', 'hello', { fetchImpl });
|
|
100
|
-
const body = JSON.parse(lastCall(fetchImpl)[1].body);
|
|
101
|
-
expect(body.variables.createAsUser).toBe('crosscheck');
|
|
102
|
-
expect(body.variables.issueId).toBe('uuid-1');
|
|
103
|
-
expect(body.variables.body).toBe('hello');
|
|
104
|
-
});
|
|
105
|
-
it('omits createAsUser in api_key mode', async () => {
|
|
106
|
-
const fetchImpl = ok();
|
|
107
|
-
await postLinearComment(API_KEY_AUTH, 'uuid-1', 'hello', { fetchImpl });
|
|
108
|
-
const body = JSON.parse(lastCall(fetchImpl)[1].body);
|
|
109
|
-
expect(body.variables.createAsUser).toBeUndefined();
|
|
110
|
-
});
|
|
111
|
-
it('returns the created comment', async () => {
|
|
112
|
-
const comment = await postLinearComment(APP_AUTH, 'uuid-1', 'hello', { fetchImpl: ok() });
|
|
113
|
-
expect(comment).toEqual({ id: 'c1', url: 'https://linear.app/x/issue/IN-1#comment-c1' });
|
|
114
|
-
});
|
|
115
|
-
it('throws when the mutation reports success: false', async () => {
|
|
116
|
-
const fetchImpl = jsonFetch({ data: { commentCreate: { success: false, comment: null } } });
|
|
117
|
-
await expect(postLinearComment(APP_AUTH, 'uuid-1', 'hello', { fetchImpl })).rejects.toThrow(/rejected/i);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
//# sourceMappingURL=linear-client.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linear-client.test.js","sourceRoot":"","sources":["../../src/__tests__/linear-client.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAI7F,MAAM,YAAY,GAAuB;IACvC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,4BAA4B;IACvC,iBAAiB,EAAE,wBAAwB;IAC3C,OAAO,EAAE,YAAY;CACtB,CAAA;AAED,MAAM,QAAQ,GAAuB;IACnC,IAAI,EAAE,oBA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