Skip to content

Commit 69fb957

Browse files
fix(state): integrate rebased state layout with main
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 73b29be commit 69fb957

49 files changed

Lines changed: 523 additions & 280 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/api.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export function orgPinGuard(): Promise<void> {
7171
return orgPinChecked;
7272
}
7373

74-
7574
export function getDryRunCounts(): {
7675
POST: number;
7776
PATCH: number;

‎src/call.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { missingApiKeyMessage, resolveOrgApiKey } from "./api-key.ts";
21
import { execSync } from "child_process";
32
import { existsSync, readFileSync } from "fs";
43
import { createRequire } from "module";
54
import { join, resolve } from "path";
65
import * as readline from "readline";
76
import { fileURLToPath } from "url";
7+
import { missingApiKeyMessage, resolveOrgApiKey } from "./api-key.ts";
88
import { baseDir } from "./base-dir.ts";
99
import { stateFileLabel, stateFileRead } from "./state-paths.ts";
1010
import type { Environment, StateFile } from "./types.ts";

‎src/check-cmd.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { CheckReportSkipped } from "./check-report.ts";
2222
import { checkReportJson, checkReportMarkdown } from "./check-report.ts";
2323
import type { CheckTargetResult } from "./check-run.ts";
2424
import { checkRunAll, outcomeState } from "./check-run.ts";
25-
import { checkAffectedBy, changedFilesRead } from "./check-select.ts";
25+
import { changedFilesRead, checkAffectedBy } from "./check-select.ts";
2626
import type { CommitStatus, GitHubStatusEnv } from "./check-status.ts";
2727
import {
2828
AGGREGATE_CONTEXT,
@@ -294,7 +294,12 @@ async function liveRun(
294294
const vapiClient = vapiClientGet("check");
295295
const vapi = (job: CheckJob): VapiConnection => {
296296
const connection = connections.get(job.check.runOrg)!;
297-
return { token: connection.token, baseUrl: connection.baseUrl!, userAgent, vapiClient };
297+
return {
298+
token: connection.token,
299+
baseUrl: connection.baseUrl!,
300+
userAgent,
301+
vapiClient,
302+
};
298303
};
299304
const post = async (status: CommitStatus) => {
300305
if (statusEnv) await commitStatusPost(statusEnv, status);
@@ -399,9 +404,7 @@ async function checksRun(
399404

400405
export async function checkCommandRun(
401406
args = process.argv.slice(2),
402-
root = resolve(
403-
process.env.VAPI_GITOPS_ROOT ?? baseDir(),
404-
),
407+
root = resolve(process.env.VAPI_GITOPS_ROOT ?? baseDir()),
405408
): Promise<number> {
406409
let parsed: CheckArgs;
407410
try {

‎src/hash-store.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ export const HASH_STORE_BASE_DIR = BASE_DIR;
3737
// Guard against a UUID that would escape its org folder. Platform UUIDs never
3838
// contain these, but reading them straight into a path warrants a check.
3939
function assertSafeUuid(uuid: string): void {
40-
if (!uuid || uuid.includes("/") || uuid.includes("\\") || uuid.includes("..")) {
41-
throw new Error(`Refusing to use unsafe hash-store key: ${JSON.stringify(uuid)}`);
40+
if (
41+
!uuid ||
42+
uuid.includes("/") ||
43+
uuid.includes("\\") ||
44+
uuid.includes("..")
45+
) {
46+
throw new Error(
47+
`Refusing to use unsafe hash-store key: ${JSON.stringify(uuid)}`,
48+
);
4249
}
4350
}
4451

‎src/interactive.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { missingApiKeyMessage, resolveOrgApiKey } from "./api-key.ts";
21
import { confirm, select } from "@inquirer/prompts";
32
import { execSync } from "child_process";
43
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
54
import { extname, join, relative } from "path";
5+
import { missingApiKeyMessage, resolveOrgApiKey } from "./api-key.ts";
66
import { baseDir } from "./base-dir.ts";
77
import searchableCheckbox, { BACK_SENTINEL } from "./searchableCheckbox.js";
88
// slug-utils is config-free (no config.ts side effects) — safe to import in

‎src/migrate-hash-store.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import {
1919
writeBaseline,
2020
} from "./hash-store.ts";
2121
import {
22-
STATE_DIR,
2322
commitStepAsk,
23+
STATE_DIR,
2424
stateFileRead,
2525
stateMove,
2626
stateMoveRead,

‎src/org-pin.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import { dirname, join, relative } from "node:path";
2121
import { orgApiKeyVar } from "./api-key.ts";
2222
import { orgPinFileRead, orgPinFileWrite } from "./state-paths.ts";
2323
import {
24-
type VapiConnection,
2524
VapiApiError,
25+
type VapiConnection,
2626
vapiFetchJson,
2727
} from "./vapi-client.ts";
2828

@@ -140,7 +140,9 @@ export interface OrgPinCheckArgs {
140140
* key belongs to another org, or to an empty org while the folder is pinned
141141
* to one that had resources.
142142
*/
143-
export async function orgPinCheck(args: OrgPinCheckArgs): Promise<OrgPinOutcome> {
143+
export async function orgPinCheck(
144+
args: OrgPinCheckArgs,
145+
): Promise<OrgPinOutcome> {
144146
const { rootDir, org, connection, keySource } = args;
145147
// Set only by tests/no-vapi-api.ts: tests that stub fetch count requests.
146148
if (process.env.VAPI_GITOPS_ORG_PIN === "off") return { kind: "unpinned" };

‎src/promote-cmd.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import { fileURLToPath } from "node:url";
55
import { baseDir } from "./base-dir.ts";
66
import type { CheckDefinition } from "./check-config.ts";
77
import type { OrgConnection } from "./org-connection.ts";
8-
import {
9-
OLD_LAYOUT_NOTICE,
10-
stateFileRead,
11-
stateLayout,
12-
stateNoticesPrint,
13-
} from "./state-paths.ts";
148
import { childRun, connectionLoad, tokensParse } from "./org-connection.ts";
159
import type { PromotionConfig, PromotionPipeline } from "./promotion.ts";
16-
import type { PromotionGateResult } from "./promotion-gate.ts";
17-
import {
18-
promotionChecksLoad,
19-
promotionGatePlanLine,
20-
promotionGateRun,
21-
} from "./promotion-gate.ts";
2210
import {
2311
promotionConfigParse,
2412
promotionPlanApply,
2513
promotionPlanBuild,
2614
promotionStateParse,
2715
promotionTransitionValidate,
2816
} from "./promotion.ts";
17+
import type { PromotionGateResult } from "./promotion-gate.ts";
18+
import {
19+
promotionChecksLoad,
20+
promotionGatePlanLine,
21+
promotionGateRun,
22+
} from "./promotion-gate.ts";
23+
import {
24+
OLD_LAYOUT_NOTICE,
25+
stateFileRead,
26+
stateLayout,
27+
stateNoticesPrint,
28+
} from "./state-paths.ts";
2929

3030
interface PromotionArguments {
3131
pipeline?: string;

‎src/pull.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,10 @@ export async function pullResourceType(
984984
statSync(localFile).mtimeMs > statSync(stamp).mtimeMs
985985
) {
986986
console.log(` ✏️ ${resourceId} (locally modified, preserving)`);
987-
upsertState(newStateSection, resourceId, { uuid: resource.id, origin: "pulled" });
987+
upsertState(newStateSection, resourceId, {
988+
uuid: resource.id,
989+
origin: "pulled",
990+
});
988991
skipped++;
989992
continue;
990993
}

‎src/push.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
import { checkDriftForUpdate, type DriftCheckResult } from "./drift.ts";
2626
import { deleteBaseline, writeBaseline } from "./hash-store.ts";
2727
import { prepareResourceLinks } from "./link-preflight.ts";
28-
import { assertStateMigrated } from "./migrate-hash-store.ts";
2928
import { NameCollisionReport } from "./name-collisions.ts";
3029
import { computePushPlan, pushBlockingFindings } from "./push-plan.ts";
3130
import { reconcileStateKeyForResource } from "./reconcile-state-key.ts";

0 commit comments

Comments
 (0)