/safina:load
Generate a k6 load test script tailored to what you want to test, run it locally, parse the results, and attach the report to your ticket — including a PDF summary via Chrome headless.
When to run it
- Before marking a ticket QA-ready if the feature touches a high-traffic path
- When performance is a stated acceptance criterion
- Before a release that includes backend changes at scale
- When New Relic shows degraded p95 after a deploy and you need to reproduce under load
Safety rules
Load tests are restricted to staging environments. The command enforces this — if the target domain does not contain staging, it stops.
VU limits
| Virtual users | What happens |
|---|---|
| ≤ 50 | Default. Proceeds immediately. |
| 51 – 250 | Large. Proceeds with confirmation. |
| 251 – 499 | Warning issued. Explicit “yes” required before running. |
| 500 – 999 | Strong warning + mitigation checklist. Explicit confirmation required. |
| ≥ 1000 | Hard block. Not permitted through this command. |
The default is 50 VUs — enough to surface real bottlenecks without hammering staging.
What the command does
- Asks what domain, flow, and VU count to test
- Validates the domain is a staging environment
- Reads the existing k6 scripts in
k6/scripts/as structural patterns - Generates a new k6 script tailored to your specific test — not a health-check ping
- Runs it via
k6 run --summary-export=/tmp/ilmiya-load-summary.json - Parses the JSON output into a structured report
- Generates a PDF via Chrome headless
- Attaches the report to your active ticket (Linear or GitHub)
Script generation
The command writes a full k6 script based on your description — authentication flows, CRUD operations, multi-step user journeys, specific endpoints. The patterns come from the Ilmiya k6 library in k6/scripts/, but the script is generated fresh for your test scenario.
If auth is required, the script accepts credentials via environment variables (AUTH_TOKEN, BASE_URL) — credentials are never hardcoded in the script.
Report format
## /safina:load Report — YYYY-MM-DD HH:MM
Target: [domain]
Test: [what was tested]
VUs: [peak VUs]
Duration: [total test time]
Thresholds: [PASS / FAIL]
### Results
| Metric | Value | Threshold | Status |
|--------|-------|-----------|--------|
| Total requests | N | — | — |
| Request rate | N req/s | — | — |
| p50 latency | ms | — | — |
| p95 latency | ms | < 1000ms | pass / FAIL |
| p99 latency | ms | — | — |
| Error rate | % | < 1% | pass / FAIL |
| Check pass rate | % | — | — |
### Assessment
[What the numbers mean. Whether the service held up.]
### Recommendation
[What to do next: fix, re-test, scale, or ship.]
The PDF version of this report is attached to your ticket. If Chrome is not available, the command attaches the markdown report instead.
k6 scripts library
The k6/scripts/ directory contains reference scripts for every Ilmiya service. These are used as structural patterns when generating new tests — not run directly.
| Script | Service |
|---|---|
accounts.js | Accounts service |
admin.js | Admin portal |
ai.js | AI service |
aide.js | Aide |
analytics.js | Analytics |
campus.js | Campus |
canvas.js | Canvas |
console.js | Console |
content.js | Content |
edify.js | Edify |
iam.js | IAM |
ilm.js | ILM core |
insights.js | Insights |
iqra.js | Iqra |
login.js | Login flow |
models.js | Models |
omni.js | Omni |
people.js | People |
portal.js | Portal |
studio.js | Studio |
users.js | Users |
Load profiles are defined in k6/common/config.js: smoke (5 VUs), default (50 VUs), large (250 VUs).
Prerequisites
- k6 installed locally —
brew install k6if missing. The command checks before running. - Staging access — the test target must be a staging domain
- Active ticket — the report is attached to your ticket from
/safina:backlogcontext
Severity guide for results
| Threshold | Meaning | Action |
|---|---|---|
| p95 > 1000ms or error rate > 1% | Service under load — not ready to ship | Fix, re-test |
| p95 800-1000ms | Degraded under load | Investigate before shipping |
| p95 < 800ms, error rate < 0.1% | Healthy | Proceed |
Threshold failures block the QA-ready flag in /safina:update.