Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(build): anchor the conflict guard to column 0 so prose cannot fail a deploy

nirholasd7d9035d0deb
diff --git a/scripts/check-merge-conflicts.mjs b/scripts/check-merge-conflicts.mjs
index 67d766418..e969a44ae 100644
--- a/scripts/check-merge-conflicts.mjs
+++ b/scripts/check-merge-conflicts.mjs
@@ -20,10 +20,12 @@
* 500'd every chat request at runtime.
*
* The check is one `git grep` over tracked files, so it costs milliseconds and
- * runs in `build:gcp` before anything is built. Both the opening and the
- * closing marker must be present for a file to be reported, which is what keeps
- * it quiet: a bare `=======` is an ordinary markdown rule, and `<<<<<<<` at the
- * start of a line is never legitimate source.
+ * runs in `build:gcp` and `gate` before anything is built. The opening marker
+ * at the start of a line is the trigger on its own: that is never legitimate
+ * source in any language we ship, and requiring a closing marker too would miss
+ * the interrupted merges (see the `character-studio/.gitignore` note below).
+ * What keeps it quiet is the column-0 anchor, not marker pairing — a bare
+ * `=======` is an ordinary markdown rule and is never matched.
*
* Usage:
* node scripts/check-merge-conflicts.mjs # exits 1 on any marker
@@ -50,7 +52,14 @@ function git(args) {
/** Tracked files carrying `marker` at the start of a line, as a Set of paths. */
function filesWithMarker(marker) {
- const out = git(['grep', '-l', '-F', `${marker} `, '--', '.']);
+ // ANCHORED to column 0. git writes conflict markers only at the start of a
+ // line, so anchoring loses no real conflict — but an unanchored -F search
+ // also matches any file that merely *mentions* a marker in prose, which is
+ // exactly what this script's own test file and the docs describing conflict
+ // resolution do. That false positive failed a production build on
+ // 2026-07-29, and "reword the prose" is the wrong fix: the rule the header
+ // comment already claims (start of a line) is the correct one.
+ const out = git(['grep', '-l', '-E', `^${marker} `, '--', '.']);
return new Set(out.split('\n').filter(Boolean));
}
@@ -74,7 +83,7 @@ if (!conflicted.length) {
console.error(`\ncheck:conflicts — ${conflicted.length} file(s) carry unresolved merge-conflict markers:\n`);
for (const file of conflicted) {
- const hits = git(['grep', '-n', '-F', `${OPEN} `, '--', file])
+ const hits = git(['grep', '-n', '-E', `^${OPEN} `, '--', file])
.split('\n')
.filter(Boolean)
.map((line) => line.slice(file.length + 1).split(':')[0]);
diff --git a/tests/check-merge-conflicts.test.js b/tests/check-merge-conflicts.test.js
index 6e1ae04ce..343a781e4 100644
--- a/tests/check-merge-conflicts.test.js
+++ b/tests/check-merge-conflicts.test.js
@@ -115,6 +115,53 @@ describe('check-merge-conflicts', () => {
rmSync(join(repo, 'scratch.js'));
});
+ it('ignores a marker mentioned mid-line in prose, not at column 0', () => {
+ // git only ever writes conflict markers at the start of a line. An
+ // unanchored fixed-string search also matches any file that merely
+ // *describes* one — this test file, the checker's own header comment, a
+ // doc explaining how to resolve conflicts. That false positive failed a
+ // production build on 2026-07-29. Anchoring is the fix; rewording every
+ // mention of a marker forever is not.
+ writeFileSync(
+ join(repo, 'src', 'prose.js'),
+ [
+ '// The stash pop left `' + OPEN + ' Updated upstream` in three files.',
+ `const note = "${OPEN} HEAD";`,
+ 'export const ok = 1;',
+ '',
+ ].join('\n'),
+ );
+ commitAll(repo);
+ const { code } = runIn(repo);
+ expect(code).toBe(0);
+ rmSync(join(repo, 'src', 'prose.js'));
+ commitAll(repo);
+ });
+
+ it('still catches a real marker at column 0 in the same file as prose', () => {
+ // Anchoring must not become a blind spot: a file that both discusses a
+ // marker and carries a genuine one still has to fail.
+ writeFileSync(
+ join(repo, 'src', 'both.js'),
+ [
+ '// Docs mention `' + OPEN + ' HEAD` inline.',
+ `${OPEN} HEAD`,
+ 'const b = 2;',
+ MID,
+ 'const b = 3;',
+ `${CLOSE} other`,
+ '',
+ ].join('\n'),
+ );
+ commitAll(repo);
+ const { code, stdout } = runIn(repo);
+ expect(code).toBe(1);
+ expect(stdout).toContain('src/both.js');
+ expect(stdout).toContain('line 2');
+ rmSync(join(repo, 'src', 'both.js'));
+ commitAll(repo);
+ });
+
it('this repository is clean', () => {
const { code } = runIn(resolve(dirname(fileURLToPath(import.meta.url)), '..'));
expect(code).toBe(0);