Skip to content

Log file - docs update#10454

Closed
andifilhohub wants to merge 56 commits into
langflow-ai:mainfrom
andifilhohub:docs-update
Closed

Log file - docs update#10454
andifilhohub wants to merge 56 commits into
langflow-ai:mainfrom
andifilhohub:docs-update

Conversation

@andifilhohub
Copy link
Copy Markdown
Member

@andifilhohub andifilhohub commented Oct 30, 2025

While searching for the Langflow Desktop logs on Windows, I couldn’t locate them in the directory indicated by the current documentation.
However, I found them in a different location, which I have updated in this pull request to reflect the correct log path. Could you please check if it is correct, @mendonk?

Summary by CodeRabbit

  • New Features

    • Enhanced flow logs modal with pagination support, improved column layout, and descending timestamp ordering for better visibility of recent transactions.
  • Bug Fixes

    • Improved stdout/stderr stream handling in CLI execution.
    • Fixed background task cleanup to prevent resource leaks.
  • Documentation

    • Updated Windows log storage paths in Langflow Desktop documentation.

deon-sanchez and others added 30 commits September 10, 2025 13:45
- Moved import statements for better readability.
- Added sorting of rows by timestamp in FlowLogsModal.
- Implemented refetching of data when pagination parameters change.
- Updated pagination logic to reflect the correct total pages count.
- Changed sorting of rows by timestamp to latest first before converting to display format.
- Updated row processing to convert timestamps after sorting.
- Removed redundant setRows call when data is available.
- Reorganized import statements for clarity in monitor.py and crud.py.
- Improved formatting and indentation for function definitions and return statements.
- Updated FlowLogsModal to handle loading state with a loading overlay.
- Adjusted transaction retrieval to sort by timestamp in descending order.
- Streamlined row processing logic in FlowLogsModal for better performance.
- Introduced `TransactionLogsResponse` model to format transaction data for logs, excluding sensitive fields.
- Updated `transform_transaction_table_for_logs` function to transform transaction data accordingly.
- Modified `get_transactions` endpoint to return `TransactionLogsResponse` instead of `TransactionTable`.
- Cleaned up import statements in `monitor.py` and `crud.py` for better organization.
- Refactored `FlowLogsModal` to improve code structure and readability.
- Reorganized import statements for clarity.
- Customized column settings to improve usability, including setting specific columns as non-editable and adjusting their widths.
- Added grid options to suppress default behaviors for a better user experience.
- Removed timestamp conversion logic from the modal and centralized it in the new column configuration file.
- Introduced a dedicated `createFlowLogsColumns` function to manage column definitions, improving maintainability.
- Adjusted pagination and table component settings for better layout and user experience.
- Eliminated the suppressRowClickSelection property to streamline the table interaction experience.
- This change aligns with recent enhancements to improve usability and maintainability of the FlowLogsModal component.
deon-sanchez and others added 25 commits October 8, 2025 08:58
Updated the documentation to reflect the correct location of the Langflow Desktop logs. The previous path was outdated — the logs were only found at the new directory indicated in this update.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 30, 2025

Walkthrough

This PR implements a comprehensive flow logs feature across the stack: a new TransactionLogsResponse model for logs display, backend API changes to return logs in descending timestamp order, transaction persistence logic in the CLI/graph layer, a refactored frontend logs modal with pagination, and supporting tests and utilities.

Changes

Cohort / File(s) Summary
Documentation
docs/docs/Develop/logging.mdx
Updated Windows log storage path from AppData\Roaming to AppData\Local in logging documentation.
Backend Transaction Model & CRUD
src/backend/base/langflow/services/database/models/transactions/model.py, src/backend/base/langflow/services/database/models/transactions/crud.py
Added new TransactionLogsResponse model with field serializers for inputs/outputs text and item limits. Added transform_transaction_table_for_logs helper function and changed transaction ordering to descending by timestamp.
Backend API
src/backend/base/langflow/api/v1/monitor.py
Modified get_transactions return type from Page[TransactionTable] to Page[TransactionLogsResponse] with new transformer and descending timestamp ordering.
Test Utilities & Integration
src/backend/tests/integration/utils.py
Added _cleanup_graph_tasks helper to ensure background tasks (end trace and log_transaction tasks) are properly awaited in try/finally blocks across run_flow, _add_component, and run_single_component.
Frontend Logs Button
src/frontend/src/components/core/logCanvasControlsComponent/index.tsx
Added data-testid="flow-logs-modal-button" to Logs Button.
Frontend Logs Modal Column Config
src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx
Created new column configuration module with createFlowLogsColumns function defining Ag-Grid column structure for flow logs (ID, Timestamp, Vertex ID, Target ID, Inputs, Outputs, Status) with time conversion and JSON rendering.
Frontend Logs Modal
src/frontend/src/modals/flowLogsModal/index.tsx
Refactored modal with LoadingComponent, columnDefs, timestamp localization via convertUTCToLocalTimezone, pagination support (pageSize increased to 24), TableComponent with gridOptions, and PaginatorComponent for multi-page handling.
Frontend Test Utilities
src/frontend/tests/utils/adjust-screen-view.ts
Changed dropdown close action from clicking canvas_controls_dropdown to clicking document body.
Frontend Logs Tests
src/frontend/tests/extended/features/flow-logs-modal.spec.ts, src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
Added test suites validating logs display with SUCCESS/ERROR statuses, pagination behavior, timestamp ordering, and row counts.
CLI stdout/stderr Restoration
src/lfx/src/lfx/cli/run.py
Enhanced error handling to track and restore original stdout/stderr across multiple exception paths before emitting error messages.
Graph Transaction Logging
src/lfx/src/lfx/graph/utils.py
Enhanced log_transaction function to persist transactions to database with lazy imports of Langflow DB models, safe JSON payload construction for inputs/outputs, and detailed error capture including rich error type handling.
Vertex Build Transactional Logging
src/lfx/src/lfx/graph/vertex/base.py
Wrapped Vertex.build and Vertex._build execution in try/except to invoke log_transaction on both success (when no requester) and error paths with exception re-raising.
CLI Error Tests
src/lfx/tests/unit/cli/test_run_starter_projects.py
Refined ModuleNotFoundError detection with regex-based patterns to identify actual langflow/lfx import errors versus external dependency issues.
Transaction Logging Tests
src/lfx/tests/unit/test_error_transaction_logging.py
Added comprehensive test suite for error transaction logging covering transaction storage disablement, database unavailability, fallback error handling, ComponentBuildError extraction, and _vertex_to_primitive_dict sanitization.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Frontend Modal
    participant API as Backend API
    participant DB as Database
    participant Cache as In-Memory Cache
    
    UI->>API: GET /v1/monitor/transactions?page=1&size=24
    API->>DB: Query transactions ordered by timestamp DESC
    DB-->>API: TransactionTable results
    API->>API: transform_transaction_table_for_logs<br/>(filter fields, serialize inputs/outputs)
    API-->>UI: Page[TransactionLogsResponse]
    UI->>UI: convertUTCToLocalTimezone for display
    UI->>UI: Render table with 24 rows max
    Note over UI: If rows > pageSize:<br/>Show PaginatorComponent
