Skip to content

Commit 793b4e4

Browse files
authored
Merge pull request #172 from PostHog/rollback
rollback
2 parents b19d3b7 + d89ae52 commit 793b4e4

File tree

5 files changed

+5
-98
lines changed

5 files changed

+5
-98
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ playwright/.cache/
5858

5959
# Logs
6060
*.log
61-
!apps/**/*.log
6261
logs/
6362
*.tsbuildinfo
6463

services/github/gh-cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import { execSync } from "child_process";
88
import type { PRData, PRFile } from "./types.js";
99

10-
// Files to exclude from PR evaluation (skill instructions and logs, not code changes)
11-
const EXCLUDED_PATH_PATTERNS = [/^.*\/\.claude\//, /^\.claude\//, /wizard-run\.log$/];
10+
// Files to exclude from PR evaluation (skill instructions, not code changes)
11+
const EXCLUDED_PATH_PATTERNS = [/^.*\/\.claude\//, /^\.claude\//];
1212

1313
// ============================================================================
1414
// Shell escaping

services/pr-evaluator/git-local.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {
1818
getCommitMessages,
1919
} from "../github/index.js";
2020

21-
// Files to exclude from PR evaluation (skill instructions and logs, not code changes)
22-
const EXCLUDED_PATH_PATTERNS = [/^.*\/\.claude\//, /^\.claude\//, /wizard-run\.log$/];
21+
// Files to exclude from PR evaluation (skill instructions, not code changes)
22+
const EXCLUDED_PATH_PATTERNS = [/^.*\/\.claude\//, /^\.claude\//];
2323

2424
function isExcludedPath(filepath: string): boolean {
2525
return EXCLUDED_PATH_PATTERNS.some((pattern) => pattern.test(filepath));

services/wizard-ci/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
runEvaluator,
3636
runEvaluatorOnBranch,
3737
createBranch,
38-
saveWizardLogs,
3938
type App,
4039
} from "./utils.js";
4140

@@ -517,7 +516,6 @@ async function runCI(app: App, opts: Options, triggerId: string): Promise<boolea
517516

518517
// 2. Run wizard (always in CI mode)
519518
console.log("[2/5] Running wizard...\n");
520-
const wizardStartTime = new Date();
521519
const result = await runWizard(app.path, { ci: true });
522520
console.log();
523521

@@ -527,12 +525,6 @@ async function runCI(app: App, opts: Options, triggerId: string): Promise<boolea
527525
}
528526
console.log(` Completed in ${formatMs(result.duration)}\n`);
529527

530-
// Save wizard logs to app directory for inclusion in commit
531-
const logFilePath = saveWizardLogs(app.path, wizardStartTime);
532-
if (logFilePath) {
533-
console.log(` Saved logs: wizard-run.log\n`);
534-
}
535-
536528
// 3. Check changes in app directory only
537529
console.log("[3/5] Checking changes...");
538530
if (!hasChangesInPath(repoRoot, appRelativePath)) {

services/wizard-ci/utils.ts

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* This file contains only wizard-ci specific utilities.
66
*/
77
import { spawn } from "child_process";
8-
import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs";
8+
import { existsSync, readdirSync } from "fs";
99
import { join } from "path";
1010

1111
// Re-export git operations from shared service
@@ -276,87 +276,3 @@ export function runEvaluatorOnBranch(options: EvaluateOnBranchOptions): Promise<
276276
});
277277
}
278278

279-
// ============================================================================
280-
// Wizard Log Extraction
281-
// ============================================================================
282-
283-
const WIZARD_LOG_PATH = "/tmp/posthog-wizard.log";
284-
285-
/**
286-
* Extract logs from a specific wizard run based on start time.
287-
* Parses the log file and returns only entries from the run that started
288-
* at or after the given timestamp.
289-
*/
290-
export function extractWizardLogs(runStartTime: Date): string | null {
291-
if (!existsSync(WIZARD_LOG_PATH)) {
292-
return null;
293-
}
294-
295-
try {
296-
const logContent = readFileSync(WIZARD_LOG_PATH, "utf-8");
297-
const lines = logContent.split("\n");
298-
299-
// Add 1 second buffer to account for timing differences between
300-
// when we capture the start time and when the wizard writes its header
301-
const bufferMs = 1000;
302-
const adjustedStartTime = new Date(runStartTime.getTime() - bufferMs);
303-
304-
// Find the run header that matches our start time (or is closest after it)
305-
let captureStart = -1;
306-
let captureEnd = lines.length;
307-
308-
for (let i = 0; i < lines.length; i++) {
309-
// Check for run header pattern (3 lines: separator, timestamp, separator)
310-
if (
311-
lines[i]?.startsWith("=".repeat(60)) &&
312-
lines[i + 1]?.startsWith("PostHog Wizard Run:") &&
313-
lines[i + 2]?.startsWith("=".repeat(60))
314-
) {
315-
const timestampStr = lines[i + 1].replace("PostHog Wizard Run: ", "").trim();
316-
const headerTime = new Date(timestampStr);
317-
318-
// If this header is at or after our adjusted start time, this could be our run
319-
if (headerTime >= adjustedStartTime) {
320-
if (captureStart === -1) {
321-
// First matching header - start capturing from here
322-
captureStart = i;
323-
} else {
324-
// Found another header after ours - stop capturing before this
325-
captureEnd = i;
326-
break;
327-
}
328-
}
329-
}
330-
}
331-
332-
if (captureStart === -1) {
333-
return null;
334-
}
335-
336-
// Extract the lines for this run
337-
const runLines = lines.slice(captureStart, captureEnd);
338-
return runLines.join("\n").trim();
339-
} catch {
340-
return null;
341-
}
342-
}
343-
344-
/**
345-
* Save wizard logs for a run to a file in the app directory.
346-
*/
347-
export function saveWizardLogs(appPath: string, runStartTime: Date): string | null {
348-
const logs = extractWizardLogs(runStartTime);
349-
if (!logs) {
350-
return null;
351-
}
352-
353-
const logFileName = "wizard-run.log";
354-
const logFilePath = join(appPath, logFileName);
355-
356-
try {
357-
writeFileSync(logFilePath, logs);
358-
return logFilePath;
359-
} catch {
360-
return null;
361-
}
362-
}

0 commit comments

Comments
 (0)