forked from retoor/devplacepy
chore: replace python -m agents.validator with hawk in all agent mode instructions
This commit is contained in:
@@ -26,6 +26,7 @@ GIST_UIDS = []
|
||||
BUG_UIDS = []
|
||||
BUG_JOB_UIDS = []
|
||||
NOTIFICATION_UIDS = []
|
||||
SEO_JOB_UIDS = []
|
||||
POLLS = []
|
||||
ADMIN_USER = {}
|
||||
ADMIN_TARGETS = {}
|
||||
@@ -52,6 +53,13 @@ PASSWORD = "testpass123"
|
||||
# - drive the host docker daemon.
|
||||
# /bugs/{number}, /bugs/{number}/comment, /bugs/{number}/status
|
||||
# - live external Gitea REST calls.
|
||||
# /tools/seo/run - launches a real Playwright crawl of
|
||||
# an external URL, per-owner rate-capped
|
||||
# (one active job) and resource-heavy;
|
||||
# enqueuing real audit jobs is unsafe to
|
||||
# load test. The read surface (page +
|
||||
# status/report lookups) IS covered below.
|
||||
# /tools/seo/{uid}/ws - WebSocket; HttpUser cannot drive it.
|
||||
# /admin/ai-quota/reset-guests|reset-all - global destructive quota wipe.
|
||||
# /admin/services/{name}/run|start|stop|config|clear-logs
|
||||
# - toggles real background services
|
||||
@@ -322,6 +330,21 @@ def seed_data(environment, **kwargs):
|
||||
except Exception as e:
|
||||
logger.warning(f"Seed news articles failed: {e}")
|
||||
|
||||
# ── Harvest existing SEO audit job uids (never enqueue) ─────
|
||||
# The heavy POST /tools/seo/run is deliberately excluded (real
|
||||
# Playwright crawl, rate-capped), so we never create jobs here.
|
||||
# We only pick up any pre-existing seo job rows so the status/report
|
||||
# read tasks can hit a live uid when one happens to exist.
|
||||
try:
|
||||
from devplacepy.services.jobs import queue
|
||||
|
||||
for job in queue.list_jobs(kind="seo")[:10]:
|
||||
uid = job.get("uid")
|
||||
if uid and uid not in SEO_JOB_UIDS:
|
||||
SEO_JOB_UIDS.append(uid)
|
||||
except Exception as e:
|
||||
logger.warning(f"Harvest SEO job uids failed: {e}")
|
||||
|
||||
# ── Seed an admin user (direct DB insert) ───────────────────
|
||||
try:
|
||||
from datetime import datetime, timezone
|
||||
@@ -575,6 +598,31 @@ class DevPlaceUser(HttpUser):
|
||||
def view_seo(self):
|
||||
self.client.get(random.choice(["/robots.txt", "/sitemap.xml"]), name="seo")
|
||||
|
||||
@task(2)
|
||||
def view_seo_diagnostics(self):
|
||||
self.client.get("/tools", name="tools")
|
||||
self.client.get("/tools/seo", name="tools/seo")
|
||||
|
||||
@task(1)
|
||||
def view_seo_audit_status(self):
|
||||
uid = random.choice(SEO_JOB_UIDS) if SEO_JOB_UIDS else str(uuid.uuid4())
|
||||
with self.client.get(
|
||||
f"/tools/seo/{uid}", catch_response=True, name="tools/seo/[uid]"
|
||||
) as resp:
|
||||
if resp.status_code in (200, 404):
|
||||
resp.success()
|
||||
else:
|
||||
resp.failure(f"seo status: status={resp.status_code}")
|
||||
with self.client.get(
|
||||
f"/tools/seo/{uid}/report",
|
||||
catch_response=True,
|
||||
name="tools/seo/[uid]/report",
|
||||
) as report:
|
||||
if report.status_code in (200, 404):
|
||||
report.success()
|
||||
else:
|
||||
report.failure(f"seo report: status={report.status_code}")
|
||||
|
||||
@task(1)
|
||||
def view_static(self):
|
||||
self.client.get("/static/css/base.css", name="static")
|
||||
|
||||
Reference in New Issue
Block a user