fix(ls): preserve .env in default output#1508
Open
nghiahsgs wants to merge 1 commit intortk-ai:masterfrom
Open
fix(ls): preserve .env in default output#1508nghiahsgs wants to merge 1 commit intortk-ai:masterfrom
nghiahsgs wants to merge 1 commit intortk-ai:masterfrom
Conversation
`.env` was listed in NOISE_DIRS, so `rtk ls` silently dropped it unless `-a` was passed. This is a data-loss hazard: an agent that scans a project to determine setup state sees no `.env`, assumes the project is unconfigured, and writes a fresh template — clobbering real production secrets. `.env` is configuration, not a build artifact like `node_modules/`, `.git/`, or `target/`. The "Correctness vs Token Savings" principle in CONTRIBUTING.md applies: a few extra tokens are cheap; lost API keys are not. Adds a regression test covering `.env`, `.env.local`, and `.env.example` to ensure they remain visible by default.
|
|
Collaborator
📊 Automated PR Analysis
SummaryRemoves Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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.
Problem
.envis listed inNOISE_DIRS(src/cmds/system/constants.rs), sortk lssilently drops it unless the agent passes-a. This creates a data-loss hazard:rtk lsto scan a project's setup state..env.examplebut no.env..envfrom the template.A user reproduced this directly:
.envis gone from the output. The agent has no way to know it exists.Why this matters
.envis configuration the agent must reason about, not a build artifact likenode_modules/,.git/, ortarget/. The other entries inNOISE_DIRSare regenerable;.envtypically is not.CONTRIBUTING.md's Correctness VS Token Savings principle applies directly:
A few tokens for one filename are cheap. Restoring rotated production credentials is not.
Fix
Remove
.envfromNOISE_DIRS. Sibling entries.env.local,.env.production,.env.examplewere never matched (the filter uses exact equality), so behavior for those is unchanged — they were already visible. This change only restores.envitself.Test
Adds
test_compact_preserves_dotenvcovering.env,.env.local, and.env.exampleto lock in the expected behavior.Scope
Intentionally narrow. Does not touch:
env,.venv,venv(Python virtualenv directories — those are regenerable)ls(see fix(ls): fix empty output on non-English locales, hidden file leaking, and egg-info glob #810)RTK_DISABLED/--rawdiscussions (feat(hooks): add RTK_DISABLED=1 env var to bypass all hooks #1167, feat(cli): add --raw flag for unfiltered command output #1171)Just
.env. One line in constants, one regression test.