Skip to content

fix: 修复workspace不能为null的问题 - #186

Merged
qdaxb merged 2 commits into
mainfrom
human/salamander-20260119-084432
Jan 19, 2026
Merged

qdaxb merged 2 commits into
mainfrom
human/salamander-20260119-084432

Conversation

@Micro66

@Micro66 Micro66 commented Jan 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Refined public shell filtering to exclude non-Shell type shells, ensuring more accurate shell availability.
  • Refactor

    • Improved internal data consistency for flow execution and resource handling with enhanced default value initialization.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The changes enforce non-nullability on FlowResource and FlowExecution model fields with appropriate defaults, update service layer logic to initialize and normalize these fields during flow creation/updates and execution handling, narrow shell query filters to specific kinds, and update test fixtures accordingly.

Changes

Cohort / File(s) Summary
Flow Model Constraints
backend/app/models/flow.py
Enforces non-nullable fields across FlowResource (team_id, workspace_id with default 0, webhook fields with default "", execution tracking fields) and FlowExecution (task_id with default 0, trigger_reason, result_summary, error_message, timestamp fields).
Flow Service Initialization
backend/app/services/flow.py
Normalizes field defaults on flow creation and updates: workspace_id→0 when None, webhook fields→"", initializes execution timestamps. Regenerates webhook credentials when switching to EVENT trigger, resets when switching away. Ensures next_execution_time defaults to current UTC. Initializes FlowExecution with task_id=0 and consistent field defaults.
Shell Query Filter
backend/app/services/adapters/shell_utils.py
Restricts public shell fetch results to rows where Kind.kind == "Shell" in addition to existing active and public filters.
Test Fixtures
backend/tests/api/endpoints/test_flows.py
Updates FlowResource test fixtures to include last_execution_time, last_execution_status, and next_execution_time parameters in initialization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Constraints stand firm, no nulls shall pass,
Defaults bloom like spring's green grass,
Webhooks dance when triggers call,
Executions flow with none left fall! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title focuses on workspace nullability but the PR makes extensive non-nullability changes across multiple fields in FlowResource and FlowExecution models. Update title to reflect the broader scope, e.g. 'refactor: make Flow model fields non-nullable with appropriate defaults' or 'fix: enforce non-nullability constraints in Flow models'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qdaxb
qdaxb merged commit ff881cf into main Jan 19, 2026
13 of 14 checks passed
maquan0927 pushed a commit to maquan0927/Wegent that referenced this pull request Jan 22, 2026
* fix: 修复获取公共shell时的过滤条件

* fix: 测试用例中添加执行时间字段

---------

Co-authored-by: hongyu9 <hongyu9@staff.weibo.com>
@qdaxb
qdaxb deleted the human/salamander-20260119-084432 branch February 4, 2026 09:29
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.

3 participants