Add tests for dotenv parsing, append/remove keys, and S3 key tokens#7
Draft
cursor[bot] wants to merge 2 commits intomainfrom
Draft
Add tests for dotenv parsing, append/remove keys, and S3 key tokens#7cursor[bot] wants to merge 2 commits intomainfrom
cursor[bot] wants to merge 2 commits intomainfrom
Conversation
- Exercise parseDotenv, removeDotenvKey, and appendDotenvKey including validation errors and quoting edge cases used by the vault UI. - Round-trip encodeObjectKeyToken/decodeObjectKeyToken for S3 key tokens.
Prevents drift between action and server/UI when .env parsing changes.
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.
Summary
Adds focused Vitest coverage for recently merged
.envhandling and URL-safe S3 object key encoding.Risky behavior now covered
parseDotenv/removeDotenvKey/appendDotenvKey(src/lib/dotenv-parse.ts): comments, CRLF, quoted values, duplicate-key rejection, key/value validation messages, trailing-whitespace handling when appending, and quoting rules for values with spaces or#.encodeObjectKeyToken/decodeObjectKeyToken(src/lib/key-token.ts): round-trip for paths with/,+, and non-ASCII characters (regression guard for URL-safe base64 key handling).parseDotenvvs appparseDotenvon shared fixtures so the action and vault stay aligned.Test files added/updated
src/lib/dotenv-parse.test.ts(new)src/lib/key-token.test.ts(new)src/github-action/dotenv-parse-alignment.test.ts(new)Why this reduces regression risk
Dotenv parsing and append/remove logic directly affect secret plaintext in the UI and server; a subtle parser or formatting bug can drop keys, corrupt values, or allow invalid names. Object key tokens are used across API boundaries; encoding/decoding mistakes break navigation or leak incorrect keys. The parity test catches duplicated parsers drifting apart after a one-sided fix.
Validation
npm run test(Vitest) — all tests pass; deterministic, no network or env dependencies beyond Node.