Skip to content

feat(ui): add datasource/dataset picker to policy override dialog#79

Merged
bordumb merged 11 commits intomainfrom
dev-launchPlan1
Jan 22, 2026
Merged

feat(ui): add datasource/dataset picker to policy override dialog#79
bordumb merged 11 commits intomainfrom
dev-launchPlan1

Conversation

@bordumb
Copy link
Copy Markdown
Owner

@bordumb bordumb commented Jan 22, 2026

Summary

  • Replace the simple text input for dataset ID in the Team Policy Override dialog with a proper datasource dropdown and dataset search autocomplete
  • Matches the UX pattern used in the New Investigation page (/investigations/new)
  • Users can now select a datasource first, then search and autocomplete table/dataset names

Test plan

  • Go to /admin → Teams tab → Click gear icon on any team to open Policy Editor
  • Click "Add Override" button
  • Verify datasource dropdown shows available datasources
  • Verify table search autocomplete works when typing 2+ characters
  • Verify selecting a table populates the dataset field
  • Verify creating an override works end-to-end

🤖 Generated with Claude Code

bordumb and others added 11 commits January 22, 2026 19:08
- Add migration 028_team_policies.sql with tables:
  - team_policies: Team default policy configuration
  - team_policy_overrides: Dataset/tag-specific overrides
  - team_queue_limits: Per-team rate limits and concurrency
  - dataset_tags: Dataset-to-tag mapping for policy selectors
- Add TeamPolicyRepository with CRUD operations for all entities
- Add PolicyAction enum (auto, review, issue_only)
- Add dataclasses: TeamPolicy, TeamPolicyOverride, TeamQueueLimits
- Add comprehensive unit tests (28 tests, all passing)

Part of fn-24: Month 0-2: Triage + Policy Engine

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add PolicyService with precedence-based evaluation:
  - Dataset overrides > Tag overrides > Team default > System defaults
- Add severity-based action resolution:
  - Auto-investigate above min severity threshold
  - Require review below max severity threshold
- Add QueueConfig dataclass for rate limiting settings
- Add IssueContext and PolicyResult for API integration
- Add evaluate_policy_for_issue convenience function
- Add comprehensive unit tests (19 tests, all passing)

Part of fn-24.2: Policy engine: evaluate team + dataset rules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Integrate policy evaluation after issue creation from webhooks
- AUTO action starts investigation via Temporal (if configured)
- REVIEW action sends notification for manual review
- ISSUE_ONLY action creates issue without additional action
- Add policy_action and investigation_id to WebhookIssueResponse
- Add get_default_team_for_tenant helper to TeamPolicyRepository
- Add 6 new unit tests for policy-driven integration actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…limits

- Add InvestigationQueue with per-team job routing and priority support
- Add RedisRateLimiter using sliding window algorithm (Lua script)
- Add InvestigationWorker to process jobs and start Temporal workflows
- Support retry with exponential backoff for failed jobs
- Jobs isolated per team - failures don't block other teams
- Add 25 unit tests for queue and rate limiter
- Add redis>=5.0.0 dependency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add RedisSSEEventStore for persistent run event storage
- Events survive process restart with configurable TTL
- Replay window reads from Redis instead of in-memory dicts
- Add RedisRateLimitMiddleware with sliding window algorithm
- Rate limiting uses per-tenant identifiers (tenant > API key > IP)
- Both components fail open on Redis errors for reliability
- Include InMemoryFallbackSSEEventStore for local development

Components:
- adapters/sse/redis_event_store.py: Event store with sequencing and TTL
- middleware/redis_rate_limit.py: Distributed rate limiting

Tests: 41 unit tests for event store and rate limit middleware

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create TeamPolicyEditor component with policy management:
  - Default policy configuration (action, severity thresholds)
  - Dataset/tag override management with CRUD operations
  - Queue limits configuration (rate limits, burst, concurrency)
- Integrate policy editor into teams-settings.tsx with settings button
- Update teams API routes with policy management endpoints
- Regenerate frontend API client with new policy types and hooks

fn-24.6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add migration for analytics_events table with tenant_activation tracking
- Create materialized view for weekly usage aggregates
- Add AnalyticsService with event recording and aggregation methods
- Create /api/v1/analytics endpoints:
  - GET /weekly-usage: Weekly metrics with resolution rates
  - GET /activation: Tenant activation status
  - GET /activation/funnel: Cross-tenant funnel metrics
  - POST /refresh: Refresh materialized view
- Add comprehensive unit tests (16 tests)
- Document how to query metrics via API and SQL

fn-24.7

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 028_team_policies.sql and 029_analytics_events.sql to the explicit
migration list in the demo command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The teams router already has prefix="/teams" defined, so including it
with an additional prefix="/teams" created duplicate routes at
/api/v1/teams/teams/. Remove the duplicate registration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Radix UI Select doesn't allow empty string values for SelectItem.
Use '__none__' as a placeholder value and convert to/from empty string
when reading/writing the state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace the simple text input for dataset ID with a proper datasource
dropdown and dataset search autocomplete, matching the UX pattern from
the New Investigation page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dataing Ready Ready Preview, Comment Jan 22, 2026 8:26pm
dataing-app Ready Ready Preview, Comment Jan 22, 2026 8:26pm
dataing-docs Ready Ready Preview, Comment Jan 22, 2026 8:26pm

