patchrelay 0.10.3 → 0.10.5
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/dist/build-info.json +3 -3
- package/dist/db/migrations.js +2 -0
- package/dist/db.js +1 -1
- package/dist/preflight.js +10 -6
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/db/migrations.js
CHANGED
|
@@ -127,4 +127,6 @@ CREATE INDEX IF NOT EXISTS idx_operator_feed_events_project ON operator_feed_eve
|
|
|
127
127
|
`;
|
|
128
128
|
export function runPatchRelayMigrations(connection) {
|
|
129
129
|
connection.exec(schema);
|
|
130
|
+
// Clean up stale dedupe-only webhook records (no payload, never processable)
|
|
131
|
+
connection.prepare("UPDATE webhook_events SET processing_status = 'processed' WHERE processing_status = 'pending' AND payload_json IS NULL").run();
|
|
130
132
|
}
|
package/dist/db.js
CHANGED
|
@@ -30,7 +30,7 @@ export class PatchRelayDatabase {
|
|
|
30
30
|
return { id: existing.id, duplicate: true };
|
|
31
31
|
}
|
|
32
32
|
const result = this.connection
|
|
33
|
-
.prepare("INSERT INTO webhook_events (webhook_id, received_at) VALUES (?,
|
|
33
|
+
.prepare("INSERT INTO webhook_events (webhook_id, received_at, processing_status) VALUES (?, ?, 'processed')")
|
|
34
34
|
.run(webhookId, receivedAt);
|
|
35
35
|
return { id: Number(result.lastInsertRowid), duplicate: false };
|
|
36
36
|
}
|
package/dist/preflight.js
CHANGED
|
@@ -70,7 +70,7 @@ export async function runPreflight(config) {
|
|
|
70
70
|
checks.push(...checkPublicBaseUrl(config));
|
|
71
71
|
checks.push(...checkOAuthRedirectUri(config));
|
|
72
72
|
checks.push(...checkPath("database", path.dirname(config.database.path), "directory", { createIfMissing: true, writable: true }));
|
|
73
|
-
checks.push(
|
|
73
|
+
checks.push(...checkDatabaseHealth(config));
|
|
74
74
|
checks.push(...checkPath("logging", path.dirname(config.logging.filePath), "directory", { createIfMissing: true, writable: true }));
|
|
75
75
|
if (config.projects.length === 0) {
|
|
76
76
|
checks.push(warn("projects", "No projects are configured yet; add one with `patchrelay project apply <id> <repo-path>` before connecting Linear"));
|
|
@@ -87,7 +87,8 @@ export async function runPreflight(config) {
|
|
|
87
87
|
ok: checks.every((check) => check.status !== "fail"),
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function checkDatabaseHealth(config) {
|
|
91
|
+
const checks = [];
|
|
91
92
|
let connection;
|
|
92
93
|
try {
|
|
93
94
|
connection = new SqliteConnection(config.database.path);
|
|
@@ -99,7 +100,8 @@ function checkDatabaseSchema(config) {
|
|
|
99
100
|
const quickCheck = connection.prepare("PRAGMA quick_check").get();
|
|
100
101
|
const quickCheckResult = quickCheck ? Object.values(quickCheck)[0] : undefined;
|
|
101
102
|
if (quickCheckResult !== "ok") {
|
|
102
|
-
|
|
103
|
+
checks.push(fail("database_schema", `SQLite quick_check failed: ${String(quickCheckResult ?? "unknown result")}`));
|
|
104
|
+
return checks;
|
|
103
105
|
}
|
|
104
106
|
const schemaStats = connection
|
|
105
107
|
.prepare(`
|
|
@@ -112,16 +114,18 @@ function checkDatabaseSchema(config) {
|
|
|
112
114
|
.get();
|
|
113
115
|
const objectCount = Number(schemaStats?.object_count ?? 0);
|
|
114
116
|
if (objectCount < 1) {
|
|
115
|
-
|
|
117
|
+
checks.push(fail("database_schema", "Database schema is empty after migrations"));
|
|
118
|
+
return checks;
|
|
116
119
|
}
|
|
117
|
-
|
|
120
|
+
checks.push(pass("database_schema", `Database opened, migrations applied, and schema is readable (${objectCount} objects)`));
|
|
118
121
|
}
|
|
119
122
|
catch (error) {
|
|
120
|
-
|
|
123
|
+
checks.push(fail("database_schema", `Unable to open or validate database schema at ${config.database.path}: ${formatError(error)}`));
|
|
121
124
|
}
|
|
122
125
|
finally {
|
|
123
126
|
connection?.close();
|
|
124
127
|
}
|
|
128
|
+
return checks;
|
|
125
129
|
}
|
|
126
130
|
function checkPath(scope, targetPath, expectedType, options) {
|
|
127
131
|
const checks = [];
|