feat: add definition page link to DAG run details header#1977
Conversation
📝 WalkthroughWalkthroughThe changes add a new optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
5562382 to
93e7ca8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
api/v1/api.yaml (1)
8261-8263: Prefer reusingDAGFileNameschema forsourceFileNameUsing a plain
stringweakens the contract. Consider referencing#/components/schemas/DAGFileNameso validation and route expectations stay consistent with other DAG filename fields.♻️ Proposed schema tweak
sourceFileName: - type: string + $ref: "#/components/schemas/DAGFileName" description: "File name of the source DAG definition, derived from the DAG-run's source file path. Only set when the source file still exists on disk. Can be used to navigate to the DAG definition page."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@api/v1/api.yaml` around lines 8261 - 8263, Replace the inline plain string schema for sourceFileName with a reference to the existing DAGFileName component (use $ref: '#/components/schemas/DAGFileName') so the field reuses the shared DAG filename contract; keep the current description text and any nullable/required semantics intact when swapping type:string for the $ref. Ensure the symbol sourceFileName in the API YAML now points to the shared DAGFileName schema to maintain consistent validation and route expectations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/service/frontend/api/v1/dagruns.go`:
- Around line 3263-3265: Replace the fragile prefix check that uses
strings.HasPrefix(absSource, absDAGsDir+string(filepath.Separator)) with a
containment test using filepath.Rel: call filepath.Rel(absDAGsDir, absSource)
and treat the source as inside the DAGs dir if the returned relative path does
not start with ".." and no error occurred; update the branch that currently
returns (true, "") to use this new check so sourceFileName is only suppressed
when the file is truly outside absDAGsDir.
---
Nitpick comments:
In `@api/v1/api.yaml`:
- Around line 8261-8263: Replace the inline plain string schema for
sourceFileName with a reference to the existing DAGFileName component (use $ref:
'#/components/schemas/DAGFileName') so the field reuses the shared DAG filename
contract; keep the current description text and any nullable/required semantics
intact when swapping type:string for the $ref. Ensure the symbol sourceFileName
in the API YAML now points to the shared DAGFileName schema to maintain
consistent validation and route expectations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a90269b0-aec7-4f00-b881-5d31439edb82
📒 Files selected for processing (5)
api/v1/api.gen.goapi/v1/api.yamlinternal/service/frontend/api/v1/dagruns.goui/src/api/v1/schema.tsui/src/features/dag-runs/components/dag-run-details/DAGRunHeader.tsx
…chema Address PR review comments: - Replace brittle strings.HasPrefix containment check with filepath.Rel to correctly handle edge cases like DAGsDir == "/" - Reference shared DAGFileName schema for sourceFileName in OpenAPI spec instead of inline plain string type
Summary
sourceFileNamefield to the DAG run details API response, derived from the DAG run's source file path (only set when the source file still exists on disk)/dags/{sourceFileName}/Test plan
sourceFileNameis returned in the DAG run details API response when the source file existssourceFileNameis absent when the source file no longer exists on diskSummary by CodeRabbit