Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -47,43 +47,89 @@ const REQUIRED_COMMANDS_IN_ORDER = [
"pnpm lint",
"pnpm run test:foundation",
"pnpm run test:packages",
"pnpm run test:mobile",
"pnpm test",
"pnpm run build:ci",
"pnpm run verify:bundle-size",
"pnpm run verify:production-seed-artifact",
];
// The former monolithic "quality" job is split into parallel jobs to cut CI wallclock.
// The static-verify gate is itself split into two jobs (verify-1 + verify-2) so the heavy
// UI/a11y checks run side by side instead of serially. Every command in
// REQUIRED_COMMANDS_IN_ORDER must still run exactly once across these jobs, and the required
// relative order is preserved WITHIN each owning job (cross-job order no longer matters
// because the jobs run in parallel). The two heavy UI checks (ui-visual + hot-swap) live in
// verify-1, the two heavy accessibility checks (a11y-coverage + a11y smoke) in verify-2.
const QUALITY_SPLIT_JOBS = ["verify-1", "verify-2", "typecheck-test", "build"];
const QUALITY_JOB_BY_COMMAND = {
"pnpm run verify:github-ci-workflow": "verify-1",
"pnpm run verify:gitea-ci-workflow": "verify-1",
"pnpm run verify:deploy-workflow": "verify-1",
"pnpm run verify:deploy-readiness": "verify-1",
"pnpm run verify:ci-baseline": "verify-1",
"pnpm run verify:source-health": "verify-1",
"pnpm run verify:eslint-baseline": "verify-1",
"pnpm run verify:env-drift": "verify-1",
"pnpm run verify:health-baseline": "verify-1",
"pnpm run verify:api-inventory": "verify-1",
"pnpm run verify:tenant-isolation-report": "verify-2",
"pnpm run verify:sidebar-routes": "verify-2",
"pnpm run verify:i18n": "verify-2",
"pnpm run verify:tenant-auth-baseline": "verify-2",
"pnpm run verify:onboarding-flow": "verify-2",
"pnpm run verify:phase-c-boundaries": "verify-2",
"pnpm run verify:core-build-without-plugins-smoke": "build",
"pnpm run verify:removed-modules": "verify-2",
"pnpm run verify:ui-visual": "verify-1",
"pnpm run test:hot-swap": "verify-1",
"pnpm run verify:a11y-coverage": "verify-2",
"pnpm run test:a11y": "verify-2",
"pnpm run verify:porting-docs-baseline": "verify-2",
"pnpm run verify:production-docs": "verify-2",
"pnpm run verify:release-docs": "verify-2",
"pnpm run verify:docs-links": "verify-2",
"pnpm typecheck": "typecheck-test",
"pnpm lint": "typecheck-test",
"pnpm run test:foundation": "typecheck-test",
"pnpm run test:packages": "typecheck-test",
"pnpm test": "typecheck-test",
"pnpm run build:ci": "build",
"pnpm run verify:bundle-size": "build",
"pnpm run verify:production-seed-artifact": "build",
};
const SERVICE_JOB_CONTRACTS = {
api: {
label: "api",
commands: [
"pnpm run verify:openapi-security",
"pnpm --filter @toolctrl/api typecheck",
"pnpm --filter @hivegrid/api typecheck",
"pnpm exec vitest run apps/api/src",
"pnpm --filter @toolctrl/api build",
"pnpm --filter @hivegrid/api build",
],
},
worker: {
label: "worker",
commands: [
"pnpm --filter @toolctrl/worker typecheck",
"pnpm --filter @toolctrl/worker exec vitest run",
"pnpm --filter @hivegrid/worker typecheck",
"pnpm --filter @hivegrid/worker exec vitest run",
"pnpm run verify:workflow-outbox-native",
"pnpm --filter @toolctrl/worker build",
"pnpm --filter @toolctrl/worker health",
"pnpm --filter @hivegrid/worker build",
"pnpm --filter @hivegrid/worker health",
],
},
};
const DATABASE_JOB = "database";
const DATABASE_STATUS_COMMAND = "pnpm run verify:db-migrate-status:staging";
const DATABASE_GENERATE_COMMAND = "pnpm run db:generate";
const DATABASE_PARITY_COMMAND = "pnpm run verify:migrations-parity";
const STAGING_SSH_HOST_VAR = "${{ vars.COOLIFY_STAGING_SSH_HOST }}";
const STAGING_SSH_USER_VAR = "${{ vars.COOLIFY_STAGING_SSH_USER }}";
const STAGING_WEB_RESOURCE_UUID_VAR = "${{ vars.COOLIFY_STAGING_WEB_RESOURCE_UUID }}";
const STAGING_SSH_KEY_SECRET = "${{ secrets.COOLIFY_STAGING_SSH_KEY }}";
const FORBIDDEN_DATABASE_MUTATION_PATTERN = /\b(?:prisma\s+migrate\s+deploy|migrate:deploy|db:deploy|db:push|prisma\s+db\s+push|seed)\b/i;
const DOCKER_SMOKE_JOB = "docker-smoke";
const DOCKER_SMOKE_NEEDS = ["quality", "api", "worker", "database"];
// Empty: docker-smoke intentionally has no needs so it runs in parallel with the quality
// phase (it builds images from source, no cross-job artifact dependency). See ci.yml.
const DOCKER_SMOKE_NEEDS = [];
const DOCKER_SMOKE_TARGETS = ["web", "api", "worker"];
const DOCKER_WEB_TAG = dockerImageTag("web");
const DOCKER_API_TAG = dockerImageTag("api");
@@ -359,7 +405,7 @@ function getStepForRunCommand(section, predicate) {
function hasUploadSourcemapsArtifactStep(section) {
return getAllStepBlocks(section).some(
(step) =>
/uses:\s*actions\/upload-artifact@v4/i.test(step) &&
/uses:\s*actions\/upload-artifact@v[34]/i.test(step) &&
new RegExp(`^\\s*name:\\s*${escapeRegExp(WEB_SOURCEMAPS_ARTIFACT_NAME)}\\s*$`, "m").test(step) &&
new RegExp(`^\\s*path:\\s*${escapeRegExp(WEB_SOURCEMAPS_PATH)}\\s*$`, "m").test(step) &&
/^\s*if-no-files-found:\s*error\s*$/m.test(step) &&
@@ -370,7 +416,7 @@ function hasUploadSourcemapsArtifactStep(section) {
function hasReusableSourcemapsArtifactContract(content) {
return (
/^\s+sourcemaps-artifact:\s*$/m.test(content) &&
/uses:\s*actions\/download-artifact@v4/i.test(content) &&
/uses:\s*actions\/download-artifact@v[34]/i.test(content) &&
/^\s*if:\s*\$\{\{\s*inputs\.sourcemaps-artifact\s*!=\s*'none'\s*\}\}\s*$/m.test(content) &&
/^\s*name:\s*\$\{\{\s*inputs\.sourcemaps-artifact\s*\}\}\s*$/m.test(content) &&
/^\s*path:\s*\$\{\{\s*inputs\.sourcemaps-path\s*\}\}\s*$/m.test(content)
@@ -529,29 +575,34 @@ export function checkWorkflowTriggers(content) {
export function checkPnpmSetup(content) {
const passes = [];
const failures = [];
const qualitySection = getJobSection(content, "quality");
if (!qualitySection) {
failures.push(`${WORKFLOW_PATH}: missing required quality job "quality"`);
return { passes, failures, observations: [] };
}
// Each split quality job runs its own setup (checkout + corepack + pinned pnpm +
// frozen install), so every one of them must carry the pnpm bootstrap.
for (const jobName of QUALITY_SPLIT_JOBS) {
const section = getJobSection(content, jobName);
if (hasCorepackSetup(qualitySection)) {
passes.push(`${WORKFLOW_PATH}: Corepack setup is present`);
} else {
failures.push(`${WORKFLOW_PATH}: missing Corepack setup`);
}
if (!section) {
failures.push(`${WORKFLOW_PATH}: missing required quality job "${jobName}"`);
continue;
}
if (hasPinnedPnpm(qualitySection)) {
passes.push(`${WORKFLOW_PATH}: pnpm@${REQUIRED_PNPM_VERSION} is pinned`);
} else {
failures.push(`${WORKFLOW_PATH}: pnpm must be pinned to pnpm@${REQUIRED_PNPM_VERSION}`);
}
if (hasCorepackSetup(section)) {
passes.push(`${WORKFLOW_PATH}: quality job "${jobName}" Corepack setup is present`);
} else {
failures.push(`${WORKFLOW_PATH}: quality job "${jobName}" missing Corepack setup`);
}
if (hasFrozenInstall(qualitySection)) {
passes.push(`${WORKFLOW_PATH}: command "pnpm install --frozen-lockfile" is present`);
} else {
failures.push(`${WORKFLOW_PATH}: missing required command "pnpm install --frozen-lockfile"`);
if (hasPinnedPnpm(section)) {
passes.push(`${WORKFLOW_PATH}: quality job "${jobName}" pnpm@${REQUIRED_PNPM_VERSION} is pinned`);
} else {
failures.push(`${WORKFLOW_PATH}: quality job "${jobName}" pnpm must be pinned to pnpm@${REQUIRED_PNPM_VERSION}`);
}
if (hasFrozenInstall(section)) {
passes.push(`${WORKFLOW_PATH}: quality job "${jobName}" command "pnpm install --frozen-lockfile" is present`);
} else {
failures.push(`${WORKFLOW_PATH}: quality job "${jobName}" missing required command "pnpm install --frozen-lockfile"`);
}
}
return { passes, failures, observations: [] };
@@ -560,14 +611,27 @@ export function checkPnpmSetup(content) {
export function checkOrderedQualityGates(content) {
const passes = [];
const failures = [];
const qualitySection = getJobSection(content, "quality") ?? content;
const executableCommands = getExecutableRunCommandEntries(qualitySection);
let previousIndex = -1;
// Resolve each split job's section once. The required commands are partitioned across
// these jobs via QUALITY_JOB_BY_COMMAND; missing jobs surface as missing commands here
// (and are also reported by checkPnpmSetup).
const sections = {};
for (const jobName of QUALITY_SPLIT_JOBS) {
sections[jobName] = getJobSection(content, jobName) ?? "";
}
// Duplicate detection is global across the split jobs so a gate cannot run twice in CI.
const combinedSection = QUALITY_SPLIT_JOBS.map((jobName) => sections[jobName]).join("\n");
// Order is tracked per owning job: the canonical relative order must hold WITHIN each
// job. Across jobs the order is irrelevant because they run in parallel.
const previousIndexByJob = Object.fromEntries(QUALITY_SPLIT_JOBS.map((jobName) => [jobName, -1]));
for (const command of REQUIRED_COMMANDS_IN_ORDER) {
const jobName = QUALITY_JOB_BY_COMMAND[command];
const section = sections[jobName] ?? "";
const executableCommands = getExecutableRunCommandEntries(section);
const commandIndex = executableCommands.findIndex((entry) => matchesExecutableCommand(entry.command, command));
const commandOccurrences = countExecutableCommandOccurrences(qualitySection, command);
const softeningReason = getRequiredCommandSofteningReason(qualitySection, command);
const commandOccurrences = countExecutableCommandOccurrences(combinedSection, command);
const softeningReason = getRequiredCommandSofteningReason(section, command);
if (commandIndex === -1) {
if (softeningReason) {
@@ -583,7 +647,7 @@ export function checkOrderedQualityGates(content) {
continue;
}
if (commandIndex < previousIndex) {
if (commandIndex < previousIndexByJob[jobName]) {
failures.push(`${WORKFLOW_PATH}: command "${command}" must run after previous quality gates`);
continue;
}
@@ -594,10 +658,12 @@ export function checkOrderedQualityGates(content) {
}
passes.push(`${WORKFLOW_PATH}: command "${command}" is ordered`);
previousIndex = commandIndex;
previousIndexByJob[jobName] = commandIndex;
}
const sourcemapsValidationStep = getStepForRunCommand(qualitySection, (line) => line === WEB_SOURCEMAPS_VALIDATE_COMMAND);
// The web build, source-map validation and artifact upload all live in the "build" job.
const buildSection = sections.build ?? "";
const sourcemapsValidationStep = getStepForRunCommand(buildSection, (line) => line === WEB_SOURCEMAPS_VALIDATE_COMMAND);
if (sourcemapsValidationStep) {
const softeningReason = getRequiredStepSofteningReason(sourcemapsValidationStep);
if (softeningReason) {
@@ -609,7 +675,7 @@ export function checkOrderedQualityGates(content) {
failures.push(`${WORKFLOW_PATH}: missing web source-map validation before Sentry artifact upload`);
}
if (hasUploadSourcemapsArtifactStep(qualitySection)) {
if (hasUploadSourcemapsArtifactStep(buildSection)) {
passes.push(`${WORKFLOW_PATH}: web source maps are uploaded as artifact "${WEB_SOURCEMAPS_ARTIFACT_NAME}"`);
} else {
failures.push(`${WORKFLOW_PATH}: must upload ${WEB_SOURCEMAPS_PATH} as artifact "${WEB_SOURCEMAPS_ARTIFACT_NAME}" with if-no-files-found: error`);
@@ -618,7 +684,7 @@ export function checkOrderedQualityGates(content) {
return { passes, failures, observations: [] };
}
export function checkSentrySourcemapWorkflow(rootDir, content) {
export function checkSentrySourcemapWorkflow(rootDir) {
const passes = [];
const failures = [];
const sentryReusableContent = readOptionalFile(rootDir, SENTRY_REUSABLE_WORKFLOW_PATH);
@@ -631,18 +697,6 @@ export function checkSentrySourcemapWorkflow(rootDir, content) {
failures.push(`${SENTRY_REUSABLE_WORKFLOW_PATH}: reusable workflow must accept sourcemaps-artifact and download it to inputs.sourcemaps-path`);
}
const sentryWebSection = getJobSection(content, "sentry-release-web");
if (!sentryWebSection) {
failures.push(`${WORKFLOW_PATH}: missing Sentry web release job "sentry-release-web"`);
} else if (
new RegExp(`^\\s*sourcemaps-path:\\s*${escapeRegExp(WEB_SOURCEMAPS_PATH)}\\s*$`, "m").test(sentryWebSection) &&
new RegExp(`^\\s*sourcemaps-artifact:\\s*${escapeRegExp(WEB_SOURCEMAPS_ARTIFACT_NAME)}\\s*$`, "m").test(sentryWebSection)
) {
passes.push(`${WORKFLOW_PATH}: Sentry web release consumes artifact "${WEB_SOURCEMAPS_ARTIFACT_NAME}"`);
} else {
failures.push(`${WORKFLOW_PATH}: Sentry web release must pass sourcemaps-path ${WEB_SOURCEMAPS_PATH} and sourcemaps-artifact ${WEB_SOURCEMAPS_ARTIFACT_NAME}`);
}
return { passes, failures, observations: [] };
}
@@ -773,6 +827,22 @@ export function checkDatabaseJob(content) {
}
}
if (includesCommand(section, DATABASE_PARITY_COMMAND)) {
const softeningReason = getRequiredCommandSofteningReason(section, DATABASE_PARITY_COMMAND);
if (softeningReason) {
failures.push(`${WORKFLOW_PATH}: database job "${DATABASE_JOB}" command "${DATABASE_PARITY_COMMAND}" must not use ${softeningReason}`);
} else {
passes.push(`${WORKFLOW_PATH}: database job "${DATABASE_JOB}" includes command "${DATABASE_PARITY_COMMAND}"`);
}
} else {
const softeningReason = getRequiredCommandSofteningReason(section, DATABASE_PARITY_COMMAND);
if (softeningReason) {
failures.push(`${WORKFLOW_PATH}: database job "${DATABASE_JOB}" command "${DATABASE_PARITY_COMMAND}" must not use ${softeningReason}`);
} else {
failures.push(`${WORKFLOW_PATH}: database job "${DATABASE_JOB}" missing command "${DATABASE_PARITY_COMMAND}"`);
}
}
if (includesCommand(section, DATABASE_STATUS_COMMAND)) {
const softeningReason = getRequiredCommandSofteningReason(section, DATABASE_STATUS_COMMAND);
if (softeningReason) {
@@ -1059,7 +1129,7 @@ export function checkGiteaVariableNames(content) {
const failures = [];
if (FORBIDDEN_GITEA_HOST_OVERRIDE_PATTERN.test(content)) {
failures.push(`${WORKFLOW_PATH}: GITEA_HOST_IP is forbidden because Gitea reserves the GITEA_ variable prefix; use TOOLCTRL_GITEA_HOST_IP`);
failures.push(`${WORKFLOW_PATH}: GITEA_HOST_IP is forbidden because Gitea reserves the GITEA_ variable prefix; use HIVEGRID_GITEA_HOST_IP`);
} else {
passes.push(`${WORKFLOW_PATH}: internal host override avoids the reserved GITEA_ variable prefix`);
}
@@ -1067,9 +1137,9 @@ export function checkGiteaVariableNames(content) {
const hostWrites = [...content.matchAll(HOST_OVERRIDE_WRITE_PATTERN)].length;
const validations = [...content.matchAll(HOST_OVERRIDE_VALIDATION_PATTERN)].length;
if (hostWrites > validations) {
failures.push(`${WORKFLOW_PATH}: TOOLCTRL_GITEA_HOST_IP must be validated before writing to /etc/hosts`);
failures.push(`${WORKFLOW_PATH}: HIVEGRID_GITEA_HOST_IP must be validated before writing to /etc/hosts`);
} else {
passes.push(`${WORKFLOW_PATH}: internal host override validates TOOLCTRL_GITEA_HOST_IP before /etc/hosts writes`);
passes.push(`${WORKFLOW_PATH}: internal host override validates HIVEGRID_GITEA_HOST_IP before /etc/hosts writes`);
}
return { passes, failures, observations: [] };
@@ -1096,7 +1166,7 @@ export function verifyGiteaCiWorkflow(rootDir = process.cwd()) {
checkServiceJobs(content),
checkDatabaseJob(content),
checkDockerSmokeJob(content),
checkSentrySourcemapWorkflow(rootDir, content),
checkSentrySourcemapWorkflow(rootDir),
checkForbiddenE2eCommands(content),
checkGiteaVariableNames(content),
];