fix(tui): do not create a directory on keydown for OpenRAG documents path#967
Closed
philnash wants to merge 3 commits into
Closed
fix(tui): do not create a directory on keydown for OpenRAG documents path#967philnash wants to merge 3 commits into
philnash wants to merge 3 commits into
Conversation
philnash
added a commit
to philnash/openrag
that referenced
this pull request
Feb 16, 2026
While fixing langflow-ai#967, I noticed that the other file selector input in this form did not validate that the directory could be written to. This adds the DocumentsPathValidator to the OpenSearch data directory field to match the the documents path.
Merged
Member
Author
|
The integration tests aren't passing, at least for some of them, because embedding fails. This PR doesn't touch embedding at all, so the tests are flaking for some reason. Any ideas? Will this block merging? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the TUI was creating intermediate directories on the filesystem for every keystroke when a user types a custom documents path. The issue was caused by Textual's default behavior of running validators on every input change, which triggered the DocumentsPathValidator that performs filesystem operations including directory creation.
Changes:
- Added
validate_on=["submitted"]parameter to Input widgets usingDocumentsPathValidator - Delays filesystem validation until form submission rather than on every keystroke
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
closing in favor of #968 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
By default Textual runs
Inputvalidators on each change. TheDocumentsPathValidatorattempts to perform some actions on the directory, including creating it if it doesn't exist, to ensure that OpenRAG can write to the selected directory.Doing this on every change means that every keystroke will attempt to find or create the directory on the filesystem, causing many new directories as reported in #892.
Running the validator on submission means that a user will only get feedback about errors in accessing the directory when they submit, but this is preferable over creating many unused directories on their filesystem.
This fixes #892 by delaying the check until the form is submitted. It is likely best to delay file system operations until the user has made a decision, rather than trying over and over as they type.