Skip to content

Commit

Permalink
Address user feedback (#80)
Browse files Browse the repository at this point in the history
* Update deps

* Tweak repro step text

* Exclude minified files since failures are relatively low priority

* Display a warning if not all repos were processed

* Add a table for investigation notes
  • Loading branch information
amcasey committed Oct 5, 2022
1 parent f694388 commit c61b0ca
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 13 deletions.
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -14,7 +14,7 @@
"@octokit/rest": "^16.43.2",
"@typescript/github-link": "^0.2.1",
"@typescript/server-harness": "^0.3.4",
"@typescript/server-replay": "^0.2.10",
"@typescript/server-replay": "^0.2.11",
"glob": "^7.2.3",
"json5": "^2.2.1",
"random-seed": "^0.3.0",
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Expand Up @@ -332,9 +332,10 @@ ${fs.readFileSync(replayScriptPath, { encoding: "utf-8" }).split(/\r?\n/).slice(
}

// The URL of the artifact can be determined via AzDO REST APIs, but not until after the artifact is published
summary += `<li>Download <code>${replayScriptArtifactPath}</code> from the <a href="${artifactFolderUrlPlaceholder}">artifact folder</a></li>\n`;
summary += `<li>Back in the initial folder, download <code>${replayScriptArtifactPath}</code> from the <a href="${artifactFolderUrlPlaceholder}">artifact folder</a></li>\n`;
summary += `<li><code>npm install --no-save @typescript/server-replay</code></li>\n`;
summary += `<li><code>npx tsreplay ./${repo.name} ./${replayScriptName} path/to/tsserver.js</code></li>\n`;
summary += `<li><code>npx tsreplay --help</code> to learn about helpful switches for debugging, logging, etc</li>\n`;

summary += `</ol>
</details>
Expand Down
34 changes: 31 additions & 3 deletions src/postGithubIssue.ts
Expand Up @@ -51,23 +51,51 @@ const title = entrypoint === "tsserver"
const description = entrypoint === "tsserver"
? `The following errors were reported by ${newTscResolvedVersion}`
: `The following errors were reported by ${newTscResolvedVersion}, but not by ${oldTscResolvedVersion}`;
const header = `${description}
let header = `${description}
[Pipeline that generated this bug](https://typescript.visualstudio.com/TypeScript/_build?definitionId=48)
[Logs for the pipeline run](${logUri})
[File that generated the pipeline](https://github.com/microsoft/typescript-error-deltas/blob/main/azure-pipelines-gitTests.yml)
This run considered ${repoCount} popular TS repos from GH (after skipping the top ${repoStartIndex}).
<details>
<summary>Successfully analyzed ${analyzedCount} of ${totalCount} visited repos</summary>
<summary>Successfully analyzed ${analyzedCount} of ${totalCount} visited repos${totalCount < +repoCount ? ` (:warning: expected ${repoCount})` : ""}</summary>
| Outcome | Count |
|---------|-------|
${Object.keys(statusCounts).sort().map(status => `| ${status} | ${statusCounts[status as RepoStatus]} |\n`).join("")}
</details>`;
</details>
## Investigation Status
| Repo | Errors | Outcome |
|------|--------|---------|
`;

const resultPaths = pu.glob(resultDirPath, `**/*.${resultFileNameSuffix}`).sort((a, b) => path.basename(a).localeCompare(path.basename(b)));
const outputs = resultPaths.map(p => fs.readFileSync(p, { encoding: "utf-8" }).replace(new RegExp(artifactFolderUrlPlaceholder, "g"), artifactsUri));

for (let i = 0; i < outputs.length; i++) {
const resultPath = resultPaths[i];
const output = outputs[i];

const fileName = path.basename(resultPath);
const repoString = fileName.substring(0, fileName.length - resultFileNameSuffix.length - 1);
const repoName = repoString.replace(".", "/"); // The owner *probably* doesn't have a dot in it

let errorCount = 0;
if (entrypoint === "tsserver") {
errorCount = 1;
}
else {
const re = /^\W*error TS\d+/gm;
while (re.exec(output)) {
errorCount++;
}
}

header += `|${repoName}|${errorCount}| |\n`;
}


const bodyChunks = [header, ...outputs];
git.createIssue(postResult, title, bodyChunks, /*sawNewErrors*/ !!outputs.length);
2 changes: 1 addition & 1 deletion src/utils/exerciseServer.ts
Expand Up @@ -60,7 +60,7 @@ export async function exerciseServer(testDir: string, replayScriptPath: string,

async function exerciseServerWorker(testDir: string, tsserverPath: string, replayScriptHandle: fs.promises.FileHandle, requestTimes: Record<string, number>, requestCounts: Record<string, number>): Promise<void> {
const files = await (new Promise<string[]>((resolve, reject) => {
glob("**/*.@(ts|tsx|js|jsx)", { cwd: testDir, absolute: false, ignore: ["**/node_modules/**"], nodir: true, follow: false }, (err, results) => {
glob("**/*.@(ts|tsx|js|jsx)", { cwd: testDir, absolute: false, ignore: ["**/node_modules/**", "**/*.min.js"], nodir: true, follow: false }, (err, results) => {
if (err) {
reject(err);
}
Expand Down

0 comments on commit c61b0ca

Please sign in to comment.