@bordumb bordumb merged commit 2856769 into main Jan 22, 2026
6 checks passed
@bordumb bordumb deleted the dev-launchPlan1 branch January 22, 2026 20:31
@bordumb bordumb restored the dev-launchPlan1 branch January 22, 2026 20:32
bordumb added a commit that referenced this pull request Jan 22, 2026
* feat(policy): add team policies data model and migrations

- Add migration 028_team_policies.sql with tables:
  - team_policies: Team default policy configuration
  - team_policy_overrides: Dataset/tag-specific overrides
  - team_queue_limits: Per-team rate limits and concurrency
  - dataset_tags: Dataset-to-tag mapping for policy selectors
- Add TeamPolicyRepository with CRUD operations for all entities
- Add PolicyAction enum (auto, review, issue_only)
- Add dataclasses: TeamPolicy, TeamPolicyOverride, TeamQueueLimits
- Add comprehensive unit tests (28 tests, all passing)

Part of fn-24: Month 0-2: Triage + Policy Engine

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(policy): add policy evaluation service

- Add PolicyService with precedence-based evaluation:
  - Dataset overrides > Tag overrides > Team default > System defaults
- Add severity-based action resolution:
  - Auto-investigate above min severity threshold
  - Require review below max severity threshold
- Add QueueConfig dataclass for rate limiting settings
- Add IssueContext and PolicyResult for API integration
- Add evaluate_policy_for_issue convenience function
- Add comprehensive unit tests (19 tests, all passing)

Part of fn-24.2: Policy engine: evaluate team + dataset rules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(integrations): add policy-driven actions for webhook issues

- Integrate policy evaluation after issue creation from webhooks
- AUTO action starts investigation via Temporal (if configured)
- REVIEW action sends notification for manual review
- ISSUE_ONLY action creates issue without additional action
- Add policy_action and investigation_id to WebhookIssueResponse
- Add get_default_team_for_tenant helper to TeamPolicyRepository
- Add 6 new unit tests for policy-driven integration actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(queue): add Redis-backed investigation queue with per-team rate limits

- Add InvestigationQueue with per-team job routing and priority support
- Add RedisRateLimiter using sliding window algorithm (Lua script)
- Add InvestigationWorker to process jobs and start Temporal workflows
- Support retry with exponential backoff for failed jobs
- Jobs isolated per team - failures don't block other teams
- Add 25 unit tests for queue and rate limiter
- Add redis>=5.0.0 dependency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(sse): add Redis-backed SSE event store and API rate limiting

- Add RedisSSEEventStore for persistent run event storage
- Events survive process restart with configurable TTL
- Replay window reads from Redis instead of in-memory dicts
- Add RedisRateLimitMiddleware with sliding window algorithm
- Rate limiting uses per-tenant identifiers (tenant > API key > IP)
- Both components fail open on Redis errors for reliability
- Include InMemoryFallbackSSEEventStore for local development

Components:
- adapters/sse/redis_event_store.py: Event store with sequencing and TTL
- middleware/redis_rate_limit.py: Distributed rate limiting

Tests: 41 unit tests for event store and rate limit middleware

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(ui): add team policy editor in Settings > Teams

- Create TeamPolicyEditor component with policy management:
  - Default policy configuration (action, severity thresholds)
  - Dataset/tag override management with CRUD operations
  - Queue limits configuration (rate limits, burst, concurrency)
- Integrate policy editor into teams-settings.tsx with settings button
- Update teams API routes with policy management endpoints
- Regenerate frontend API client with new policy types and hooks

fn-24.6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(analytics): add activation and weekly usage analytics

- Add migration for analytics_events table with tenant_activation tracking
- Create materialized view for weekly usage aggregates
- Add AnalyticsService with event recording and aggregation methods
- Create /api/v1/analytics endpoints:
  - GET /weekly-usage: Weekly metrics with resolution rates
  - GET /activation: Tenant activation status
  - GET /activation/funnel: Cross-tenant funnel metrics
  - POST /refresh: Refresh materialized view
- Add comprehensive unit tests (16 tests)
- Document how to query metrics via API and SQL

fn-24.7

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(demo): add missing migrations to justfile demo command

Add 028_team_policies.sql and 029_analytics_events.sql to the explicit
migration list in the demo command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(api): remove duplicate teams router registration

The teams router already has prefix="/teams" defined, so including it
with an additional prefix="/teams" created duplicate routes at
/api/v1/teams/teams/. Remove the duplicate registration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(ui): use placeholder values instead of empty strings in Select

Radix UI Select doesn't allow empty string values for SelectItem.
Use '__none__' as a placeholder value and convert to/from empty string
when reading/writing the state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(ui): add datasource/dataset picker to policy override dialog

