gencow 0.1.284 → 0.1.285
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/lib/app-command.mjs +73 -4
- package/lib/cli-command-runner.mjs +5 -0
- package/lib/db-check-deadline.mjs +45 -0
- package/lib/db-push-command.mjs +58 -21
- package/lib/deploy-admission-boundary.mjs +18 -1
- package/lib/deploy-admission-transport-failure.mjs +148 -0
- package/lib/deploy-command.mjs +8 -2
- package/lib/deploy-failure-diagnostic.mjs +9 -0
- package/lib/deploy-package-runtime.mjs +3 -3
- package/lib/deploy-runtime.mjs +16 -1
- package/lib/deployment-admission-retry.mjs +6 -1
- package/lib/migration-diagnostic.mjs +27 -7
- package/lib/platform-client.mjs +3 -2
- package/lib/prod-create-auth-diagnostic.mjs +62 -13
- package/lib/static-deploy-command.mjs +3 -0
- package/package.json +3 -3
- package/runtime/server.mjs +102 -104
package/lib/platform-client.mjs
CHANGED
|
@@ -215,10 +215,11 @@ export async function platformFetchJsonWithDeadline(
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
export async function rpcQuery(creds, queryName, args = {}) {
|
|
218
|
+
export async function rpcQuery(creds, queryName, args = {}, requestOptions = {}) {
|
|
219
219
|
return platformFetch(creds, "/api/query", {
|
|
220
|
+
...requestOptions,
|
|
220
221
|
method: "POST",
|
|
221
|
-
headers: { "Content-Type": "application/json" },
|
|
222
|
+
headers: { ...requestOptions.headers, "Content-Type": "application/json" },
|
|
222
223
|
body: JSON.stringify({ name: queryName, args }),
|
|
223
224
|
});
|
|
224
225
|
}
|
|
@@ -51,37 +51,86 @@ export function credentialEnvNameOf(creds) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function formatCreateProdAuthMessage(diagnostic, credentialEnvName = null) {
|
|
54
|
+
return formatCliAuthFailureLines(diagnostic, {
|
|
55
|
+
operation: "Prod app creation",
|
|
56
|
+
changed: "nothing (no prod app was created)",
|
|
57
|
+
credentialEnvName,
|
|
58
|
+
}).join("\n");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Typed auth rejection for a deploy-family route (deploy, deploy status, static, rollback). Only the
|
|
63
|
+
* allow-listed route codes below are rendered, so a response from an older or unknown route keeps its
|
|
64
|
+
* previous output. The same reader serves every deploy-family command.
|
|
65
|
+
*/
|
|
66
|
+
const ROUTE_CREDENTIAL_CODES = new Set([
|
|
67
|
+
CREDENTIAL_REJECTED_CODE,
|
|
68
|
+
"APP_DEPLOY_AUTH_REQUIRED",
|
|
69
|
+
"APP_DEPLOY_STATUS_AUTH_REQUIRED",
|
|
70
|
+
"APP_STATIC_DEPLOY_AUTH_REQUIRED",
|
|
71
|
+
"APP_ROLLBACK_AUTH_REQUIRED",
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
export function readTypedCliAuthDiagnostic(body) {
|
|
75
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return null;
|
|
76
|
+
if (body.stage !== "auth") return null;
|
|
77
|
+
const correlationId =
|
|
78
|
+
typeof body.correlationId === "string" && CORRELATION_ID_PATTERN.test(body.correlationId)
|
|
79
|
+
? body.correlationId
|
|
80
|
+
: null;
|
|
81
|
+
if (body.code === LOOKUP_UNAVAILABLE_CODE && body.nextAction === "RETRY") {
|
|
82
|
+
return { kind: "unavailable", code: LOOKUP_UNAVAILABLE_CODE, correlationId };
|
|
83
|
+
}
|
|
84
|
+
if (ROUTE_CREDENTIAL_CODES.has(body.code)) {
|
|
85
|
+
return {
|
|
86
|
+
kind: "credential",
|
|
87
|
+
code: body.code,
|
|
88
|
+
causeCode: safeAuthCauseCode(body.causeCode),
|
|
89
|
+
correlationId,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (ACCOUNT_MESSAGES.has(body.code) && body.nextAction === "CHECK_ACCOUNT") {
|
|
93
|
+
return { kind: "account", code: body.code, correlationId };
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Renders a typed auth diagnostic as lines whose first line starts with `${operation} failed:`.
|
|
100
|
+
* `changed` states what the failed request left untouched; the message text comes from this file only.
|
|
101
|
+
*/
|
|
102
|
+
export function formatCliAuthFailureLines(diagnostic, options = {}) {
|
|
103
|
+
const operation = options.operation ?? "Deploy";
|
|
104
|
+
// `changed` is the full phrase after "Changed:", for example "nothing (no prod app was created)".
|
|
105
|
+
const changed = options.changed ?? "nothing (no app or deployment state was changed)";
|
|
106
|
+
const credentialEnvName = options.credentialEnvName ?? null;
|
|
54
107
|
const correlation = diagnostic.correlationId ?? "none returned";
|
|
55
108
|
if (diagnostic.kind === "unavailable") {
|
|
56
109
|
return [
|
|
57
|
-
|
|
110
|
+
`${operation} failed: Authentication lookup temporarily unavailable`,
|
|
58
111
|
`Code: ${diagnostic.code}`,
|
|
59
112
|
"Stage: auth",
|
|
60
|
-
|
|
113
|
+
`Changed: ${changed}`,
|
|
61
114
|
"Retryable: yes",
|
|
62
115
|
"Next: wait a short while, then run the same command again. If it keeps failing, send the Correlation ID.",
|
|
63
116
|
`Correlation ID: ${correlation}`,
|
|
64
|
-
]
|
|
117
|
+
];
|
|
65
118
|
}
|
|
66
119
|
if (diagnostic.kind === "account") {
|
|
67
120
|
return [
|
|
68
|
-
|
|
121
|
+
`${operation} failed: ${ACCOUNT_MESSAGES.get(diagnostic.code)}`,
|
|
69
122
|
`Code: ${diagnostic.code}`,
|
|
70
123
|
"Stage: auth",
|
|
71
|
-
|
|
124
|
+
`Changed: ${changed}`,
|
|
72
125
|
"Retryable: no",
|
|
73
126
|
`Next: ${ACCOUNT_NEXT_ACTION}`,
|
|
74
127
|
`Correlation ID: ${correlation}`,
|
|
75
|
-
]
|
|
128
|
+
];
|
|
76
129
|
}
|
|
77
|
-
const lines = [
|
|
78
|
-
"Prod app creation failed: CLI authentication is required",
|
|
79
|
-
`Code: ${diagnostic.code}`,
|
|
80
|
-
"Stage: auth",
|
|
81
|
-
];
|
|
130
|
+
const lines = [`${operation} failed: CLI authentication is required`, `Code: ${diagnostic.code}`, "Stage: auth"];
|
|
82
131
|
if (diagnostic.causeCode) lines.push(`Cause: ${diagnostic.causeCode}`);
|
|
83
|
-
lines.push(
|
|
132
|
+
lines.push(`Changed: ${changed}`, "Retryable: no");
|
|
84
133
|
lines.push(`Next: ${authCauseNextAction(credentialEnvName)}`);
|
|
85
134
|
lines.push(`Correlation ID: ${correlation}`);
|
|
86
|
-
return lines
|
|
135
|
+
return lines;
|
|
87
136
|
}
|
|
@@ -22,6 +22,7 @@ import { buildDeployClaimFromArchive } from "./deploy-package-claim.mjs";
|
|
|
22
22
|
import { getCliInvocationSelection } from "./project-context.mjs";
|
|
23
23
|
import { pollAcceptedDeploymentOperation } from "./deployment-operation-poll.mjs";
|
|
24
24
|
import { renderDeployFailureDiagnosticLines } from "./deploy-failure-diagnostic.mjs";
|
|
25
|
+
import { credentialEnvNameOf } from "./prod-create-auth-diagnostic.mjs";
|
|
25
26
|
import { writeProjectMetadata } from "./deploy-project-metadata.mjs";
|
|
26
27
|
import { postDeploymentAdmissionWithTimeout } from "./deploy-admission-boundary.mjs";
|
|
27
28
|
import { installLocalDeployInterruptGuard } from "./local-deploy-interrupt-guard.mjs";
|
|
@@ -598,6 +599,7 @@ export function createStaticDeployRuntime({
|
|
|
598
599
|
postDeploymentAdmissionWithTimeout({
|
|
599
600
|
requestId: deployClaim.claim.requestId,
|
|
600
601
|
appName: appId,
|
|
602
|
+
envTarget: opts.envTarget || "dev",
|
|
601
603
|
// Resume static admission directly; fullstack flow skips the
|
|
602
604
|
// already-completed backend component for this scoped receipt.
|
|
603
605
|
resumeCommand: `gencow deploy --static${opts.envTarget === "prod" ? " --prod" : ""} --app ${appId}${opts.clientName ? ` --client ${opts.clientName}` : ""} --resume ${deployClaim.claim.requestId}`,
|
|
@@ -695,6 +697,7 @@ export function createStaticDeployRuntime({
|
|
|
695
697
|
releaseStaticDeployReceipt(staticReceipt);
|
|
696
698
|
const [headline, ...details] = renderDeployFailureDiagnosticLines(errData, deployRes.statusText, {
|
|
697
699
|
expectedAppName: appId,
|
|
700
|
+
credentialEnvName: credentialEnvNameOf(creds),
|
|
698
701
|
});
|
|
699
702
|
errorImpl(headline.replace(/^Deploy failed:/u, "Static deploy failed:"));
|
|
700
703
|
for (const line of details) infoImpl(line);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.285",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"ai": "^6.0.314",
|
|
41
41
|
"better-auth": "1.7.11",
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
|
+
"@gencow/client": "0.2.8",
|
|
43
44
|
"@gencow/core": "0.1.47",
|
|
44
45
|
"@gencow/shared": "0.0.0",
|
|
45
|
-
"@gencow/react": "0.2.8",
|
|
46
46
|
"@gencow/server": "0.1.3",
|
|
47
|
-
"@gencow/
|
|
47
|
+
"@gencow/react": "0.2.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "node scripts/bundle-core.mjs && node scripts/bundle-shared.mjs && node scripts/bundle-server.mjs",
|