quart-httpauth 0.0.1__tar.gz
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.
- quart_httpauth-0.0.1/.claude/rules/ci.md +29 -0
- quart_httpauth-0.0.1/.claude/rules/testing.md +136 -0
- quart_httpauth-0.0.1/.claude/rules/workflow.md +54 -0
- quart_httpauth-0.0.1/.claude/settings.json +5 -0
- quart_httpauth-0.0.1/.claude/skills/pr-review-expert/SKILL.md +384 -0
- quart_httpauth-0.0.1/.claude/skills/test-runner/SKILL.md +60 -0
- quart_httpauth-0.0.1/.github/workflows/deep-tests.yml +25 -0
- quart_httpauth-0.0.1/.github/workflows/fast-tests.yml +29 -0
- quart_httpauth-0.0.1/.github/workflows/publish.yml +28 -0
- quart_httpauth-0.0.1/.github/workflows/style.yml +25 -0
- quart_httpauth-0.0.1/.gitignore +223 -0
- quart_httpauth-0.0.1/CHANGES.md +22 -0
- quart_httpauth-0.0.1/LICENSE +21 -0
- quart_httpauth-0.0.1/Makefile +33 -0
- quart_httpauth-0.0.1/PKG-INFO +167 -0
- quart_httpauth-0.0.1/README.md +123 -0
- quart_httpauth-0.0.1/docs/index.rst +125 -0
- quart_httpauth-0.0.1/examples/basic_auth.py +55 -0
- quart_httpauth-0.0.1/examples/multi_auth.py +46 -0
- quart_httpauth-0.0.1/examples/token_auth.py +37 -0
- quart_httpauth-0.0.1/pyproject.toml +117 -0
- quart_httpauth-0.0.1/src/quart_httpauth/__init__.py +643 -0
- quart_httpauth-0.0.1/src/quart_httpauth/py.typed +0 -0
- quart_httpauth-0.0.1/tests/__init__.py +0 -0
- quart_httpauth-0.0.1/tests/conftest.py +10 -0
- quart_httpauth-0.0.1/tests/fakes.py +128 -0
- quart_httpauth-0.0.1/tests/test_http_basic_auth.py +299 -0
- quart_httpauth-0.0.1/tests/test_http_digest_auth.py +187 -0
- quart_httpauth-0.0.1/tests/test_http_token_auth.py +204 -0
- quart_httpauth-0.0.1/tests/test_multi_auth.py +152 -0
- quart_httpauth-0.0.1/uv.lock +2164 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# CI/CD Rules
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Coverage
|
|
6
|
+
|
|
7
|
+
### 1.1 Coverage Reporting
|
|
8
|
+
- Publish coverage reports to Codecov using the GitHub codecov-action.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 2. Pipeline Design
|
|
13
|
+
|
|
14
|
+
### 2.1 Automation
|
|
15
|
+
- Automate all test runs with a CI pipeline.
|
|
16
|
+
|
|
17
|
+
### 2.2 Modular Jobs
|
|
18
|
+
- CI configurations must be modular and split into three jobs:
|
|
19
|
+
- fast tests;
|
|
20
|
+
- deep tests;
|
|
21
|
+
- code style checks.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 3. Local Execution
|
|
26
|
+
|
|
27
|
+
### 3.1 Local Reproducibility
|
|
28
|
+
- All jobs must be executable locally using the act CLI tool:
|
|
29
|
+
https://github.com/nektos/act
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Testing Rules
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Test Design
|
|
6
|
+
|
|
7
|
+
### 1.1 Logic-Free Tests
|
|
8
|
+
- Unit tests must be logic-free: they must not implement any algorithms.
|
|
9
|
+
- Aim for one-statement tests.
|
|
10
|
+
|
|
11
|
+
### 1.2 Assertions
|
|
12
|
+
- Each test must contain exactly one assertion.
|
|
13
|
+
- Each test must contain at least one assertion.
|
|
14
|
+
- The last statement in every test must be an assertion.
|
|
15
|
+
- Do not assert on the absence of failure.
|
|
16
|
+
- Never assert on side effects.
|
|
17
|
+
- Be creative with assertions.
|
|
18
|
+
- Use the PyHamcrest library to achieve this.
|
|
19
|
+
|
|
20
|
+
### 1.3 Test Inputs
|
|
21
|
+
- Whenever possible, tests should use irregular, boundary, or strange inputs to provoke hidden issues.
|
|
22
|
+
- Every test must use its own literals, numbers, and input values.
|
|
23
|
+
- Do not reuse inputs across tests, as this may falsely suggest shared meaning.
|
|
24
|
+
- Always write descriptive failure messages.
|
|
25
|
+
|
|
26
|
+
### 1.4 Test Isolation
|
|
27
|
+
- Test methods must share absolutely no fixtures with other test methods.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2. Naming and Documentation
|
|
32
|
+
|
|
33
|
+
### 2.1 Test Naming
|
|
34
|
+
- Test names must be complete English phrases that would start with "it" if written fully. Example: (it) builds_empty_png_image
|
|
35
|
+
- "it" refers to the object under test, not the test itself.
|
|
36
|
+
|
|
37
|
+
### 2.2 Documentation
|
|
38
|
+
- Tests must not contain documentation comments.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Scope and Boundaries
|
|
43
|
+
|
|
44
|
+
### 3.1 What to Test
|
|
45
|
+
- Never write tests for private or protected methods.
|
|
46
|
+
- Avoid overtesting.
|
|
47
|
+
- Tests must never be the reason for expanding an object's public interface.
|
|
48
|
+
- Avoid testing abstract classes directly.
|
|
49
|
+
|
|
50
|
+
### 3.2 Feature Class Correspondence
|
|
51
|
+
- Each feature class must have exactly one corresponding test module.
|
|
52
|
+
- Feature classes should trust each other and only guard against invalid end-user input.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. Resources and Cleanup
|
|
57
|
+
|
|
58
|
+
### 4.1 System Resources
|
|
59
|
+
- Tests must close all system resources when they finish.
|
|
60
|
+
- Tests that require resources must begin with cleanup.
|
|
61
|
+
|
|
62
|
+
### 4.2 File Handling
|
|
63
|
+
- If a test works with files, it must create its own temporary directory and store all files there.
|
|
64
|
+
- Do not mock the file system.
|
|
65
|
+
- Place all temporary files inside a top-level tmp/ directory in the repository.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 5. Fakes and Logging
|
|
70
|
+
|
|
71
|
+
### 5.1 Fakes Over Mocks
|
|
72
|
+
- Do not use mocks. Use fake implementations instead.
|
|
73
|
+
|
|
74
|
+
### 5.2 Logging
|
|
75
|
+
- Logging should be disabled during tests whenever possible.
|
|
76
|
+
- If logging is part of the specification, test it using fake classes that capture messages instead of printing them.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 6. Test Patterns
|
|
81
|
+
|
|
82
|
+
### 6.1 Parametrized Tests
|
|
83
|
+
- If multiple inputs share the same scenario, use parametrized tests.
|
|
84
|
+
|
|
85
|
+
### 6.2 Thread Safety
|
|
86
|
+
- If a class uses threads or claims thread safety, there must be tests confirming its thread safety.
|
|
87
|
+
|
|
88
|
+
### 6.3 Flaky Tests
|
|
89
|
+
- Use pytest-repeat to run flaky tests multiple times when needed.
|
|
90
|
+
|
|
91
|
+
### 6.4 Online Tests
|
|
92
|
+
- Mark all tests requiring internet access with: pytest.mark.online
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 7. Test-Driven Development
|
|
97
|
+
|
|
98
|
+
### 7.1 Bug Fixes
|
|
99
|
+
- Before fixing a bug, reproduce it with a failing test case.
|
|
100
|
+
|
|
101
|
+
### 7.2 New Features
|
|
102
|
+
- Before adding a new feature, there must be a failing test first.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 8. Test Execution
|
|
107
|
+
|
|
108
|
+
### 8.1 Performance
|
|
109
|
+
- Use pytest-fail-slow to automatically fail tests that run too slowly.
|
|
110
|
+
|
|
111
|
+
### 8.2 Randomization
|
|
112
|
+
- Execute tests in random order and print the randomization seed to the console.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 9. Test Categories
|
|
117
|
+
|
|
118
|
+
### 9.1 Fast Tests (Unit)
|
|
119
|
+
- Minimal execution time.
|
|
120
|
+
|
|
121
|
+
### 9.2 Deep Tests (Integration)
|
|
122
|
+
- Realistic live scenarios.
|
|
123
|
+
- If deep tests require external dependencies (databases, remote services, etc.), use Testcontainers.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 10. Quality Tools
|
|
128
|
+
|
|
129
|
+
### 10.1 Grammar Checking
|
|
130
|
+
- Use language-tool-python to check English grammar in string literals and exception messages.
|
|
131
|
+
|
|
132
|
+
### 10.2 Property-Based Testing
|
|
133
|
+
- Use Python Hypothesis for property-based testing.
|
|
134
|
+
|
|
135
|
+
### 10.3 Mutation Testing
|
|
136
|
+
- Use mutmut for mutation testing.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Agent Workflow Orchestration
|
|
2
|
+
|
|
3
|
+
## 1. Workflow Orchestration
|
|
4
|
+
|
|
5
|
+
### 1.1 General Rules
|
|
6
|
+
- Enter **plan mode** for ANY non-trivial task (3+ steps or architectural decisions)
|
|
7
|
+
- If something goes sideways, STOP and re-plan immediately – don't keep pushing
|
|
8
|
+
- Use plan mode for verification steps, not just building
|
|
9
|
+
- Write detailed specs upfront to reduce ambiguity
|
|
10
|
+
- Never mark a task complete without proving it works
|
|
11
|
+
|
|
12
|
+
### 1.2 Subagent Strategy
|
|
13
|
+
- Use subagents liberally to keep main context window clean
|
|
14
|
+
- Offload research, exploration, and parallel analysis to subagents
|
|
15
|
+
- For complex problems, throw more compute at it via subagents
|
|
16
|
+
- One tack per subagent for focused execution
|
|
17
|
+
|
|
18
|
+
### 1.3 Self-Improvement Loop
|
|
19
|
+
- After ANY correction from the user: update `./specs/lessons.md` with the pattern
|
|
20
|
+
- Write rules for yourself that prevent the same mistake
|
|
21
|
+
- Ruthlessly iterate on these lessons until mistake rate drops
|
|
22
|
+
- Review lessons at session start for relevant project
|
|
23
|
+
|
|
24
|
+
### 1.4 Verification Before Done
|
|
25
|
+
- Never mark a task complete without proving it works
|
|
26
|
+
- Diff behavior between main and your changes when relevant
|
|
27
|
+
- Ask yourself: "Would a staff engineer approve this?"
|
|
28
|
+
- Run tests, check logs, demonstrate correctness
|
|
29
|
+
|
|
30
|
+
### 1.5 Demand Elegance (Balanced)
|
|
31
|
+
- For non-trivial changes: pause and ask "is there a more elegant way?"
|
|
32
|
+
- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
|
|
33
|
+
- Skip this for simple, obvious fixes – don't over-engineer
|
|
34
|
+
- Challenge your own work before presenting it
|
|
35
|
+
|
|
36
|
+
### 1.6 Autonomous Bug Fixing
|
|
37
|
+
- When given a bug report: just fix it. Don't ask for hand-holding
|
|
38
|
+
- Point at logs, errors, failing tests – then resolve them
|
|
39
|
+
- Zero context switching required from the user
|
|
40
|
+
- Go fix failing CI tests without being told how
|
|
41
|
+
|
|
42
|
+
## 2. Task Management
|
|
43
|
+
|
|
44
|
+
1. **Plan First**: Write plan to `./specs/todo.md` with checkable items
|
|
45
|
+
2. **Verify Plan**: Check in before starting implementation
|
|
46
|
+
3. **Track Progress**: Mark items complete as you go
|
|
47
|
+
4. **Explain Changes**: High-level summary at each step
|
|
48
|
+
5. **Document Results**: Add review section to `./specs/todo.md`
|
|
49
|
+
|
|
50
|
+
## 3. Core Principles
|
|
51
|
+
|
|
52
|
+
- **Simplicity First**: Make every change as simple as possible. Impact minimal code.
|
|
53
|
+
- **No Laziness**: Find root causes. No temporary fixes. Senior developer standards.
|
|
54
|
+
- **Minimal Impact**: Changes should only touch what's necessary. Avoid introducing bugs.
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "pr-review-expert"
|
|
3
|
+
description: "Use when the user asks to review pull requests, analyze code changes, check for security issues in PRs, or assess code quality of diffs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Review Expert
|
|
7
|
+
|
|
8
|
+
**Tier:** POWERFUL
|
|
9
|
+
**Category:** Engineering
|
|
10
|
+
**Domain:** Code Review / Quality Assurance
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Structured, systematic code review for GitHub PRs and GitLab MRs. Goes beyond style nits — this skill
|
|
17
|
+
performs blast radius analysis, security scanning, breaking change detection, and test coverage delta
|
|
18
|
+
calculation. Produces a reviewer-ready report with a 30+ item checklist and prioritized findings.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Core Capabilities
|
|
23
|
+
|
|
24
|
+
- **Blast radius analysis** — trace which files, services, and downstream consumers could break
|
|
25
|
+
- **Security scan** — SQL injection, XSS, auth bypass, secret exposure, dependency vulns
|
|
26
|
+
- **Test coverage delta** — new code vs new tests ratio
|
|
27
|
+
- **Breaking change detection** — API contracts, DB schema migrations, config keys
|
|
28
|
+
- **Ticket linking** — verify Jira/Linear ticket exists and matches scope
|
|
29
|
+
- **Performance impact** — N+1 queries, bundle size regression, memory allocations
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## When to Use
|
|
34
|
+
|
|
35
|
+
- Before merging any PR/MR that touches shared libraries, APIs, or DB schema
|
|
36
|
+
- When a PR is large (>200 lines changed) and needs structured review
|
|
37
|
+
- Onboarding new contributors whose PRs need thorough feedback
|
|
38
|
+
- Security-sensitive code paths (auth, payments, PII handling)
|
|
39
|
+
- After an incident — review similar PRs proactively
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Fetching the Diff
|
|
44
|
+
|
|
45
|
+
### GitHub (gh CLI)
|
|
46
|
+
```bash
|
|
47
|
+
# View diff in terminal
|
|
48
|
+
gh pr diff <PR_NUMBER>
|
|
49
|
+
|
|
50
|
+
# Get PR metadata (title, body, labels, linked issues)
|
|
51
|
+
gh pr view <PR_NUMBER> --json title,body,labels,assignees,milestone
|
|
52
|
+
|
|
53
|
+
# List files changed
|
|
54
|
+
gh pr diff <PR_NUMBER> --name-only
|
|
55
|
+
|
|
56
|
+
# Check CI status
|
|
57
|
+
gh pr checks <PR_NUMBER>
|
|
58
|
+
|
|
59
|
+
# Download diff to file for analysis
|
|
60
|
+
gh pr diff <PR_NUMBER> > /tmp/pr-<PR_NUMBER>.diff
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### GitLab (glab CLI)
|
|
64
|
+
```bash
|
|
65
|
+
# View MR diff
|
|
66
|
+
glab mr diff <MR_IID>
|
|
67
|
+
|
|
68
|
+
# MR details as JSON
|
|
69
|
+
glab mr view <MR_IID> --output json
|
|
70
|
+
|
|
71
|
+
# List changed files
|
|
72
|
+
glab mr diff <MR_IID> --name-only
|
|
73
|
+
|
|
74
|
+
# Download diff
|
|
75
|
+
glab mr diff <MR_IID> > /tmp/mr-<MR_IID>.diff
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Workflow
|
|
81
|
+
|
|
82
|
+
### Step 1 — Fetch Context
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
PR=123
|
|
86
|
+
gh pr view $PR --json title,body,labels,milestone,assignees | jq .
|
|
87
|
+
gh pr diff $PR --name-only
|
|
88
|
+
gh pr diff $PR > /tmp/pr-$PR.diff
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Step 2 — Blast Radius Analysis
|
|
92
|
+
|
|
93
|
+
For each changed file, identify:
|
|
94
|
+
|
|
95
|
+
1. **Direct dependents** — who imports this file?
|
|
96
|
+
```bash
|
|
97
|
+
# Find all files importing a changed module
|
|
98
|
+
grep -r "from ['\"].*changed-module['\"]" src/ --include="*.ts" -l
|
|
99
|
+
grep -r "require(['\"].*changed-module" src/ --include="*.js" -l
|
|
100
|
+
|
|
101
|
+
# Python
|
|
102
|
+
grep -r "from changed_module import\|import changed_module" . --include="*.py" -l
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. **Service boundaries** — does this change cross a service?
|
|
106
|
+
```bash
|
|
107
|
+
# Check if changed files span multiple services (monorepo)
|
|
108
|
+
gh pr diff $PR --name-only | cut -d/ -f1-2 | sort -u
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
3. **Shared contracts** — types, interfaces, schemas
|
|
112
|
+
```bash
|
|
113
|
+
gh pr diff $PR --name-only | grep -E "types/|interfaces/|schemas/|models/"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Blast radius severity:**
|
|
117
|
+
- CRITICAL — shared library, DB model, auth middleware, API contract
|
|
118
|
+
- HIGH — service used by >3 others, shared config, env vars
|
|
119
|
+
- MEDIUM — single service internal change, utility function
|
|
120
|
+
- LOW — UI component, test file, docs
|
|
121
|
+
|
|
122
|
+
### Step 3 — Security Scan
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
DIFF=/tmp/pr-$PR.diff
|
|
126
|
+
|
|
127
|
+
# SQL Injection — raw query string interpolation
|
|
128
|
+
grep -n "query\|execute\|raw(" $DIFF | grep -E '\$\{|f"|%s|format\('
|
|
129
|
+
|
|
130
|
+
# Hardcoded secrets
|
|
131
|
+
grep -nE "(password|secret|api_key|token|private_key)\s*=\s*['\"][^'\"]{8,}" $DIFF
|
|
132
|
+
|
|
133
|
+
# AWS key pattern
|
|
134
|
+
grep -nE "AKIA[0-9A-Z]{16}" $DIFF
|
|
135
|
+
|
|
136
|
+
# JWT secret in code
|
|
137
|
+
grep -nE "jwt\.sign\(.*['\"][^'\"]{20,}['\"]" $DIFF
|
|
138
|
+
|
|
139
|
+
# XSS vectors
|
|
140
|
+
grep -n "dangerouslySetInnerHTML\|innerHTML\s*=" $DIFF
|
|
141
|
+
|
|
142
|
+
# Auth bypass patterns
|
|
143
|
+
grep -n "bypass\|skip.*auth\|noauth\|TODO.*auth" $DIFF
|
|
144
|
+
|
|
145
|
+
# Insecure hash algorithms
|
|
146
|
+
grep -nE "md5\(|sha1\(|createHash\(['\"]md5|createHash\(['\"]sha1" $DIFF
|
|
147
|
+
|
|
148
|
+
# eval / exec
|
|
149
|
+
grep -nE "\beval\(|\bexec\(|\bsubprocess\.call\(" $DIFF
|
|
150
|
+
|
|
151
|
+
# Prototype pollution
|
|
152
|
+
grep -n "__proto__\|constructor\[" $DIFF
|
|
153
|
+
|
|
154
|
+
# Path traversal risk
|
|
155
|
+
grep -nE "path\.join\(.*req\.|readFile\(.*req\." $DIFF
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Step 4 — Test Coverage Delta
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Count source vs test files changed
|
|
162
|
+
CHANGED_SRC=$(gh pr diff $PR --name-only | grep -vE "\.test\.|\.spec\.|__tests__")
|
|
163
|
+
CHANGED_TESTS=$(gh pr diff $PR --name-only | grep -E "\.test\.|\.spec\.|__tests__")
|
|
164
|
+
|
|
165
|
+
echo "Source files changed: $(echo "$CHANGED_SRC" | wc -w)"
|
|
166
|
+
echo "Test files changed: $(echo "$CHANGED_TESTS" | wc -w)"
|
|
167
|
+
|
|
168
|
+
# Lines of new logic vs new test lines
|
|
169
|
+
LOGIC_LINES=$(grep "^+" /tmp/pr-$PR.diff | grep -v "^+++" | wc -l)
|
|
170
|
+
echo "New lines added: $LOGIC_LINES"
|
|
171
|
+
|
|
172
|
+
# Run coverage locally
|
|
173
|
+
npm test -- --coverage --changedSince=main 2>/dev/null | tail -20
|
|
174
|
+
pytest --cov --cov-report=term-missing 2>/dev/null | tail -20
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Coverage delta rules:**
|
|
178
|
+
- New function without tests → flag
|
|
179
|
+
- Deleted tests without deleted code → flag
|
|
180
|
+
- Coverage drop >5% → block merge
|
|
181
|
+
- Auth/payments paths → require 100% coverage
|
|
182
|
+
|
|
183
|
+
### Step 5 — Breaking Change Detection
|
|
184
|
+
|
|
185
|
+
#### API Contract Changes
|
|
186
|
+
```bash
|
|
187
|
+
# OpenAPI/Swagger spec changes
|
|
188
|
+
grep -n "openapi\|swagger" /tmp/pr-$PR.diff | head -20
|
|
189
|
+
|
|
190
|
+
# REST route removals or renames
|
|
191
|
+
grep "^-" /tmp/pr-$PR.diff | grep -E "router\.(get|post|put|delete|patch)\("
|
|
192
|
+
|
|
193
|
+
# GraphQL schema removals
|
|
194
|
+
grep "^-" /tmp/pr-$PR.diff | grep -E "^-\s*(type |field |Query |Mutation )"
|
|
195
|
+
|
|
196
|
+
# TypeScript interface removals
|
|
197
|
+
grep "^-" /tmp/pr-$PR.diff | grep -E "^-\s*(export\s+)?(interface|type) "
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### DB Schema Changes
|
|
201
|
+
```bash
|
|
202
|
+
# Migration files added
|
|
203
|
+
gh pr diff $PR --name-only | grep -E "migrations?/|alembic/|knex/"
|
|
204
|
+
|
|
205
|
+
# Destructive operations
|
|
206
|
+
grep -E "DROP TABLE|DROP COLUMN|ALTER.*NOT NULL|TRUNCATE" /tmp/pr-$PR.diff
|
|
207
|
+
|
|
208
|
+
# Index removals (perf regression risk)
|
|
209
|
+
grep "DROP INDEX\|remove_index" /tmp/pr-$PR.diff
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Config / Env Var Changes
|
|
213
|
+
```bash
|
|
214
|
+
# New env vars referenced in code (might be missing in prod)
|
|
215
|
+
grep "^+" /tmp/pr-$PR.diff | grep -oE "process\.env\.[A-Z_]+" | sort -u
|
|
216
|
+
|
|
217
|
+
# Removed env vars (could break running instances)
|
|
218
|
+
grep "^-" /tmp/pr-$PR.diff | grep -oE "process\.env\.[A-Z_]+" | sort -u
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Step 6 — Performance Impact
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# N+1 query patterns (DB calls inside loops)
|
|
225
|
+
grep -n "\.find\|\.findOne\|\.query\|db\." /tmp/pr-$PR.diff | grep "^+" | head -20
|
|
226
|
+
# Then check surrounding context for forEach/map/for loops
|
|
227
|
+
|
|
228
|
+
# Heavy new dependencies
|
|
229
|
+
grep "^+" /tmp/pr-$PR.diff | grep -E '"[a-z@].*":\s*"[0-9^~]' | head -20
|
|
230
|
+
|
|
231
|
+
# Unbounded loops
|
|
232
|
+
grep -n "while (true\|while(true" /tmp/pr-$PR.diff | grep "^+"
|
|
233
|
+
|
|
234
|
+
# Missing await (accidentally sequential promises)
|
|
235
|
+
grep -n "await.*await" /tmp/pr-$PR.diff | grep "^+" | head -10
|
|
236
|
+
|
|
237
|
+
# Large in-memory allocations
|
|
238
|
+
grep -n "new Array([0-9]\{4,\}\|Buffer\.alloc" /tmp/pr-$PR.diff | grep "^+"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Ticket Linking Verification
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Extract ticket references from PR body
|
|
247
|
+
gh pr view $PR --json body | jq -r '.body' | \
|
|
248
|
+
grep -oE "(PROJ-[0-9]+|[A-Z]+-[0-9]+|https://linear\.app/[^)\"]+)" | sort -u
|
|
249
|
+
|
|
250
|
+
# Verify Jira ticket exists (requires JIRA_API_TOKEN)
|
|
251
|
+
TICKET="PROJ-123"
|
|
252
|
+
curl -s -u "user@company.com:$JIRA_API_TOKEN" \
|
|
253
|
+
"https://your-org.atlassian.net/rest/api/3/issue/$TICKET" | \
|
|
254
|
+
jq '{key, summary: .fields.summary, status: .fields.status.name}'
|
|
255
|
+
|
|
256
|
+
# Linear ticket
|
|
257
|
+
LINEAR_ID="abc-123"
|
|
258
|
+
curl -s -H "Authorization: $LINEAR_API_KEY" \
|
|
259
|
+
-H "Content-Type: application/json" \
|
|
260
|
+
--data "{\"query\": \"{ issue(id: \\\"$LINEAR_ID\\\") { title state { name } } }\"}" \
|
|
261
|
+
https://api.linear.app/graphql | jq .
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Complete Review Checklist (30+ Items)
|
|
267
|
+
|
|
268
|
+
```markdown
|
|
269
|
+
## Code Review Checklist
|
|
270
|
+
|
|
271
|
+
### Scope & Context
|
|
272
|
+
- [ ] PR title accurately describes the change
|
|
273
|
+
- [ ] PR description explains WHY, not just WHAT
|
|
274
|
+
- [ ] Linked Jira/Linear ticket exists and matches scope
|
|
275
|
+
- [ ] No unrelated changes (scope creep)
|
|
276
|
+
- [ ] Breaking changes documented in PR body
|
|
277
|
+
|
|
278
|
+
### Blast Radius
|
|
279
|
+
- [ ] Identified all files importing changed modules
|
|
280
|
+
- [ ] Cross-service dependencies checked
|
|
281
|
+
- [ ] Shared types/interfaces/schemas reviewed for breakage
|
|
282
|
+
- [ ] New env vars documented in .env.example
|
|
283
|
+
- [ ] DB migrations are reversible (have down() / rollback)
|
|
284
|
+
|
|
285
|
+
### Security
|
|
286
|
+
- [ ] No hardcoded secrets or API keys
|
|
287
|
+
- [ ] SQL queries use parameterized inputs (no string interpolation)
|
|
288
|
+
- [ ] User inputs validated/sanitized before use
|
|
289
|
+
- [ ] Auth/authorization checks on all new endpoints
|
|
290
|
+
- [ ] No XSS vectors (innerHTML, dangerouslySetInnerHTML)
|
|
291
|
+
- [ ] New dependencies checked for known CVEs
|
|
292
|
+
- [ ] No sensitive data in logs (PII, tokens, passwords)
|
|
293
|
+
- [ ] File uploads validated (type, size, content-type)
|
|
294
|
+
- [ ] CORS configured correctly for new endpoints
|
|
295
|
+
|
|
296
|
+
### Testing
|
|
297
|
+
- [ ] New public functions have unit tests
|
|
298
|
+
- [ ] Edge cases covered (empty, null, max values)
|
|
299
|
+
- [ ] Error paths tested (not just happy path)
|
|
300
|
+
- [ ] Integration tests for API endpoint changes
|
|
301
|
+
- [ ] No tests deleted without clear reason
|
|
302
|
+
- [ ] Test names clearly describe what they verify
|
|
303
|
+
|
|
304
|
+
### Breaking Changes
|
|
305
|
+
- [ ] No API endpoints removed without deprecation notice
|
|
306
|
+
- [ ] No required fields added to existing API responses
|
|
307
|
+
- [ ] No DB columns removed without two-phase migration plan
|
|
308
|
+
- [ ] No env vars removed that may be set in production
|
|
309
|
+
- [ ] Backward-compatible for external API consumers
|
|
310
|
+
|
|
311
|
+
### Performance
|
|
312
|
+
- [ ] No N+1 query patterns introduced
|
|
313
|
+
- [ ] DB indexes added for new query patterns
|
|
314
|
+
- [ ] No unbounded loops on potentially large datasets
|
|
315
|
+
- [ ] No heavy new dependencies without justification
|
|
316
|
+
- [ ] Async operations correctly awaited
|
|
317
|
+
- [ ] Caching considered for expensive repeated operations
|
|
318
|
+
|
|
319
|
+
### Code Quality
|
|
320
|
+
- [ ] No dead code or unused imports
|
|
321
|
+
- [ ] Error handling present (no bare empty catch blocks)
|
|
322
|
+
- [ ] Consistent with existing patterns and conventions
|
|
323
|
+
- [ ] Complex logic has explanatory comments
|
|
324
|
+
- [ ] No unresolved TODOs (or tracked in ticket)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Output Format
|
|
330
|
+
|
|
331
|
+
Structure your review comment as:
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
## PR Review: [PR Title] (#NUMBER)
|
|
335
|
+
|
|
336
|
+
Blast Radius: HIGH — changes lib/auth used by 5 services
|
|
337
|
+
Security: 1 finding (medium severity)
|
|
338
|
+
Tests: Coverage delta +2%
|
|
339
|
+
Breaking Changes: None detected
|
|
340
|
+
|
|
341
|
+
--- MUST FIX (Blocking) ---
|
|
342
|
+
|
|
343
|
+
1. SQL Injection risk in src/db/users.ts:42
|
|
344
|
+
Raw string interpolation in WHERE clause.
|
|
345
|
+
Fix: db.query("SELECT * WHERE id = $1", [userId])
|
|
346
|
+
|
|
347
|
+
--- SHOULD FIX (Non-blocking) ---
|
|
348
|
+
|
|
349
|
+
2. Missing auth check on POST /api/admin/reset
|
|
350
|
+
No role verification before destructive operation.
|
|
351
|
+
|
|
352
|
+
--- SUGGESTIONS ---
|
|
353
|
+
|
|
354
|
+
3. N+1 pattern in src/services/reports.ts:88
|
|
355
|
+
findUser() called inside results.map() — batch with findManyUsers(ids)
|
|
356
|
+
|
|
357
|
+
--- LOOKS GOOD ---
|
|
358
|
+
- Test coverage for new auth flow is thorough
|
|
359
|
+
- DB migration has proper down() rollback method
|
|
360
|
+
- Error handling consistent with rest of codebase
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Common Pitfalls
|
|
366
|
+
|
|
367
|
+
- **Reviewing style over substance** — let the linter handle style; focus on logic, security, correctness
|
|
368
|
+
- **Missing blast radius** — a 5-line change in a shared utility can break 20 services
|
|
369
|
+
- **Approving untested happy paths** — always verify error paths have coverage
|
|
370
|
+
- **Ignoring migration risk** — NOT NULL additions need a default or two-phase migration
|
|
371
|
+
- **Indirect secret exposure** — secrets in error messages/logs, not just hardcoded values
|
|
372
|
+
- **Skipping large PRs** — if a PR is too large to review properly, request it be split
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Best Practices
|
|
377
|
+
|
|
378
|
+
1. Read the linked ticket before looking at code — context prevents false positives
|
|
379
|
+
2. Check CI status before reviewing — don't review code that fails to build
|
|
380
|
+
3. Prioritize blast radius and security over style
|
|
381
|
+
4. Reproduce locally for non-trivial auth or performance changes
|
|
382
|
+
5. Label each comment clearly: "nit:", "must:", "question:", "suggestion:"
|
|
383
|
+
6. Batch all comments in one review round — don't trickle feedback
|
|
384
|
+
7. Acknowledge good patterns, not just problems — specific praise improves culture
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "test-runner"
|
|
3
|
+
description: "Use this skill when application code has been modified (*.py)"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Runner
|
|
7
|
+
|
|
8
|
+
**Tier:** POWERFUL
|
|
9
|
+
**Category:** Testing
|
|
10
|
+
**Domain:** Unit Testing / Quality Assurance
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
This skill provides steps on how to run tests and linters after application code has been changed.
|
|
17
|
+
It shows how unit tests run process is organized in project and how properly work with test results.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## When to use
|
|
22
|
+
|
|
23
|
+
- New application code has been introduced (*.py)
|
|
24
|
+
- Application code has been changed (*.py)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## How to run tests
|
|
29
|
+
|
|
30
|
+
To run unit tests:
|
|
31
|
+
```bash
|
|
32
|
+
make unit
|
|
33
|
+
```
|
|
34
|
+
To run e2e tests:
|
|
35
|
+
```bash
|
|
36
|
+
make e2e
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## How to run linters:
|
|
40
|
+
|
|
41
|
+
To run black:
|
|
42
|
+
```bash
|
|
43
|
+
make black
|
|
44
|
+
```
|
|
45
|
+
To run flake8:
|
|
46
|
+
```bash
|
|
47
|
+
make flake8
|
|
48
|
+
```
|
|
49
|
+
To run ruff:
|
|
50
|
+
```bash
|
|
51
|
+
make ruff
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Important rules
|
|
57
|
+
|
|
58
|
+
- Test coverage should be >= 90.
|
|
59
|
+
- If test coverage is not enough, you should write additional tests to achieve desired state.
|
|
60
|
+
- If linters fail and provide changes to implement, then those changes should be implemented.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Deep tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
deep-tests:
|
|
11
|
+
name: Deep tests (integration)
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: make install
|
|
23
|
+
|
|
24
|
+
- name: Run deep tests
|
|
25
|
+
run: make test-deep
|