Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(core): retain inline joined documentation readers [V4,C7]

Corey Olson4c14b1bbac69
diff --git a/src/affected-tests.js b/src/affected-tests.js
index c27bd32b..9e113407 100644
--- a/src/affected-tests.js
+++ b/src/affected-tests.js
@@ -116,7 +116,9 @@ function documentationInputs(path, source, imports) {
// Bare "docs" is also a commit type or lane. In a call/path assignment, or a directory
// scanner, it can name an input; a declaration of commit types alone is not a reader.
const callArgument = /[,(]$/u.test(prefix) && prefix.lastIndexOf('(') > prefix.lastIndexOf('[');
- if (value === 'docs' && !callArgument && !/(?<![=!<>])=$/u.test(prefix) && !directoryReader) continue;
+ const joinedArray = prefix.lastIndexOf('[') > prefix.lastIndexOf(']')
+ && /^[^\]]*\]\s*\.join\s*\(/u.test(source.slice(match.index + match[0].length));
+ if (value === 'docs' && !callArgument && !joinedArray && !/(?<![=!<>])=$/u.test(prefix) && !directoryReader) continue;
for (const candidate of [posix.normalize(value), posix.normalize(posix.join(posix.dirname(path),value))]) {
if (candidate === 'docs' || candidate.startsWith('docs/')) inputs.add(candidate.replace(/\/$/u,''));
}
diff --git a/test/affected-tests.test.js b/test/affected-tests.test.js
index 4b0b11f2..766363b3 100644
--- a/test/affected-tests.test.js
+++ b/test/affected-tests.test.js
@@ -105,3 +105,17 @@ test('escaped literal templates select their documentation inputs [V4,C7]', (t)
assert.deepEqual(selectAffectedTests(box.root,{base,commit,changed:['docs/X63.md']}).files,
['test/template-identity.test.js'],'uppercase X is an identity escape, not hexadecimal');
});
+
+
+test('a docs path built inline still selects its reader [V4,C7]', (t) => {
+ const box = graph(t);
+ box.put('test/array-reader.test.js', `import {readFileSync} from 'node:fs'; readFileSync(new URL(['..','docs','api.md'].join('/'),import.meta.url),'utf8');\n`);
+ box.put('test/inline-join.test.js', "import {readFileSync} from 'node:fs'; import {join} from 'node:path'; const root='.',name='api.md'; readFileSync(join(root,'docs',name),'utf8');\n");
+ box.put('test/inline-template.test.js', "import {readFileSync} from 'node:fs'; readFileSync(`do\\x63s/api.md`,'utf8');\n");
+ const base = box.commit();
+ box.put('docs/api.md','# Updated API\n');
+ const commit = box.commit();
+ assert.deepEqual(selectAffectedTests(box.root,{base,commit}).files,
+ ['docs/api.test.js','test/array-reader.test.js','test/inline-join.test.js','test/inline-template.test.js'],
+ 'a joined literal array must retain its documentation reader');
+});