mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-19 09:36:59 +03:00
Read the repo-root build path, and stop overstating what a flip forbids
Two findings from Greptile on #579, both about the same key seen from different roots. `appendBuildPathDirective` searched projectRoot and cwd but never repoRoot, while `checkBuildPathUnset` reads both. In a monorepo that committed the preference once at the root, the two disagreed in the worst direction: the staleness finding stayed silent because a value existed, and the directive never named it, so nothing on screen explained why the recorded default was not being honored. Roots are now ordered nearest first, workspace over repo root, with regression tests for both the fallback and the override. The ANSWER line for a flipped path said "never write it to settings". The page indeed never writes it, but the sentence read as a rule and applied itself to new-work's one-time offer, which exists for exactly the case a flip creates: a project with no recorded default, asked once after the round closes. It now states what the page does and names the exception. The same report's first issue also named context.mjs, and that part does not hold: its directive is emitted only when a value is already recorded, which is precisely when session-only is the correct instruction. Left as is. Written with AI assistance (Claude Code). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
65de2d294b
commit
c0e7f2d778
@@ -1094,6 +1094,36 @@ describe('context.mjs CLI', () => {
|
||||
write('.impeccable/config.json', JSON.stringify({ buildPath: 'code-first' }));
|
||||
assert.equal(run().stdout.includes('BUILD_PATH_DEFAULT'), false);
|
||||
});
|
||||
|
||||
// A monorepo commits the preference once at the repo root for every app in
|
||||
// it. Reading only projectRoot left the staleness finding (which does read
|
||||
// both) silent while the directive never named the value.
|
||||
describe('in a monorepo', () => {
|
||||
const writeWorkspace = () => {
|
||||
write('package.json', JSON.stringify({ private: true, workspaces: ['apps/*'] }));
|
||||
write('turbo.json', JSON.stringify({ tasks: {} }));
|
||||
write('PRODUCT.md', '# Root product\n');
|
||||
write('apps/dashboard/src/App.jsx', 'export default function App() { return "d"; }\n');
|
||||
};
|
||||
const runFromWorkspace = () => spawnSync(process.execPath, [SCRIPT_PATH, '--target', 'apps/dashboard/src/App.jsx'], {
|
||||
cwd: scratch,
|
||||
encoding: 'utf8',
|
||||
env: { ...process.env, IMPECCABLE_NO_UPDATE_CHECK: '1', IMPECCABLE_NO_STALENESS_CHECK: '1' },
|
||||
});
|
||||
|
||||
it('falls back to the repo-root value for a workspace that sets none', () => {
|
||||
writeWorkspace();
|
||||
write('.impeccable/config.json', JSON.stringify({ buildPath: 'code' }));
|
||||
assert.match(runFromWorkspace().stdout, /BUILD_PATH_DEFAULT: code/);
|
||||
});
|
||||
|
||||
it('lets the workspace override the repo root, nearest root first', () => {
|
||||
writeWorkspace();
|
||||
write('.impeccable/config.json', JSON.stringify({ buildPath: 'code' }));
|
||||
write('apps/dashboard/.impeccable/config.json', JSON.stringify({ buildPath: 'comp' }));
|
||||
assert.match(runFromWorkspace().stdout, /BUILD_PATH_DEFAULT: comp/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps the manual-detector directive out of early context when the current provider hook is active', () => {
|
||||
|
||||
Reference in New Issue
Block a user