Log file - docs update#10454
Conversation
- 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.
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.
WalkthroughThis 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
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
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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 error, 5 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
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"andtypeof outputs !== "object"will treat arrays as objects (sincetypeof [] === "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
⛔ Files ignored due to path filters (1)
src/frontend/package-lock.jsonis 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.tsxsrc/frontend/src/components/core/logCanvasControlsComponent/index.tsxsrc/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.pysrc/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.pysrc/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.pysrc/backend/base/langflow/services/database/models/transactions/model.pysrc/backend/base/langflow/api/v1/monitor.pysrc/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.pysrc/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.tssrc/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.tsxsrc/frontend/src/components/core/logCanvasControlsComponent/index.tsxsrc/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.pydocs/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.pydocs/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.tssrc/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.tssrc/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.tssrc/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.tssrc/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.tssrc/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.tssrc/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.tssrc/backend/tests/integration/utils.pysrc/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.tssrc/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.tssrc/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
remodule 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=TrueThis 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\cachetoAppData\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
| valueFormatter: (params) => { | ||
| if (!params.value) return ""; | ||
| return convertUTCToLocalTimezone(params.value); | ||
| }, |
There was a problem hiding this comment.
🧩 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=tsLength 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 -100Length 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 2Length 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 -10Length of output: 5234
🏁 Script executed:
#!/bin/bash
# Look for the flowLogsModal directory structure
fd "flowLogsModal" -type dLength 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 -20Length 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.tsxLength 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/nullLength 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 5Length of output: 0
🏁 Script executed:
#!/bin/bash
# Find all flow logs related files
fd -e tsx -e ts | xargs grep -l "flowLog" 2>/dev/nullLength 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/nullLength 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 -5Length 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/nullLength 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/nullLength 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.
| const processedRows = | ||
| rows?.length > 0 | ||
| ? rows.map((row: any) => ({ | ||
| ...row, | ||
| timestamp: convertUTCToLocalTimezone(row.timestamp), | ||
| })) |
There was a problem hiding this comment.
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.
| 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.
| @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 | ||
|
|
There was a problem hiding this comment.
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.
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
Bug Fixes
Documentation