Replace the simple text input for dataset ID with a proper datasource
dropdown and dataset search autocomplete, matching the UX pattern from
the New Investigation page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
bordumb pushed a commit that referenced this pull request Jan 22, 2026
# [1.4.0](v1.3.0...v1.4.0) (2026-01-22)

### Features

* **ui:** add datasource/dataset picker to policy override dialog ([#79](#79)) ([2856769](2856769))
bordumb added a commit that referenced this pull request Jan 22, 2026
* feat(policy): add team policies data model and migrations

- Add migration 028_team_policies.sql with tables:
  - team_policies: Team default policy configuration
  - team_policy_overrides: Dataset/tag-specific overrides
  - team_queue_limits: Per-team rate limits and concurrency
  - dataset_tags: Dataset-to-tag mapping for policy selectors
- Add TeamPolicyRepository with CRUD operations for all entities
- Add PolicyAction enum (auto, review, issue_only)
- Add dataclasses: TeamPolicy, TeamPolicyOverride, TeamQueueLimits
- Add comprehensive unit tests (28 tests, all passing)

Part of fn-24: Month 0-2: Triage + Policy Engine

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(policy): add policy evaluation service

- Add PolicyService with precedence-based evaluation:
  - Dataset overrides > Tag overrides > Team default > System defaults
- Add severity-based action resolution:
  - Auto-investigate above min severity threshold
  - Require review below max severity threshold
- Add QueueConfig dataclass for rate limiting settings
- Add IssueContext and PolicyResult for API integration
- Add evaluate_policy_for_issue convenience function
- Add comprehensive unit tests (19 tests, all passing)

Part of fn-24.2: Policy engine: evaluate team + dataset rules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(integrations): add policy-driven actions for webhook issues

- Integrate policy evaluation after issue creation from webhooks
- AUTO action starts investigation via Temporal (if configured)
- REVIEW action sends notification for manual review
- ISSUE_ONLY action creates issue without additional action
- Add policy_action and investigation_id to WebhookIssueResponse
- Add get_default_team_for_tenant helper to TeamPolicyRepository
- Add 6 new unit tests for policy-driven integration actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(queue): add Redis-backed investigation queue with per-team rate limits

- Add InvestigationQueue with per-team job routing and priority support
- Add RedisRateLimiter using sliding window algorithm (Lua script)
- Add InvestigationWorker to process jobs and start Temporal workflows
- Support retry with exponential backoff for failed jobs
- Jobs isolated per team - failures don't block other teams
- Add 25 unit tests for queue and rate limiter
- Add redis>=5.0.0 dependency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(sse): add Redis-backed SSE event store and API rate limiting

- Add RedisSSEEventStore for persistent run event storage
- Events survive process restart with configurable TTL
- Replay window reads from Redis instead of in-memory dicts
- Add RedisRateLimitMiddleware with sliding window algorithm
- Rate limiting uses per-tenant identifiers (tenant > API key > IP)
- Both components fail open on Redis errors for reliability
- Include InMemoryFallbackSSEEventStore for local development

Components:
- adapters/sse/redis_event_store.py: Event store with sequencing and TTL
- middleware/redis_rate_limit.py: Distributed rate limiting

Tests: 41 unit tests for event store and rate limit middleware

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(ui): add team policy editor in Settings > Teams

- Create TeamPolicyEditor component with policy management:
  - Default policy configuration (action, severity thresholds)
  - Dataset/tag override management with CRUD operations
  - Queue limits configuration (rate limits, burst, concurrency)
- Integrate policy editor into teams-settings.tsx with settings button
- Update teams API routes with policy management endpoints
- Regenerate frontend API client with new policy types and hooks

fn-24.6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(analytics): add activation and weekly usage analytics

- Add migration for analytics_events table with tenant_activation tracking
- Create materialized view for weekly usage aggregates
- Add AnalyticsService with event recording and aggregation methods
- Create /api/v1/analytics endpoints:
  - GET /weekly-usage: Weekly metrics with resolution rates
  - GET /activation: Tenant activation status
  - GET /activation/funnel: Cross-tenant funnel metrics
  - POST /refresh: Refresh materialized view
- Add comprehensive unit tests (16 tests)
- Document how to query metrics via API and SQL

fn-24.7

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(demo): add missing migrations to justfile demo command

Add 028_team_policies.sql and 029_analytics_events.sql to the explicit
migration list in the demo command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(api): remove duplicate teams router registration

The teams router already has prefix="/teams" defined, so including it
with an additional prefix="/teams" created duplicate routes at
/api/v1/teams/teams/. Remove the duplicate registration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(ui): use placeholder values instead of empty strings in Select

Radix UI Select doesn't allow empty string values for SelectItem.
Use '__none__' as a placeholder value and convert to/from empty string
when reading/writing the state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(ui): add datasource/dataset picker to policy override dialog

Replace the simple text input for dataset ID with a proper datasource
dropdown and dataset search autocomplete, matching the UX pattern from
the New Investigation page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add frontend files

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant