isCodeFile reads the wrong repo's .gitattributes when the path goes through a symlink
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, typescript
Research direction
Start in LifeOS/install/LIFEOS/TOOLS/IsaGoverning.ts, especially repoRootOf and isCodeFile, and compare their path handling with governingIsa. Run the Bun reproduction in the issue first; done means both direct and symlink paths return false for the documentation file, with the relative path checked against the real repository.
Written by the indexing model from the issue text.
Description
isCodeFile (LifeOS/install/LIFEOS/TOOLS/IsaGoverning.ts:61-63) finds the repo root by walking up the path as given. When a file is reached through a symlink to a folder inside another repository, the walk never meets the real repository's .git, stops at the outer one, and checks that repository's .gitattributes. A path marked linguist-documentation in the real repository is then treated as code, and IsaCodeSyncGate demands an ISA write for every data file edited through the link.
Reproduce on main (94bd8f25), from the clone root:
bun -e '
const fs = require("fs"), os = require("os"), p = require("path");
const { isCodeFile } = require(p.resolve("LifeOS/install/LIFEOS/TOOLS/IsaGoverning.ts"));
const t = fs.mkdtempSync(p.join(os.tmpdir(), "ig-"));
fs.mkdirSync(p.join(t, "real/.git"), { recursive: true });
fs.mkdirSync(p.join(t, "real/USER/data"), { recursive: true });
fs.writeFileSync(p.join(t, "real/.gitattributes"), "USER/data/** linguist-documentation\n");
fs.writeFileSync(p.join(t, "real/USER/data/record.yaml"), "id: 1\n");
fs.mkdirSync(p.join(t, "other/.git"), { recursive: true });
fs.symlinkSync(p.join(t, "real/USER"), p.join(t, "other/USER"));
console.log("direct path: ", isCodeFile(p.join(t, "real/USER/data/record.yaml")));
console.log("via symlink: ", isCodeFile(p.join(t, "other/USER/data/record.yaml")));
fs.rmSync(t, { recursive: true, force: true });'
Output: direct path: false, via symlink: true. Both should be false.
Fix
Which repository a path belongs to is worked out twice in this file, against DRY: governingIsa (line 99) walks up from realish(path), while repoRootOf (line 46), which isCodeFile calls at line 61, walks up from the path as given, so the same file is judged by two different repositories. Starting repoRootOf from realish(path) and taking the relative path at line 63 from the same real path makes isCodeFile read the .gitattributes of the repository the file actually lives in, and the two walks can no longer disagree.
- Dominant language
- TypeScript
- Stars
- 19.9k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from danielmiessler/LifeOS
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
danielmiessler/LifeOS#2894 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
danielmiessler/LifeOS#2891 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
danielmiessler/LifeOS#2886 ·
Maintainers usually reply within 5 days
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
danielmiessler/LifeOS#2848 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
danielmiessler/LifeOS#2635 ·
Maintainers usually reply within 5 days
All issues in danielmiessler/LifeOS
Similar issues
-
ready-for-agent
Difficulty 1/5 Under an hour Newbie friendliness 86/100
LucasSantana-Dev/Lucky#3257 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement frontend good first issue help wanted testing-infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 2 days
-
enhancement follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
obsidian-tasks-group/obsidian-tasks#4155 ·
Maintainers usually reply within 1 day