- infra: Bugsink 2.6.3 in docker (infra/bugsink, scripts/bugsink-up.sh), database bugsink in Peppa's Postgres, Traefik route bugsink.telecom.quest - packages/bugsink: REST API client + custom-webhook payload parsing - incidents (migration 0011): incident_settings, error_sources, incidents; ingest from webhook POST /api/hooks/bugsink/<secret> and a 2-minute poll in the watchdog - incident policy per project: notify / backlog (default) / start / ask (Telegram buttons) / triage (claude -p with the owner's token, falls back to ask) - daily task cap, environments, ignore pattern; manual "fixed" until PEP-57; REGRESSED returns the task to the backlog - web «Ошибки» section, bot buttons, MCP tools for agents and the PM, help, RULES.md - testkit: mock-bugsink, mock-triage, incidents.test.ts (one test per scenario, plus a live run against the real Bugsink with PEPPA_LIVE_BUGSINK=1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
3.0 KiB
SQL
62 lines
3.0 KiB
SQL
CREATE TABLE "error_sources" (
|
|
"id" serial PRIMARY KEY NOT NULL,
|
|
"project_id" integer NOT NULL,
|
|
"kind" text NOT NULL,
|
|
"bugsink_project_id" integer NOT NULL,
|
|
"dsn" text NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "error_sources_bugsink_project_id_unique" UNIQUE("bugsink_project_id")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "incident_settings" (
|
|
"project_id" integer PRIMARY KEY NOT NULL,
|
|
"hook_secret" text NOT NULL,
|
|
"policy" text DEFAULT 'backlog' NOT NULL,
|
|
"triage_prompt" text,
|
|
"environments" jsonb DEFAULT '["prod","production"]'::jsonb NOT NULL,
|
|
"daily_limit" integer DEFAULT 5 NOT NULL,
|
|
"ignore_pattern" text,
|
|
"goal_id" integer,
|
|
"webhook_auto" boolean DEFAULT false NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "incident_settings_hook_secret_unique" UNIQUE("hook_secret")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "incidents" (
|
|
"id" serial PRIMARY KEY NOT NULL,
|
|
"project_id" integer NOT NULL,
|
|
"source" text NOT NULL,
|
|
"bugsink_issue_id" text NOT NULL,
|
|
"friendly_id" text,
|
|
"title" text NOT NULL,
|
|
"culprit" text,
|
|
"level" text,
|
|
"environment" text,
|
|
"first_release" text,
|
|
"last_release" text,
|
|
"events" integer DEFAULT 1 NOT NULL,
|
|
"first_seen" timestamp with time zone NOT NULL,
|
|
"last_seen" timestamp with time zone NOT NULL,
|
|
"url" text,
|
|
"stack" text,
|
|
"status" text DEFAULT 'new' NOT NULL,
|
|
"decision" text,
|
|
"decided_by" text,
|
|
"decision_reason" text,
|
|
"task_id" integer,
|
|
"task_created_at" timestamp with time zone,
|
|
"resolved_release" text,
|
|
"resolved_at" timestamp with time zone,
|
|
"regressions" integer DEFAULT 0 NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "incidents_bugsink_issue_id_unique" UNIQUE("bugsink_issue_id")
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "error_sources" ADD CONSTRAINT "error_sources_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "incident_settings" ADD CONSTRAINT "incident_settings_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "incident_settings" ADD CONSTRAINT "incident_settings_goal_id_goals_id_fk" FOREIGN KEY ("goal_id") REFERENCES "public"."goals"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "incidents" ADD CONSTRAINT "incidents_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "incidents" ADD CONSTRAINT "incidents_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "error_sources_project_kind" ON "error_sources" USING btree ("project_id","kind"); |