You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…e node
Implement comprehensive document metadata support in Knowledge Base workflow node, allowing users to configure metadata values through both constants and variables.
Backend changes:
- Add DocMetadata model with support for constant values and variable selectors
- Implement metadata processing in KnowledgeIndexNode with variable resolution
- Add batch query optimization to prevent N+1 queries
- Implement metadata validation and binding creation
- Add comprehensive unit tests for node and service layers
Frontend changes:
- Add MetadataSection component with type-aware input controls
- String type: text input
- Number type: number input with validation
- Time type: date picker (Unix timestamp)
- Implement variable filtering based on metadata data type
- String metadata: only string variables
- Number metadata: only number/integer variables
- Time metadata: only time-related number variables (timestamp, *time*, *date*, *at*)
- Add VarReferencePicker with 360px min-width for better UX
- Standardize font size to text-[13px] across all inputs
- Add i18n support for all user-facing strings
Technical improvements:
- Use SQLAlchemy attributes.flag_modified() for JSON field updates
- Optimize logging to follow project standards (warnings and exceptions only)
- Add type safety with proper TypeScript definitions
- Implement proper error handling with user-friendly messages
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix test_delete_metadata_not_found: use pytest.raises() since service
raises ValueError instead of returning None
- Fix test_run_with_custom_metadata: remove mock of _invoke_knowledge_index
that bypassed metadata processing logic, add missing BATCH/ORIGINAL_DOCUMENT_ID
variable mocks, remove redundant side_effect code
- Fix test_save_document_with_dataset_id_ignores_lock_not_owned: add missing
enable_built_in_metadata and doc_metadata attributes to knowledge_config
- Fix test_save_document_with_metadata: add .filter().all() mock chain for
DatasetMetadata query
- Enhance check_metadata_used_in_pipeline to check both draft and current
published workflows (via pipeline.workflow_id) to prevent deletion of
metadata actively used in production
Co-Authored-By: Claude <noreply@anthropic.com>
Add proper input styling (border, rounded corners, background) to the
metadata value container in Knowledge Base node for visual consistency
with other form inputs.
Co-Authored-By: Claude <noreply@anthropic.com>
Rewrite workflow query conditions to avoid type checking error with
list.append() having inconsistent types.
Co-Authored-By: Claude <noreply@anthropic.com>
Mock attributes.flag_modified to avoid SQLAlchemy internal state
requirements. Update assertion to verify flag_modified call instead
of db.session.add call.
- Add system-xs-regular and truncate to date-picker for consistent font size
- Fix value container alignment with w-0 grow overflow-hidden pattern
- Change delete button from × to trash icon with destructive hover
- Align condition-date layout with other condition components
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
DeepSource reviewed changes in the commit range b76c8fa..a4cd1fb on this pull request. Below is the summary for the review, and you can see the individual issues we found as review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. Please see the DeepSource dashboard for this PR to view those issues.
PR Report Card
Security
× 5 issues
Overall PR Quality
Focus Area: Reliability
Guidance Fix the context manager 'NoneType' issues in api/services/dataset_service.py, appearing four times.
Administrators can configure which issue categories are reported and cause analysis to be marked as failed when detected. This helps prevent bad and insecure code from being introduced in the codebase. If you're an administrator, you can modify this in the repository's settings.
💡 If you're a repository administrator, you can configure the quality gates from the settings.
The reason will be displayed to describe this comment to others. Learn more.
`node_data_obj.doc_metadata` used non-iterably in `for` loop
The code attempts to iterate over node_data_obj.doc_metadata with a for loop, assuming it is iterable. If doc_metadata is None or another non-iterable type, this causes a TypeError that crashes execution.
Ensure doc_metadata is always set to an iterable type like a list before the loop. Alternatively, add a check to confirm iterability or provide a default empty iterable to avoid runtime errors.
The reason will be displayed to describe this comment to others. Learn more.
Unused variable `result` wastes memory and confuses
Assigning the output of node._run() to result without using it wastes memory and may confuse developers about its purpose. This unused variable has no effect on program behavior but adds clutter.
Remove the result variable or replace it with _ if the value is intentionally unused to indicate its irrelevance to the program flow.
The variable mock_indexing_task is assigned in the code but never used, which wastes space and can mislead developers about its purpose. This unused variable adds unnecessary noise and maintenance burden.
Rename it to start with _ or _unused, or remove it if not needed to clarify intent and clean the code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.