Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/codex-stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ Configure public presentation in `src/content/tokens.ts`:
- `rankingLimit`: number of ranked tools and skills displayed.
- `accountLabels`: optional public labels keyed by registered account ID; defaults
to numbered accounts. Credentials and upstream account identities stay private.
- `timeZone`: timezone for displaying allowance reset dates.
- `excludedTools`: exact plugin/skill names to exclude from public data,
including older snapshots. Stored data is not deleted.

Expand All @@ -118,7 +117,8 @@ The detailed breakdowns use internal Codex endpoints. History means available
records within `historyDays`, not complete lifetime coverage. Changing the window
triggers a fresh backfill. Requests fetch up to 100 named tools/skills; upstream may
group additional entries. These sources may lag behind profile totals. Failed
requests retain previous data; empty sections are hidden. Day boundaries are UTC.
requests retain previous data; empty sections are hidden. Display reset timestamps
in the visitor's timezone and keep provider dates for daily totals.

Token and invocation counts sum across accounts. Cache hit rate is weighted by
input tokens from rows with all components reported; missing components are not
Expand Down
36 changes: 36 additions & 0 deletions drizzle/0026_brainy_nitro.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ALTER TABLE "github_work_units" DROP CONSTRAINT "gh_work_units_activity_order";--> statement-breakpoint
ALTER TABLE "github_issues" ADD COLUMN "status" varchar(16) DEFAULT 'open' NOT NULL;--> statement-breakpoint
ALTER TABLE "github_issues" ADD COLUMN "activity_at" timestamp with time zone;--> statement-breakpoint
ALTER TABLE "github_issues" ADD COLUMN "provider_updated_at" timestamp with time zone;--> statement-breakpoint
ALTER TABLE "github_pull_requests" ADD COLUMN "status_changed_at" timestamp with time zone;--> statement-breakpoint
ALTER TABLE "github_work_units" ADD COLUMN "pull_request" jsonb;--> statement-breakpoint
ALTER TABLE "github_issues" ADD CONSTRAINT "github_issues_status" CHECK ("github_issues"."status" IN ('open', 'closed', 'completed', 'not-planned'));--> statement-breakpoint
CREATE OR REPLACE FUNCTION protect_github_activity_history() RETURNS trigger
LANGUAGE plpgsql SET search_path = public AS $$
BEGIN
IF OLD.day < (clock_timestamp() AT TIME ZONE 'Asia/Kolkata')::date - 1 THEN
IF TG_OP = 'DELETE' THEN RAISE EXCEPTION 'Closed activity cannot be deleted'; END IF;
IF NEW.day <> OLD.day OR NEW.identity_key <> OLD.identity_key OR NEW.repository_id <> OLD.repository_id
OR (NEW.payload - 'headline' - 'summary' - 'summarizing') IS DISTINCT FROM (OLD.payload - 'headline' - 'summary' - 'summarizing')
OR (OLD.payload->>'headline' IS NOT NULL AND NEW.payload IS DISTINCT FROM OLD.payload)
THEN RAISE EXCEPTION 'Closed activity facts are immutable'; END IF;
END IF;
IF TG_OP = 'DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END;
$$;
--> statement-breakpoint
-- Rebuild direct-day groups and their mutable cards; closed history stays intact.
DELETE FROM github_activity_snapshots
WHERE day >= (clock_timestamp() AT TIME ZONE 'Asia/Kolkata')::date - 1
AND payload->>'kind' = 'canonical-day';
--> statement-breakpoint
DELETE FROM github_work_units WHERE kind = 'canonical_day';
--> statement-breakpoint
UPDATE github_work_units SET activity_day = (activity_at AT TIME ZONE 'Asia/Kolkata')::date;
--> statement-breakpoint
ALTER TABLE "github_work_units" ADD CONSTRAINT "gh_work_units_activity_order" CHECK ("github_work_units"."first_activity_at" <= "github_work_units"."last_activity_at" AND "github_work_units"."activity_day" = ("github_work_units"."activity_at" AT TIME ZONE 'Asia/Kolkata')::date);
--> statement-breakpoint
UPDATE github_repositories SET projection_request_token = gen_random_uuid();
--> statement-breakpoint
UPDATE github_public_feed_head SET projection_request_token = gen_random_uuid();
Loading
Loading