querysub 0.501.0 → 0.503.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -177,7 +177,7 @@ let moduleResolver = async (spec: {
|
|
|
177
177
|
await executeCommand("git", ["reset", "--hard", spec.gitRef], { cwd: repoPath });
|
|
178
178
|
|
|
179
179
|
// Yarn install
|
|
180
|
-
await executeCommand("yarn", ["install"], { cwd: repoPath });
|
|
180
|
+
await executeCommand("yarn", ["install", "--mutex", "network"], { cwd: repoPath });
|
|
181
181
|
|
|
182
182
|
// Delete querysub, and replace it with a symlink. Otherwise the synchronization code
|
|
183
183
|
// will run again, and a lot of setup code will run again, etc, and nothing will work correctly.
|
|
@@ -743,7 +743,7 @@ const resyncServicesBase = runInSerial(measureWrap(async function resyncServices
|
|
|
743
743
|
let nodeModulesMissing = !await fsExistsAsync(gitFolder + "node_modules");
|
|
744
744
|
if (afterGitRef !== prevGitRef || nodeModulesMissing) {
|
|
745
745
|
console.log(green(`Yarn installing for ${magenta(screenName)} (ref ${prevGitRef} -> ${afterGitRef}, nodeModulesMissing=${nodeModulesMissing})`));
|
|
746
|
-
await runPromise(`yarn install`, { cwd: gitFolder });
|
|
746
|
+
await runPromise(`yarn install --mutex network`, { cwd: gitFolder });
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
let parameterPath = folder + "/parameters.json";
|
|
@@ -136,7 +136,7 @@ class MachineControllerBase {
|
|
|
136
136
|
gitFolder,
|
|
137
137
|
gitRef: config.gitRef,
|
|
138
138
|
});
|
|
139
|
-
await runPromise("yarn install", { cwd: gitFolder });
|
|
139
|
+
await runPromise("yarn install --mutex network", { cwd: gitFolder });
|
|
140
140
|
await runPromise("bash machine-startup.sh", { cwd: os.homedir(), detach: true });
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -172,19 +172,33 @@ async function applyPatch(ticketId: string, commentId: string): Promise<void> {
|
|
|
172
172
|
throw new Error(`Comment ${commentId} is not a patch comment on ticket ${ticketId}`);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
// Relative paths may belong to either the application repo or the querysub repo (a sibling / dependency) — file paths are unique across the two, so whichever one actually has the file wins.
|
|
176
|
+
function resolvePatchFilePath(file: string): { fullPath: string | undefined; candidates: string[] } {
|
|
177
|
+
let candidates = Array.from(new Set([
|
|
178
|
+
path.resolve(process.cwd(), file),
|
|
179
|
+
path.resolve(QUERYSUB_ROOT, file),
|
|
180
|
+
]));
|
|
181
|
+
for (let candidate of candidates) {
|
|
182
|
+
if (fs.existsSync(candidate)) {
|
|
183
|
+
return { fullPath: candidate, candidates };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return { fullPath: undefined, candidates };
|
|
187
|
+
}
|
|
188
|
+
|
|
175
189
|
// Validate everything before writing anything, so a patch is all-or-nothing.
|
|
176
190
|
let writes: { fullPath: string; newContents: string }[] = [];
|
|
177
191
|
for (let patchFile of comment.patchFiles) {
|
|
178
|
-
let fullPath =
|
|
192
|
+
let { fullPath, candidates } = resolvePatchFilePath(patchFile.file);
|
|
179
193
|
if (!patchFile.oldText) {
|
|
180
|
-
if (
|
|
181
|
-
throw new Error(`Patch wants to create ${patchFile.file}, but it already exists and is not empty`);
|
|
194
|
+
if (fullPath && fs.readFileSync(fullPath, "utf8").trim()) {
|
|
195
|
+
throw new Error(`Patch wants to create ${patchFile.file}, but it already exists at ${fullPath} and is not empty`);
|
|
182
196
|
}
|
|
183
|
-
writes.push({ fullPath, newContents: patchFile.newText });
|
|
197
|
+
writes.push({ fullPath: fullPath ?? candidates[0], newContents: patchFile.newText });
|
|
184
198
|
continue;
|
|
185
199
|
}
|
|
186
|
-
if (!
|
|
187
|
-
throw new Error(`Patch targets ${patchFile.file}, which does not exist
|
|
200
|
+
if (!fullPath) {
|
|
201
|
+
throw new Error(`Patch targets ${patchFile.file}, which does not exist. Tried: ${candidates.join(", ")}`);
|
|
188
202
|
}
|
|
189
203
|
let contents = fs.readFileSync(fullPath, "utf8");
|
|
190
204
|
let index = contents.indexOf(patchFile.oldText);
|
|
@@ -532,7 +546,7 @@ PHASE 2 — FIX. Only after you have added your diagnosis comment, decide on the
|
|
|
532
546
|
1. Downgrading logging: when the "error" is not actually an error, patch the logging call site to downgrade it from an error to a warning or a plain log, so it stops being reported.
|
|
533
547
|
2. Actually fixing the broken code.
|
|
534
548
|
3. Gathering more information: if you could NOT determine the root cause from the available logs, propose patches that ADD logging statements to the relevant code paths so the next investigation has the information it needs.
|
|
535
|
-
Each patch file entry is { file, oldText, newText }: oldText must be copied exactly from the current file contents and should be unique within the file; it is replaced with newText. An empty oldText creates a new file. Relative file paths are resolved against the application repository (${process.cwd()})
|
|
549
|
+
Each patch file entry is { file, oldText, newText }: oldText must be copied exactly from the current file contents and should be unique within the file; it is replaced with newText. An empty oldText creates a new file. Relative file paths are resolved against the application repository (${process.cwd()}) first, then against the querysub repository (${QUERYSUB_ROOT}) — whichever contains the file. Absolute paths also work. Keep patches minimal and follow the style of the surrounding code.
|
|
536
550
|
|
|
537
551
|
When you are done, call mcp__autofixer__setTicketState with "code-change" if you proposed patches, or "not-a-bug" if the error should simply be ignored without any code change. If you are confused and just cannot figure out what is going on — the logs and code don't add up, and you can't even propose useful additional logging — add a comment explaining what you tried and what confused you, then call mcp__autofixer__setTicketState with "confused". Do NOT edit files directly — only propose changes through mcp__autofixer__addPatch.
|
|
538
552
|
|