Loading
sequenceDiagram
    participant Vertex as Vertex.build()
    participant Graph as Graph Execution
    participant Logger as log_transaction
    participant DB as Langflow DB
    
    Vertex->>Vertex: Enter try block
    Vertex->>Graph: Execute build steps
    Graph-->>Vertex: Success
    Vertex->>Logger: log_transaction(status="success")
    Logger->>DB: Lazy import & persist<br/>transaction record
    DB-->>Logger: Success
    Logger-->>Vertex: Complete
    
    Vertex-->>Vertex: Exit finally block<br/>Ensure cleanup
Loading
sequenceDiagram
    participant Vertex as Vertex.build()
    participant Graph as Graph Execution
    participant Logger as log_transaction
    participant DB as Langflow DB
    
    Vertex->>Vertex: Enter try block
    Vertex->>Graph: Execute build steps
    Graph-->>Vertex: Exception raised
    Vertex->>Logger: log_transaction(status="error",<br/>error=exception)
    Logger->>DB: Lazy import & persist<br/>error transaction record<br/>(with error details & stack)
    DB-->>Logger: Success/Failure
    Logger-->>Vertex: Complete
    Vertex->>Vertex: Re-raise exception
    Vertex-->>Vertex: Exit finally block<br/>Ensure cleanup
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Backend transaction model & API changes: Requires verification of the new TransactionLogsResponse model, field serializer constraints (max_length, max_items), and transformer logic transforming TransactionTable to the response format.
  • Database persistence in graph/utils.py: Enhanced log_transaction function with lazy imports, JSON-safe payload construction, and error detail extraction needs careful review for exception handling and import edge cases.
  • Vertex build instrumentation: Added try/except wrapping with transactional logging at two levels (build and _build) requires understanding of control flow to ensure no double-logging or missed scenarios.
  • Frontend logs modal refactoring: Significant changes including pagination state management, timestamp localization, column definitions, and loading overlays need verification of state consistency and edge cases.
  • Test coverage: Multiple new test suites and modified utilities require validation that cleanup routines are properly invoked and that test scenarios cover both success and error paths.
  • CLI stdout/stderr restoration: Multiple error handling paths require verification that restoration occurs before all error output paths to prevent I/O stream inconsistencies.

Possibly related PRs

Suggested labels

enhancement, size:XL, lgtm

Suggested reviewers

  • Cristhianzl
  • edwinjosechittilappilly

Pre-merge checks and finishing touches

