feat: add user_id index to profiles table for faster lookups

The profiles table previously lacked an index on the user_id column, causing full table scans during user lookups. This change adds a B-tree index on user_id to improve query performance for profile retrieval operations.
This commit is contained in:
2026-06-12 04:30:08 +00:00
parent bb82b7c6e6
commit 9a8ed464d7
38 changed files with 679 additions and 86 deletions
+27 -4
View File
@@ -113,11 +113,33 @@ async def report_finding(
return json.dumps({"status": "success", "recorded": True, "total_findings": len(_FINDINGS)})
WORKER_READ_TOOLS = (
"read_file",
"read_lines",
"list_dir",
"glob_files",
"grep",
"find_symbol",
"retrieve",
)
WORKER_REASONING_TOOLS = (
"plan",
"reflect",
"delegate",
"report_finding",
"get_current_isodate",
)
def worker_tool_names(mode: str) -> tuple[str, ...]:
names = WORKER_READ_TOOLS + WORKER_REASONING_TOOLS
if mode != "check":
names = names + WRITE_TOOLS + ("verify",)
return names
def payloads_for(mode: str) -> list[dict[str, Any]]:
exclude = WEB_TOOLS + SWARM_TOOLS + ("run_command",)
if mode == "check":
exclude = exclude + WRITE_TOOLS + ("verify",)
return get_tool_payloads(exclude=exclude)
return payloads_named(worker_tool_names(mode))
def payloads_named(names: tuple[str, ...]) -> list[dict[str, Any]]:
@@ -240,6 +262,7 @@ __all__ = [
"findings",
"payloads_for",
"payloads_named",
"worker_tool_names",
"summarize",
"write_reports",
"report_codename",