Conversation
The isTranslationDir function previously only checked if a directory name
was a valid locale code, which caused false positives when any ancestor
directory in the path happened to have a locale-code name (e.g. a username
like 'mr' which is a valid Marathi locale code).
Now isTranslationDir also verifies that the parent directory is named
'translations', matching the expected Knock project structure of
translations/{locale}.
In the translation reader, the translationsIndexDir case already knows it
is iterating within a translations directory, so it uses isValidLocale
directly instead of isTranslationDir (which would fail since the parent
is the translations index dir, not always named 'translations').
Fixes KNO-12176
Co-authored-by: Chris Bell <chris@cjbell.co>
connorlindsey
approved these changes
Mar 20, 2026
Contributor
Author
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.
Description
The
isTranslationDirfunction previously only checked if a directory name was a valid locale code, causing false positives when any ancestor directory in the path had a locale-code name (e.g., a username likemrwhich matches the Marathi locale). This caused non-translation commands likeworkflow:pushto fail withError: Cannot run workflow:push inside a translation directory.Changes:
isTranslationDirinsrc/lib/marshal/translation/helpers.tsto also verify that the parent directory is namedtranslations, matching the expected Knock project structure (translations/{locale})src/lib/marshal/translation/reader.ts), thetranslationsIndexDircase now usesisValidLocaledirectly instead ofisTranslationDir, since it already knows it's iterating within a translations index directorysrc/lib/run-context/loader.tstranslationsparent)Screenshots
Not applicable — this is a logic fix with no UI changes. All 766 tests pass, including 4 updated
isTranslationDirtests.Linear Issue: KNO-12176