❌ Failed checks (1 error, 5 warnings)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error
Title Check ⚠️ Warning The pull request title "Log file - docs update" is misleading about the scope and nature of the changes. While the changeset does include a documentation update to docs/docs/Develop/logging.mdx (correcting the Windows log storage path), this represents only a small fraction of the work. The PR primarily implements a substantial new feature for transaction logging and flow logs, including backend models (TransactionLogsResponse), API response type changes in the monitor endpoint, new frontend components and configurations for the flow logs modal, extensive test suites for flow logs and pagination, enhanced transaction logging infrastructure with database persistence (log_transaction in lfx/graph/utils.py), and transactional logging in vertex builds. The title fails to represent or capture the main substance of this feature implementation. Consider revising the title to reflect the primary purpose of the PR, such as "Implement flow logs with transaction logging infrastructure" or "Add flow logs modal with transaction history tracking." This would accurately convey the scope of the changes and help reviewers and future maintainers understand the main objective at a glance. The documentation correction can be mentioned in the PR description if needed.
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning The test quality and coverage for new implementations in this pull request falls short of expectations. The backend unit test test_vertex_build_error_logging_integration in test_error_transaction_logging.py has a critical flaw: it imports log_transaction at module scope (line 8), then attempts to patch it at lfx.graph.utils.log_transaction (line 119), but the basic principle is that you patch where an object is looked up, which is not necessarily the same place as where it is defined, and in this case the function will look up log_transaction in the test module where it is imported. The test also does not assert the logging was actually called—it merely contains assert True. Additionally, no tests exist to validate that the new API endpoint get_transactions returns the correct Page[TransactionLogsResponse] type, that the transformer transform_transaction_table_for_logs works correctly, that field serializers enforce limits on inputs/outputs, or that timestamps are ordered in descending order. The frontend Playwright tests have issues flagged in review comments about double timezone conversion that the tests are not catching, indicating insufficient validation of actual data flow. The _cleanup_graph_tasks helper has no dedicated tests verifying it prevents task leaks; tests only verify that they complete without crashing. Fix the patching issue in test_vertex_build_error_logging_integration by patching the symbol in the correct namespace where it is looked up (the test module), not where it is defined, and add assertions validating that log_transaction was actually called. Add API endpoint tests for get_transactions that verify the response structure, field serialization with limits, and timestamp ordering. Add dedicated unit tests for transform_transaction_table_for_logs and TransactionLogsResponse serializers. Fix the frontend timezone conversion double-conversion issue caught by review comments to ensure tests validate actual behavior. Add integration tests that specifically verify _cleanup_graph_tasks prevents background task leaks rather than relying on smoke tests.
Test File Naming And Structure ⚠️ Warning The PR introduces three new test files that mostly follow correct naming and structural patterns: the backend test file test_error_transaction_logging.py uses the correct test_*.py naming convention and proper pytest structure with @pytest.mark.asyncio decorators; the frontend test files flow-logs-modal.spec.ts and flow-logs-pagination.spec.ts follow the project's Playwright test pattern with descriptive test names covering both positive and negative scenarios. However, the backend test test_vertex_build_error_logging_integration (lines 110-143) has a structural defect flagged in the review comments: it imports log_transaction at module scope, so the patch targeting lfx.graph.utils.log_transaction inside the test does not replace the locally bound symbol, making the mock ineffective. Additionally, the test concludes with assert True instead of validating that the mocking actually occurred, failing to properly verify the test's intent and violating the requirement for proper setup and teardown structure.
Excessive Mock Usage Warning ⚠️ Warning The analysis confirms excessive mock usage patterns in src/lfx/tests/unit/test_error_transaction_logging.py. The test file demonstrates a concerning trend: tests with the most mocks have the weakest assertions. For example, test_error_transaction_fallback_mechanism() uses 7 mocks but has zero assertions, test_transaction_logging_no_db_service() uses 5 mocks but only checks that a logger was called (via mock.assert_called_with), and test_vertex_build_error_logging_integration() uses 7 mocks with a meaningless assert True statement. In contrast, only test_vertex_to_primitive_dict() demonstrates proper test design with meaningful behavior assertions, and notably, it uses fewer mocks (3) focused on test data rather than dependencies. This inverse correlation between mock count and assertion quality indicates that mocks are being used to avoid testing real behavior rather than isolating external dependencies, which obscures the actual code paths being tested and creates brittle tests. Apply the fix from existing review comments to test_vertex_build_error_logging_integration() by correcting the patch location and replacing assert True with a meaningful assertion like mock_log_transaction.assert_awaited_once(). For tests with no assertions (e.g., test_transaction_logging_no_db_service, test_error_transaction_fallback_mechanism), add explicit assertions that validate the expected behavior rather than relying on mocks to implicitly verify behavior through assert_called_with. Consider whether these tests should verify the actual transaction logging logic instead of just mocking dependencies. Reduce mock density by using real objects for structural elements (vertex, graph) and mocking only true external boundaries (database service, settings). The pattern from test_vertex_to_primitive_dict() should serve as the model: focused setup, real logic execution, and meaningful assertions on output.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lfx/src/lfx/cli/run.py (1)

455-469: Critical: Duplicate error output.

The error is being output twice: once at lines 455-459 after restoring stdout/stderr, and again at lines 466-468. This will result in duplicate error messages being displayed to the user.

Apply this diff to remove the duplicate:

     # Restore stdout/stderr before outputting error to ensure it's captured properly
     sys.stdout = original_stdout
     sys.stderr = original_stderr

     output_error(f"Failed to execute graph: {e}", verbose=verbosity > 0, exception=e)
     if temp_file_to_cleanup:
         try:
             Path(temp_file_to_cleanup).unlink()
             logger.info(f"Cleaned up temporary file: {temp_file_to_cleanup}")
         except OSError:
             pass
-    sys.stdout = original_stdout
-    sys.stderr = original_stderr
-    output_error(f"Failed to execute graph: {e}", verbose=verbosity > 0, exception=e)
     raise typer.Exit(1) from e
🧹 Nitpick comments (3)
src/frontend/tests/extended/features/flow-logs-pagination.spec.ts (2)

28-40: Consider race condition in log generation.

The test creates logs in a loop with a 1-second delay between runs to ensure "distinct timestamps." However, the hard-coded waitForTimeout(1000) at line 39 could make the test slower than necessary and potentially flaky if system load varies.

Consider replacing the fixed timeout with a more reliable approach:

     for (let i = 0; i < 5; i++) {
       // Change the input value for each run to create distinct log entries
       await page
         .getByTestId("textarea_str_input_value")
         .fill(`Test input ${i + 1}`);
       await page.getByTestId("button_run_text input").click();

       // Wait for successful run before continuing to next iteration
       await page.waitForSelector("text=built successfully", { timeout: 30000 });
-
-      // Wait a bit between runs to ensure distinct timestamps
-      await page.waitForTimeout(1000);
     }

If distinct timestamps are truly required, consider using a counter or checking the actual timestamp values instead of relying on wall-clock time delays.


129-148: Consider replacing hard-coded timeout.

Similar to the first test, line 148 uses a hard-coded 1-second wait. This could slow down the test unnecessarily.

Consider removing this timeout if it's not strictly necessary, or replace it with a more specific wait condition:

     await page.getByText("Check & Save").click();

-    // Wait for the component to be ready
-    await page.waitForTimeout(1000);
+    // Wait for component to be ready (adjust selector as needed)
+    await page.waitForSelector('[data-testid="button_run_error component"]', {
+      state: "visible",
+      timeout: 3000,
+    });
src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx (1)

84-86: Type check may not handle arrays correctly.

The checks typeof inputs !== "object" and typeof outputs !== "object" will treat arrays as objects (since typeof [] === "object" in JavaScript). If inputs/outputs can be arrays, they should be handled explicitly.

If arrays are valid values, consider a more explicit check:

-    if (!inputs || typeof inputs !== "object") {
+    if (!inputs || (typeof inputs !== "object" && !Array.isArray(inputs))) {
       return <div className="text-muted-foreground">-</div>;
     }

Or, if you want to specifically handle only objects (not arrays):

-    if (!inputs || typeof inputs !== "object") {
+    if (!inputs || typeof inputs !== "object" || Array.isArray(inputs)) {
       return <div className="text-muted-foreground">-</div>;
     }

Apply the same change to the Outputs column at lines 107-109.

Also applies to: 107-109

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e24c387 and 1ffbc51.

⛔ Files ignored due to path filters (1)
  • src/frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (16)
  • docs/docs/Develop/logging.mdx (2 hunks)
  • src/backend/base/langflow/api/v1/monitor.py (3 hunks)
  • src/backend/base/langflow/services/database/models/transactions/crud.py (3 hunks)
  • src/backend/base/langflow/services/database/models/transactions/model.py (2 hunks)
  • src/backend/tests/integration/utils.py (3 hunks)
  • src/frontend/src/components/core/logCanvasControlsComponent/index.tsx (1 hunks)
  • src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx (1 hunks)
  • src/frontend/src/modals/flowLogsModal/index.tsx (4 hunks)
  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts (1 hunks)
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts (1 hunks)
  • src/frontend/tests/utils/adjust-screen-view.ts (1 hunks)
  • src/lfx/src/lfx/cli/run.py (5 hunks)
  • src/lfx/src/lfx/graph/utils.py (2 hunks)
  • src/lfx/src/lfx/graph/vertex/base.py (3 hunks)
  • src/lfx/tests/unit/cli/test_run_starter_projects.py (2 hunks)
  • src/lfx/tests/unit/test_error_transaction_logging.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
src/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

src/frontend/src/**/*.{ts,tsx,js,jsx}: All frontend TypeScript and JavaScript code should be located under src/frontend/src/ and organized into components, pages, icons, stores, types, utils, hooks, services, and assets directories as per the specified directory layout.
Use React 18 with TypeScript for all UI components in the frontend.
Format all TypeScript and JavaScript code using the make format_frontend command.
Lint all TypeScript and JavaScript code using the make lint command.

Files:

  • src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx
  • src/frontend/src/components/core/logCanvasControlsComponent/index.tsx
  • src/frontend/src/modals/flowLogsModal/index.tsx
src/frontend/src/components/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

All components should be styled using Tailwind CSS utility classes.

Files:

  • src/frontend/src/components/core/logCanvasControlsComponent/index.tsx
src/frontend/src/@(components|hooks)/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

Implement dark mode support in components and hooks where needed.

Files:

  • src/frontend/src/components/core/logCanvasControlsComponent/index.tsx
**/{test_*.py,*.test.ts,*.test.tsx}

📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)

**/{test_*.py,*.test.ts,*.test.tsx}: Check if tests have too many mock objects that obscure what’s actually being tested
Warn when mocks are used instead of testing real behavior and interactions
Suggest using real objects or simpler test doubles when mocks become excessive
Ensure mocks are used only for external dependencies, not core business logic
Recommend integration tests when unit tests become overly mocked
Check that test files follow the project’s naming conventions (backend: test_*.py; frontend: *.test.ts/tsx)
Verify that tests actually exercise the new or changed functionality, not placeholder assertions
Test files should have descriptive test function names explaining what is being tested
Organize tests logically with proper setup and teardown
Include edge cases and error conditions for comprehensive coverage
Verify tests cover both positive (success) and negative (failure) scenarios
Ensure tests are not mere smoke tests; they should validate behavior thoroughly
Ensure tests follow the project’s testing frameworks (pytest for backend, Playwright for frontend)

Files:

  • src/lfx/tests/unit/cli/test_run_starter_projects.py
  • src/lfx/tests/unit/test_error_transaction_logging.py
**/test_*.py

📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)

**/test_*.py: Backend tests must be named test_*.py and use proper pytest structure (fixtures, assertions)
For async backend code, use proper pytest async patterns (e.g., pytest-asyncio)
For API endpoints, include tests for both success and error responses

Files:

  • src/lfx/tests/unit/cli/test_run_starter_projects.py
  • src/lfx/tests/unit/test_error_transaction_logging.py
{src/backend/**/*.py,tests/**/*.py,Makefile}

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code

Files:

  • src/backend/base/langflow/services/database/models/transactions/crud.py
  • src/backend/base/langflow/services/database/models/transactions/model.py
  • src/backend/base/langflow/api/v1/monitor.py
  • src/backend/tests/integration/utils.py
src/backend/base/langflow/services/database/models/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

Place database models in src/backend/base/langflow/services/database/models/

Files:

  • src/backend/base/langflow/services/database/models/transactions/crud.py
  • src/backend/base/langflow/services/database/models/transactions/model.py
src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx}: Frontend test files should be located in 'src/frontend/' and use '.test.{ts,tsx,js,jsx}' or '.spec.{ts,tsx,js,jsx}' extensions.
Test both sync and async code paths in frontend test files.
Mock external dependencies appropriately in frontend test files to isolate unit tests from external services.
Test error handling and edge cases in frontend test files.
Validate input/output behavior and test component initialization and configuration in frontend test files.
Each frontend test should have a clear description or comment explaining its purpose, especially for complex setups or mocks.

Files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
src/backend/tests/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

src/backend/tests/**/*.py: Unit tests for backend code must be located in the 'src/backend/tests/' directory, with component tests organized by component subdirectory under 'src/backend/tests/unit/components/'.
Test files should use the same filename as the component under test, with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').
Use the 'client' fixture (an async httpx.AsyncClient) for API tests in backend Python tests, as defined in 'src/backend/tests/conftest.py'.
When writing component tests, inherit from the appropriate base class in 'src/backend/tests/base.py' (ComponentTestBase, ComponentTestBaseWithClient, or ComponentTestBaseWithoutClient) and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping'.
Each test in backend Python test files should have a clear docstring explaining its purpose, and complex setups or mocks should be well-commented.
Test both sync and async code paths in backend Python tests, using '@pytest.mark.asyncio' for async tests.
Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.
Test error handling and edge cases in backend Python tests, including using 'pytest.raises' and asserting error messages.
Validate input/output behavior and test component initialization and configuration in backend Python tests.
Use the 'no_blockbuster' pytest marker to skip the blockbuster plugin in tests when necessary.
Be aware of ContextVar propagation in async tests; test both direct event loop execution and 'asyncio.to_thread' scenarios to ensure proper context isolation.
Test error handling by mocking internal functions using monkeypatch in backend Python tests.
Test resource cleanup in backend Python tests by using fixtures that ensure proper initialization and cleanup of resources.
Test timeout and performance constraints in backend Python tests using 'asyncio.wait_for' and timing assertions.
Test Langflow's Messag...

