Read the allowed folder when a file source names none - #217
Merged
Merged
Conversation
A file-system file source that left its folder blank was refused with "No folder is configured." and ingested nothing: the editor offers the folder as optional and documents an empty value as "read the root itself", so the one setup a reader arrives at with nothing to narrow down was the one that silently did nothing, and the run recorded three zeroes with no visible reason. A blank folder now resolves to the folder the host allows the connector to read, which is the only folder that value could have meant. It is a default only while there is a single allowed root -- with several there is no "the" folder, and picking one would read files nobody pointed the source at, so that case is refused with a message that says to name one. Validation no longer refuses a blank folder ahead of the resolver, so the reason a reader sees is always the resolver's own. The substitution is at resolution time rather than on the record, because a source created by a recipe, an import or the API never passes through the editor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The problem
A
FileSystemfile source that leaves its folder blank is refused with "No folder is configured.", discovers nothing, and recordsPartiallyCompleted / 0 ingested, 0 removed, 0 failed.Blank is the value a host stores when the source is pointed at the allowed root itself, and it is the value an editor that presents the folder as optional produces by default. So the simplest configuration anyone can arrive at — name the source, pick a data source, leave the folder alone — was the one that silently ingested nothing.
The change
FileSystemConnectorOptions.TryResolveRootnow sends a blankrootPathto a new privateTryResolveDefaultRoot, which resolves the single allowed root.It resolves the allowed root rather than
BasePathon purpose: a host setsBasePathto its content root andAllowedRootsto something likeApp_Data/file-sources, so "blank meansBasePath" would resolve outside the boundary and fail just as silently, only with a more confusing reason.It is a default only while there is one allowed root. With several there is no "the" folder, and picking one — the first, say — would read files nobody pointed the source at, so that case is refused with a reason that says to name one. A host that allows none gets the same refusal a named folder gets. Blank entries in
AllowedRootsare not counted.FileSystemIngestionConnector.ValidateAsyncno longer refuses a blank folder ahead of the resolver, so the reason a reader sees is always the resolver's own.The substitution is at resolution time rather than on the record, because a source created by a recipe, an import or the API never passes through an editor.
What is not affected
Containment is untouched. A
..segment is still refused outright before any path is combined, a folder outside every allowed root is still refused, andFetchAsyncstill checks every item id it is handed. The only value whose meaning changed is the empty one, which previously meant "refuse".Tests
Six new tests, and all 70 under
CrestApps.Core.Tests.Core.FileSourcespass:AllowedRootsare ignored when deciding the default🤖 Generated with Claude Code