Skip to content

Address user feedback #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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