Files:

  • src/backend/tests/integration/utils.py
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

docs/**/*.{md,mdx}: All Markdown/MDX pages must start with front matter including at least title and description; include sidebar_position for docs pages when applicable
Code blocks must specify a language and may include a title (```lang title="…")
Use sentence case for headings and keep paragraphs short and scannable
Write in second person, present tense, with a professional but approachable tone
Use inline code with backticks for code terms; use bold for UI elements and italics for emphasis; keep lists in parallel structure
Ensure internal links are functional and navigation works (update cross-references as needed)
Verify all code examples in docs and blog actually run as shown
Use correct terminology capitalization: Langflow, Component, Flow, API, JSON
Reference images with absolute paths under /img/... and provide descriptive alt text

Files:

  • docs/docs/Develop/logging.mdx
docs/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Use Docusaurus admonitions (:::+tip|warning|danger) instead of custom callouts in docs pages

Files:

  • docs/docs/Develop/logging.mdx
🧠 Learnings (37)
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Applies to src/frontend/src/components/**/@(FlowGraph|nodes)/**/*.{ts,tsx,js,jsx} : Use React Flow for flow graph visualization components.

Applied to files:

  • src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx
  • src/frontend/src/components/core/logCanvasControlsComponent/index.tsx
  • src/frontend/src/modals/flowLogsModal/index.tsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.

Applied to files:

  • src/frontend/src/modals/flowLogsModal/index.tsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: React Flow should be used for flow graph visualization, with nodes and edges passed as props, and changes handled via onNodesChange and onEdgesChange callbacks.

Applied to files:

  • src/frontend/src/modals/flowLogsModal/index.tsx
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Starter project files auto-format after langflow run; these formatting changes can be committed or ignored

Applied to files:

  • src/lfx/tests/unit/cli/test_run_starter_projects.py
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.

Applied to files:

  • src/lfx/tests/unit/cli/test_run_starter_projects.py
  • docs/docs/Develop/logging.mdx
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test backward compatibility across Langflow versions in backend Python tests by mapping component files to supported versions using 'VersionComponentMapping'.

Applied to files:

  • src/lfx/tests/unit/cli/test_run_starter_projects.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/base/langflow/services/database/models/**/*.py : Place database models in src/backend/base/langflow/services/database/models/

Applied to files:

  • src/backend/base/langflow/services/database/models/transactions/crud.py
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.

Applied to files:

  • src/lfx/src/lfx/graph/utils.py
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase uses structlog for structured logging with a centralized configuration in `src/backend/base/langflow/logging/logger.py`. The configuration supports multiple output formats (JSON, CSV, console) based on environment settings and properly implements global log level filtering.

Applied to files:

  • src/lfx/src/lfx/graph/utils.py
  • docs/docs/Develop/logging.mdx
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx} : Validate input/output behavior and test component initialization and configuration in frontend test files.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx} : Test error handling and edge cases in frontend test files.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/{test_*.py,*.test.ts,*.test.tsx} : Verify that tests actually exercise the new or changed functionality, not placeholder assertions

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx} : Each frontend test should have a clear description or comment explaining its purpose, especially for complex setups or mocks.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx} : Test both sync and async code paths in frontend test files.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/frontend/**/*.@(test|spec).{ts,tsx,js,jsx} : Mock external dependencies appropriately in frontend test files to isolate unit tests from external services.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-18T18:25:54.487Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.487Z
Learning: Applies to src/backend/tests/unit/**/*.py : Test component integration within flows using create_flow, build_flow, and get_build_events utilities

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/backend/tests/integration/utils.py
  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/{test_*.py,*.test.ts,*.test.tsx} : Verify tests cover both positive (success) and negative (failure) scenarios

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test flows using predefined JSON data and utility functions such as 'create_flow', 'build_flow', 'get_build_events', and 'consume_and_assert_stream' in backend Python tests.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/{test_*.py,*.test.ts,*.test.tsx} : Organize tests logically with proper setup and teardown

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-modal.spec.ts
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test Langflow's Message objects and chat functionality in backend Python tests by asserting correct instantiation and property values.

Applied to files:

  • src/backend/base/langflow/api/v1/monitor.py
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/*.test.{ts,tsx} : Frontend tests should be named *.test.ts or *.test.tsx and use Playwright

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/{test_*.py,*.test.ts,*.test.tsx} : Ensure tests are not mere smoke tests; they should validate behavior thoroughly

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-10-23T19:53:43.132Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-10-23T19:53:43.132Z
Learning: Applies to **/{test_*.py,*.test.ts,*.test.tsx} : Ensure tests follow the project’s testing frameworks (pytest for backend, Playwright for frontend)

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Frontend tests should be written using testing-library/react, with both component and integration tests verifying rendering, user interaction, and data loading.

Applied to files:

  • src/frontend/tests/extended/features/flow-logs-pagination.spec.ts
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/base/langflow/components/**/*.py : Use asyncio.create_task for background work in async components and ensure proper cleanup on cancellation

Applied to files:

  • src/backend/tests/integration/utils.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Be aware of ContextVar propagation in async tests; test both direct event loop execution and 'asyncio.to_thread' scenarios to ensure proper context isolation.

Applied to files:

  • src/backend/tests/integration/utils.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test resource cleanup in backend Python tests by using fixtures that ensure proper initialization and cleanup of resources.

Applied to files:

  • src/backend/tests/integration/utils.py
📚 Learning: 2025-07-18T18:25:54.487Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.487Z
Learning: Applies to src/backend/base/langflow/components/**/*.py : Use asyncio.Queue for non-blocking queue operations in async components and handle timeouts appropriately

Applied to files:

  • src/backend/tests/integration/utils.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test timeout and performance constraints in backend Python tests using 'asyncio.wait_for' and timing assertions.

Applied to files:

  • src/backend/tests/integration/utils.py
📚 Learning: 2025-09-30T00:09:51.631Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-09-30T00:09:51.631Z
Learning: Applies to docs/**/*.{md,mdx} : Use correct terminology capitalization: Langflow, Component, Flow, API, JSON

Applied to files:

  • docs/docs/Develop/logging.mdx
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test error handling by mocking internal functions using monkeypatch in backend Python tests.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Create comprehensive unit tests for all new components

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test error handling and edge cases in backend Python tests, including using 'pytest.raises' and asserting error messages.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test component configuration updates in backend Python tests by asserting correct updates to build configuration objects.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Validate input/output behavior and test component initialization and configuration in backend Python tests.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
📚 Learning: 2025-08-05T22:51:27.961Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-05T22:51:27.961Z
Learning: The TestComposioComponentAuth test in src/backend/tests/unit/components/bundles/composio/test_base_composio.py demonstrates proper integration testing patterns for external API components, including real API calls with mocking for OAuth completion, comprehensive resource cleanup, and proper environment variable handling with pytest.skip() fallbacks.

Applied to files:

  • src/lfx/tests/unit/test_error_transaction_logging.py
🧬 Code graph analysis (11)
src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx (2)
src/frontend/src/utils/utils.ts (1)
  • convertUTCToLocalTimezone (883-886)
src/frontend/src/modals/dictAreaModal/index.tsx (1)
  • DictAreaModal (8-136)
src/frontend/src/modals/flowLogsModal/index.tsx (3)
src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx (1)
  • createFlowLogsColumns (5-142)
src/frontend/src/utils/utils.ts (2)
  • convertUTCToLocalTimezone (883-886)
  • cn (38-40)
src/frontend/src/components/common/paginatorComponent/index.tsx (1)
  • PaginatorComponent (18-110)
src/backend/base/langflow/services/database/models/transactions/crud.py (1)
src/backend/base/langflow/services/database/models/transactions/model.py (2)
  • TransactionLogsResponse (72-91)
  • TransactionTable (62-64)
src/lfx/src/lfx/graph/utils.py (3)
src/lfx/src/lfx/graph/vertex/base.py (1)
  • Vertex (46-846)
src/backend/base/langflow/services/database/models/transactions/model.py (1)
  • TransactionBase (14-59)
src/backend/base/langflow/services/deps.py (1)
  • session_scope (162-184)
src/frontend/tests/extended/features/flow-logs-modal.spec.ts (1)
src/frontend/tests/utils/await-bootstrap-test.ts (1)
  • awaitBootstrapTest (4-49)
src/backend/base/langflow/services/database/models/transactions/model.py (1)
src/backend/base/langflow/serialization/serialization.py (3)
  • get_max_items_length (37-39)
  • get_max_text_length (31-33)
  • serialize (253-305)
src/backend/base/langflow/api/v1/monitor.py (2)
src/backend/base/langflow/services/database/models/transactions/crud.py (1)
  • transform_transaction_table_for_logs (86-92)
src/backend/base/langflow/services/database/models/transactions/model.py (2)
  • TransactionLogsResponse (72-91)
  • TransactionTable (62-64)
src/lfx/src/lfx/graph/vertex/base.py (2)
src/lfx/src/lfx/graph/utils.py (1)
  • log_transaction (108-211)
src/lfx/src/lfx/custom/custom_component/custom_component.py (2)
  • user_id (189-192)
  • flow_id (195-196)
src/frontend/tests/extended/features/flow-logs-pagination.spec.ts (1)
src/frontend/tests/utils/await-bootstrap-test.ts (1)
  • awaitBootstrapTest (4-49)
src/backend/tests/integration/utils.py (1)
src/backend/base/langflow/processing/process.py (1)
  • run_graph_internal (26-62)
src/lfx/tests/unit/test_error_transaction_logging.py (1)
src/lfx/src/lfx/graph/utils.py (1)
  • _vertex_to_primitive_dict (95-105)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (22)
  • GitHub Check: Test Docs Build / Test Docs Build
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
  • GitHub Check: Lint Backend / Run Mypy (3.11)
  • GitHub Check: Lint Backend / Run Mypy (3.10)
  • GitHub Check: Lint Backend / Run Mypy (3.12)
  • GitHub Check: Run Frontend Unit Tests / Frontend Jest Unit Tests
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Run Backend Tests / Test CLI - Python 3.10
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Test Starter Templates
  • GitHub Check: Update Component Index
  • GitHub Check: Run Ruff Check and Format
  • GitHub Check: Update Starter Projects
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: autofix
  • GitHub Check: Ruff Style Check (3.13)
🔇 Additional comments (15)
src/lfx/src/lfx/cli/run.py (2)

161-163: LGTM: Proper initialization of stdout/stderr capture.

Initializing the original stdout/stderr at the start of the function ensures they're available for restoration in all exception handlers and the finally block.


471-475: LGTM: Robust cleanup in finally block.

The finally block properly ensures stdout/stderr are restored even if output_error or other cleanup operations fail. The conditional checks prevent errors if restoration has already occurred.

src/lfx/tests/unit/cli/test_run_starter_projects.py (2)

9-9: LGTM: Import added for regex functionality.

The re module is properly imported to support the new regex-based error detection patterns added below.


192-205: LGTM: Improved error detection with regex patterns.

The regex-based approach more precisely identifies langflow/lfx import errors while correctly excluding:

  • External dependencies (langchain_*)
  • Runtime errors (lfx.services)

This reduces false positives compared to simple string matching.

src/backend/tests/integration/utils.py (3)

157-182: LGTM: Comprehensive async task cleanup.

The cleanup function properly handles:

  • Graph-level trace ending tasks
  • Vertex-level transaction logging tasks
  • Exception handling via return_exceptions=True

This prevents task leaks during test execution.


137-146: LGTM: Proper cleanup in run_flow.

The try/finally block ensures background tasks are awaited even if graph execution fails, preventing task leak warnings in tests.


217-226: LGTM: Proper cleanup in run_single_component.

Consistent with run_flow, this ensures all background tasks complete before the function returns.

src/frontend/src/components/core/logCanvasControlsComponent/index.tsx (1)

18-18: LGTM: Test selector added.

The test ID enables reliable E2E test interaction with the flow logs modal trigger.

src/frontend/tests/utils/adjust-screen-view.ts (1)

34-35: LGTM: Improved dropdown closure mechanism.

Clicking the body element to close the dropdown is more reliable and better simulates actual user interaction than clicking the dropdown element itself.

docs/docs/Develop/logging.mdx (1)

24-24: Verify the updated Windows log path.

The Windows log storage path has been updated from AppData\Roaming\com.LangflowDesktop\cache to AppData\Local\com.LangflowDesktop\logs. Please confirm this is the correct location where Langflow Desktop actually stores logs on Windows.

According to the PR description, the contributor found logs at this new location but requested verification from @mendonk. If possible, verify this on a Windows installation of Langflow Desktop to ensure the documentation accurately reflects the actual log location.

Also applies to: 64-64

src/frontend/tests/extended/features/flow-logs-pagination.spec.ts (3)

59-70: LGTM: Robust timestamp sorting verification.

The test properly verifies that timestamps are sorted in descending order (newest first) by converting to Date objects and comparing millisecond values.


73-88: LGTM: Conditional pagination testing.

The test properly handles the case where pagination controls may or may not be visible, only testing pagination when the controls are actually present.


166-178: LGTM: Comprehensive success and error log verification.

The test properly verifies both SUCCESS and ERROR log entries appear in the modal, and confirms error text is visible.

src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx (2)

5-27: LGTM: Well-structured ID column.

The ID column properly handles truncation with a title attribute for full text display on hover.


74-96: LGTM: DictAreaModal integration for complex objects.

The Inputs and Outputs columns properly use DictAreaModal to display structured data, with JSON stringification for inline display and full object access in the modal.

Also applies to: 97-119

Comment on lines +36 to +39
valueFormatter: (params) => {
if (!params.value) return "";
return convertUTCToLocalTimezone(params.value);
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify timestamp conversion isn't duplicated.

The AI summary mentions that the Flow Logs modal processes data.rows to localize timestamps via convertUTCToLocalTimezone before setting row data. If timestamps are already converted before being passed to the grid, this valueFormatter would apply the conversion a second time, potentially causing incorrect display.

Verify whether timestamps are pre-converted before being set as row data. If so, this formatter should be removed:


🏁 Script executed:

#!/bin/bash
# Check if timestamps are converted before being passed to the grid
rg -n "convertUTCToLocalTimezone" -A 3 -B 3 --type=tsx --type=ts

Length of output: 27


I'll search the codebase with corrected syntax to find all usages of convertUTCToLocalTimezone and trace the data flow.


🏁 Script executed:

#!/bin/bash
# Search for convertUTCToLocalTimezone usage with correct rg syntax
rg -n "convertUTCToLocalTimezone" -A 3 -B 3 -g "*.ts" -g "*.tsx" -g "*.js" -g "*.jsx"

Length of output: 3190


🏁 Script executed:

#!/bin/bash
# Find the flowLogsModal component and where it processes data
rg -n "flowLogsModal\|data\.rows" -A 3 -B 3 -g "*.ts" -g "*.tsx" -g "*.js" -g "*.jsx" | head -100

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for where row data is set in flow logs context
rg -n "setRowData\|rows.*=" -A 2 -B 2 -g "*.ts" -g "*.tsx" --type-list | grep -E "(flowLog|Flow)" -A 2 -B 2

Length of output: 389


🏁 Script executed:

#!/bin/bash
# Check the flowLogsModal component more directly
fd -e tsx -e ts -e jsx -e js | xargs grep -l "flowLogsModal\|FlowLogsModal" | head -10

Length of output: 5234


🏁 Script executed:

#!/bin/bash
# Look for the flowLogsModal directory structure
fd "flowLogsModal" -type d

Length of output: 170


🏁 Script executed:

#!/bin/bash
# List contents of the flowLogsModal directory
find . -path "*flowLogsModal*" -type f -name "*.tsx" -o -path "*flowLogsModal*" -type f -name "*.ts" | head -20

Length of output: 116


🏁 Script executed:

#!/bin/bash
# Search for data processing before grid setup, focusing on timestamps
rg -n "data\.rows\|setRows\|GridOptions" -B 5 -A 5 -g "*.tsx" -g "*.ts" | grep -C 5 "convertUTC\|timestamp\|rows"

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Directly examine the config file and related modal files
cat src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx

Length of output: 3675


🏁 Script executed:

#!/bin/bash
# Look for the main FlowLogsModal component
fd -type f -name "*[Ff]low*[Ll]ogs*[Mm]odal*" -g "*.tsx"

Length of output: 170


🏁 Script executed:

#!/bin/bash
# Search in the flowLogsModal directory for all tsx files
find . -path "*flowLogsModal*" -name "*.tsx" -exec cat {} \;

Length of output: 8212


🏁 Script executed:

#!/bin/bash
# Try a simpler approach - list all files, then examine the modal
find . -type f -path "*flowLogsModal*" 2>/dev/null

Length of output: 116


🏁 Script executed:

#!/bin/bash
# Search for how data is prepared in the entire modal directory
rg "convertUTCToLocalTimezone" --max-count 100 -g "*.ts*"

Length of output: 568


🏁 Script executed:

#!/bin/bash
# Use fd with exec to examine flow log files
fd "flowLog" --exec cat {} \;

Length of output: 7603


🏁 Script executed:

#!/bin/bash
# More targeted: look for the main modal component and row data setup
rg -n "setRows\|data\.rows.*map" -B 3 -A 5

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Find all flow logs related files
fd -e tsx -e ts | xargs grep -l "flowLog" 2>/dev/null

Length of output: 749


🏁 Script executed:

#!/bin/bash
# Examine the file directly first
cat "src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx" 2>/dev/null || echo "File not found, searching..."
fd "flowLogsColumns" 2>/dev/null

Length of output: 3740


🏁 Script executed:

#!/bin/bash
# Look for where the grid gets its data in the flow logs modal
find . -name "*.tsx" -o -name "*.ts" | xargs grep -l "flowLogs" | head -5

Length of output: 4972


🏁 Script executed:

#!/bin/bash
# Find and examine the FlowLogsModal component
find . -type d -name "flowLogsModal" 2>/dev/null && ls -la ./src/frontend/src/modals/flowLogsModal/ 2>/dev/null

Length of output: 269


🏁 Script executed:

#!/bin/bash
# Direct cat of the columns config
ls -la src/frontend/src/modals/flowLogsModal/config/ 2>/dev/null || find . -name "flowLogsColumns.tsx" 2>/dev/null

Length of output: 179


Remove duplicate timestamp conversion in valueFormatter.

The timestamp is already converted to local timezone before being passed to the grid (src/frontend/src/modals/flowLogsModal/index.tsx, lines 43-47). Applying convertUTCToLocalTimezone again in the valueFormatter (lines 36-39) causes a second conversion, treating the already-localized timestamp as UTC, resulting in incorrect display.

valueFormatter: (params) => {
  if (!params.value) return "";
  return params.value;
},
🤖 Prompt for AI Agents
In src/frontend/src/modals/flowLogsModal/config/flowLogsColumns.tsx around lines
36 to 39, the valueFormatter currently calls convertUTCToLocalTimezone on a
timestamp that has already been converted upstream; remove that duplicate
conversion and have the formatter return the incoming params.value (or an empty
string when falsy) so the grid displays the already-localized timestamp
correctly.

Comment on lines +42 to +47
const processedRows =
rows?.length > 0
? rows.map((row: any) => ({
...row,
timestamp: convertUTCToLocalTimezone(row.timestamp),
}))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Prevent double timezone conversion on timestamps.

createFlowLogsColumns() already formats the Timestamp column with convertUTCToLocalTimezone. Pre-converting row data here feeds a local-only string back into the same formatter, which treats it as UTC and shifts it again (e.g., EDT timestamps move four hours backwards). Persist the original UTC value and let the column formatter handle the conversion once.

-          ? rows.map((row: any) => ({
-              ...row,
-              timestamp: convertUTCToLocalTimezone(row.timestamp),
-            }))
+          ? rows.map((row: any) => ({
+              ...row,
+              timestamp: row.timestamp,
+            }))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const processedRows =
rows?.length > 0
? rows.map((row: any) => ({
...row,
timestamp: convertUTCToLocalTimezone(row.timestamp),
}))
const processedRows =
rows?.length > 0
? rows.map((row: any) => ({
...row,
timestamp: row.timestamp,
}))
🤖 Prompt for AI Agents
In src/frontend/src/modals/flowLogsModal/index.tsx around lines 42 to 47, the
code pre-converts row.timestamp with convertUTCToLocalTimezone which causes a
double timezone conversion because the Timestamp column formatter already
converts UTC to local; remove the timestamp mapping so processedRows preserves
the original UTC timestamp (or simply use rows as-is or only map other
non-timestamp fields), and ensure the column formatter alone performs
convertUTCToLocalTimezone once when rendering.

Comment on lines +110 to +143
@pytest.mark.asyncio
async def test_vertex_build_error_logging_integration():
"""Test that vertex build errors trigger transaction logging."""
# This is a simplified integration test focused on the error logging mechanism

# Mock the log_transaction function to verify it gets called
with patch("lfx.graph.utils.log_transaction") as mock_log_transaction:
mock_log_transaction.return_value = None

# Mock a vertex with the minimum required attributes
mock_vertex = Mock()
mock_vertex.id = "test-vertex"
mock_vertex.display_name = "TestVertex"
mock_vertex._reset = Mock()
mock_vertex.finalize_build = Mock()
mock_vertex.get_requester_result = AsyncMock(return_value="result")
mock_vertex.lock = AsyncMock().__aenter__.return_value

# Mock the graph with flow_id
mock_graph = Mock()
mock_graph.flow_id = "test-flow"
mock_vertex.graph = mock_graph

# Import and patch the _build method

# Test error logging by directly calling log_transaction with error
error = ValueError("Test build error")

await log_transaction(flow_id="test-flow", source=mock_vertex, status="error", target=None, error=error)

# Verify log_transaction was called (it should complete without throwing)
# The function should handle the error gracefully and log debug info
assert True # Test passes if no exception was thrown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix ineffective patch and assert the log call

log_transaction is imported at module scope, so patching lfx.graph.utils.log_transaction inside this test does not replace the locally bound symbol. The test ends up invoking the real implementation (with all external dependencies) and never asserts that logging was triggered—it just finishes with assert True. Please patch the symbol actually used in this module (or call through the patched module attribute) and add an assertion so we know the logging path executes. For example:

-    with patch("lfx.graph.utils.log_transaction") as mock_log_transaction:
+    with patch(
+        "src.lfx.tests.unit.test_error_transaction_logging.log_transaction",
+        new_callable=AsyncMock,
+    ) as mock_log_transaction:
         ...
-        await log_transaction(flow_id="test-flow", source=mock_vertex, status="error", target=None, error=error)
-
-        # Verify log_transaction was called (it should complete without throwing)
-        # The function should handle the error gracefully and log debug info
-        assert True  # Test passes if no exception was thrown
+        await log_transaction(flow_id="test-flow", source=mock_vertex, status="error", target=None, error=error)
+        mock_log_transaction.assert_awaited_once()

This keeps the test isolated and actually validates the behavior it describes.

@andifilhohub andifilhohub deleted the docs-update branch October 30, 2025 20:19
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