Safina

/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 usersWhat happens
≤ 50Default. Proceeds immediately.
51 – 250Large. Proceeds with confirmation.
251 – 499Warning issued. Explicit “yes” required before running.
500 – 999Strong warning + mitigation checklist. Explicit confirmation required.
≥ 1000Hard block. Not permitted through this command.

The default is 50 VUs — enough to surface real bottlenecks without hammering staging.


What the command does

  1. Asks what domain, flow, and VU count to test
  2. Validates the domain is a staging environment
  3. Reads the existing k6 scripts in k6/scripts/ as structural patterns
  4. Generates a new k6 script tailored to your specific test — not a health-check ping
  5. Runs it via k6 run --summary-export=/tmp/ilmiya-load-summary.json
  6. Parses the JSON output into a structured report
  7. Generates a PDF via Chrome headless
  8. 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.

ScriptService
accounts.jsAccounts service
admin.jsAdmin portal
ai.jsAI service
aide.jsAide
analytics.jsAnalytics
campus.jsCampus
canvas.jsCanvas
console.jsConsole
content.jsContent
edify.jsEdify
iam.jsIAM
ilm.jsILM core
insights.jsInsights
iqra.jsIqra
login.jsLogin flow
models.jsModels
omni.jsOmni
people.jsPeople
portal.jsPortal
studio.jsStudio
users.jsUsers

Load profiles are defined in k6/common/config.js: smoke (5 VUs), default (50 VUs), large (250 VUs).


Prerequisites

  • k6 installed locallybrew install k6 if 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:backlog context

Severity guide for results

ThresholdMeaningAction
p95 > 1000ms or error rate > 1%Service under load — not ready to shipFix, re-test
p95 800-1000msDegraded under loadInvestigate before shipping
p95 < 800ms, error rate < 0.1%HealthyProceed

Threshold failures block the QA-ready flag in /safina:update.