Skip to content

fix: use timezone=true on flow_version created_at field#12180

Merged
jordanrfrazier merged 2 commits into
mainfrom
fix-flow-version-timezone
Mar 13, 2026
Merged

fix: use timezone=true on flow_version created_at field#12180
jordanrfrazier merged 2 commits into
mainfrom
fix-flow-version-timezone

Conversation

@jordanrfrazier
Copy link
Copy Markdown
Collaborator

@jordanrfrazier jordanrfrazier commented Mar 13, 2026

Adds a missing timezone=true to a field. Migration already has this correctly.

Summary by CodeRabbit

  • Chores
    • Updated flow version timestamp recording to use server-side generation for improved consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 556def89-d1f9-4391-ace5-2b820552a482

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The FlowVersion model's created_at field was modified to use a server-side database default via SQLAlchemy's func.now() instead of a client-side Python default factory. Necessary SQLAlchemy imports were added to support this change.

Changes

Cohort / File(s) Summary
FlowVersion Model Timestamp
src/backend/base/langflow/services/database/models/flow_version/model.py
Added DateTime and func imports from SQLAlchemy. Changed created_at field from client-side default (default_factory=lambda: datetime.now(timezone.utc)) to server-side default using sa_column with Column(DateTime(timezone=True), server_default=func.now()).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR changes created_at field to use server_default but existing tests do not verify created_at is populated or endpoint works correctly after the change. Add tests verifying created_at field is properly populated with timezone and POST /flow/{flow_id}/versions endpoint returns complete FlowVersionRead object with created_at field.
Test Quality And Coverage ⚠️ Warning PR modifies FlowVersion.created_at to use server_default without tests validating POST /flow/{flow_id}/versions endpoint functionality or created_at field population. Add integration tests for flow version creation endpoint and implement eager_defaults fix or entity refresh to ensure server-side defaults are populated in ORM object.
Test File Naming And Structure ❓ Inconclusive No test files were found in the repository to assess naming conventions and structure for changes to the FlowVersion model. Verify whether test files exist for database model changes and ensure they follow pytest naming patterns (test_*.py) with proper coverage of the created_at field modification.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: adding timezone=true to the flow_version created_at field, which matches the core modification in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Excessive Mock Usage Warning ✅ Passed Test suite demonstrates excellent design with minimal appropriate mock usage, leveraging real AsyncClient and database interactions rather than mocking core logic.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-flow-version-timezone
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@github-actions github-actions Bot added the bug Something isn't working label Mar 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 13, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 24%
24.14% (8609/35660) 16.89% (4743/28067) 16.87% (1261/7473)

Unit Test Results

Tests Skipped Failures Errors Time
2776 0 💤 0 ❌ 0 🔥 45.546s ⏱️

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 38.38%. Comparing base (4511419) to head (74109df).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...flow/services/database/models/flow_version/crud.py 0.00% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (44.32%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12180      +/-   ##
==========================================
+ Coverage   38.36%   38.38%   +0.01%     
==========================================
  Files        1630     1630              
  Lines       80250    80251       +1     
  Branches    12114    12114              
==========================================
+ Hits        30791    30804      +13     
+ Misses      47723    47711      -12     
  Partials     1736     1736              
Flag Coverage Δ
backend 57.18% <66.66%> (+0.05%) ⬆️
frontend 21.56% <ø> (ø)
lfx 44.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...low/services/database/models/flow_version/model.py 100.00% <100.00%> (ø)
...flow/services/database/models/flow_version/crud.py 39.06% <0.00%> (-0.63%) ⬇️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Mar 13, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/backend/base/langflow/services/database/models/flow_version/model.py`:
- Around line 26-28: The created_at column uses server_default=func.now() but
the ORM object lacks the default value at return, causing Pydantic validation to
fail; fix by either enabling eager server defaults on the model mapper (add
eager_defaults=True to the FlowVersion model mapper/config where created_at:
Field(...) is defined) so SQL defaults are loaded into the instance, or after
creating the DB row in create_flow_version_entry() call session.refresh(entry)
(await if async) after flush/commit and before returning the entry so created_at
is populated for FlowVersionRead.model_validate(...).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5b660232-abf9-4d18-bff5-3af3a6321e60

📥 Commits

Reviewing files that changed from the base of the PR and between 4511419 and f4e1801.

📒 Files selected for processing (1)
  • src/backend/base/langflow/services/database/models/flow_version/model.py

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Mar 13, 2026
Copy link
Copy Markdown
Collaborator

@Adam-Aghili Adam-Aghili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to validate my understanding we are now making the DB the source of truth for timestamps?

If my understanding is correct LGTM!

@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Mar 13, 2026
@jordanrfrazier jordanrfrazier added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit e6d6d2e Mar 13, 2026
99 of 100 checks passed
@jordanrfrazier jordanrfrazier deleted the fix-flow-version-timezone branch March 13, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants