Files
Rahul Johny 89d4d6b5a1 UN-2871 [FEATURE] Log sharing across shared workflows/deployments (#1580)
* UN-2871 [FEATURE] Add shared workflow executions filter to enable multi-user access

Update WorkflowExecutionManager.for_user() to include executions from workflows shared with users, ensuring consistent access control across workflow and execution models.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Update backend/workflow_manager/workflow_v2/models/execution.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com>

* UN-2871 [FIX] Move Q import to top-level for PEP8 compliance

Move django.db.models.Q import from function-level to module-level to comply with linting standards and improve code organization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* UN-2871 [SECURITY] Fix execution filtering to respect independent workflow and deployment sharing

Update WorkflowExecutionManager.for_user() to properly handle independent sharing between workflows and API deployments/pipelines. Previous implementation only checked workflow sharing, allowing users to see executions for unshared deployments.

Key changes:
- Add separate filters for API deployments and pipelines access
- Implement proper logic for independent sharing scenarios:
  * Workflow shared + no pipeline -> User sees workflow-level executions
  * API/Pipeline shared (regardless of workflow) -> User sees those executions
  * Both shared -> User sees all related executions
  * Neither shared -> User cannot see executions

This ensures users can only view executions for resources they have explicit access to, preventing unauthorized data exposure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* UN-2871 [PERF] Optimize ExecutionFilter to use EXISTS instead of values_list for large datasets

Replace inefficient values_list() queries with EXISTS subqueries in filter_execution_entity().
This significantly improves performance when filtering by entity type on large datasets.

Performance improvements:
- API filter: Uses EXISTS check instead of fetching all API deployment IDs
- ETL filter: Uses EXISTS check instead of fetching all ETL pipeline IDs
- TASK filter: Uses EXISTS check instead of fetching all TASK pipeline IDs
- Workflow filter: Simplified to use isnull check (removed redundant workflow_id filter)

EXISTS is more efficient because:
1. Stops at first match (short-circuits)
2. Doesn't transfer data from database to application
3. Better query optimizer hints for the database
4. Reduced memory usage

The queryset is already filtered by user permissions via get_queryset(),
so this change only optimizes the entity type filtering step.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* UN-2871 [FIX] Move Exists and OuterRef imports to module level for PEP8 compliance

Move django.db.models.Exists and OuterRef imports from function-level to module-level to comply with linting standards and improve code organization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Signed-off-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-10-13 15:04:15 +05:30
..
2025-04-24 16:07:02 +05:30
2025-04-24 16:07:02 +05:30