Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
chore: merge dev into live entity change stream
Josuéa3c6e1f705f8
diff --cc control-api/package-lock.jsonindex 5ec8f7bf8,efe682948..c590eda6b--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@@ -1,12 -1,12 +1,12 @@@{"name": "clerum-control-api",- "version": "0.1.643",- "version": "0.1.637",++ "version": "0.1.644","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.643",- "version": "0.1.637",++ "version": "0.1.644","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --cc control-api/package.jsonindex 3aafb96fd,52a7ddeb8..f6e9dac46--- a/control-api/package.json+++ b/control-api/package.json@@@ -1,6 -1,6 +1,6 @@@{"name": "clerum-control-api",- "version": "0.1.643",- "version": "0.1.637",++ "version": "0.1.644","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --cc control-api/src/db.tsindex a0897bf24,bdcdb8227..30104f199--- a/control-api/src/db.ts+++ b/control-api/src/db.ts@@@ -6163,9 -6192,22 +6193,29 @@@ export const CONTROL_API_MIGRATIONS: Db},},{- version: '0116_durable_entity_change_feed',+ version: '0116_mcp_secret_rollback_permits',+ // Renumbered twice while syncing onto dev: 0101 -> 0109 -> 0116. This branch+ // introduced the migration as 0101; the first sync brought dev's 0101–0108+ // (codex multi-connection through the SDK-link FK) and pushed it to 0109;+ // this sync brought dev's 0109–0115 (grok subscriptions through the+ // allowed-models image-input column), so 0109 is now taken by+ // 0109_grok_subscription_connections and the migration moves to the end of+ // the list rather than claiming a version another migration already uses.+ // Environments where this feature branch was already deployed recorded it+ // under one of the earlier names. legacyVersions lets the runner mark 0116+ // applied from that prior row instead of re-running the DDL and leaving an+ // orphan schema_migrations entry. Both prior names are unique to this+ // migration, so there is no false-skip.+ legacyVersions: ['0101_mcp_secret_rollback_permits', '0109_mcp_secret_rollback_permits'],+ apply: applyMcpSecretRollbackPermitSchema,+ },++ {++ version: '0117_durable_entity_change_feed',++ // The feature branch originally recorded this schema as 0116. Retain that++ // applied-migration identity so a previously deployed branch is not rerun.++ legacyVersions: ['0116_durable_entity_change_feed'],+ apply: applyEntityChangeSchema,+ },]async function consolidateWorkflowAllowedUsersToTriggers(db: DbClient): Promise<void> {diff --cc control-api/test/db.oauthGrantsOwnerGeneralization.test.tsindex 001a73a7a,30bdc76d0..3b5d207b7--- a/control-api/test/db.oauthGrantsOwnerGeneralization.test.ts+++ b/control-api/test/db.oauthGrantsOwnerGeneralization.test.ts@@@ -21,7 -21,20 +21,24 @@@ describe('0101 oauth_grants owner generconst { CONTROL_API_MIGRATIONS } = await import('../src/db.js')const versions = CONTROL_API_MIGRATIONS.map(m => m.version)expect(versions).toContain('0106_oauth_grants_owner_generalization')- expect(versions.at(-1)).toBe('0116_durable_entity_change_feed')+ // Ordering, not tail position: this test guards where 0106 sits relative to+ // its neighbours. Pinning `.at(-1)` asserted that the migration named there+ // is the last one that will ever exist, which every subsequent additive+ // migration breaks — 0116_mcp_secret_rollback_permits did.+ //+ // `indexOf` returns -1 for an absent version, and -1 is less than any real+ // index, so the ordering assertion alone would pass vacuously if the left+ // operand were dropped from the list. The two `toContain` assertions are the+ // liveness witness: they fail first if either version stops being registered.+ expect(versions).toContain('0108_llm_provider_attempts_sdk_link_on_delete_set_null')+ expect(versions).toContain('0116_mcp_secret_rollback_permits')+ expect(versions.indexOf('0108_llm_provider_attempts_sdk_link_on_delete_set_null')).toBeLessThan(+ versions.indexOf('0116_mcp_secret_rollback_permits')+ )++ expect(versions).toContain('0117_durable_entity_change_feed')++ expect(versions.indexOf('0116_mcp_secret_rollback_permits')).toBeLessThan(++ versions.indexOf('0117_durable_entity_change_feed')++ )expect(versions.indexOf('0100_seed_minimax_allowed_model')).toBeLessThan(versions.indexOf('0106_oauth_grants_owner_generalization'))diff --cc control-ui/components/GfsBrowser.tsxindex 5f56ca10c,275fbfa24..b6065ef94--- a/control-ui/components/GfsBrowser.tsx+++ b/control-ui/components/GfsBrowser.tsx@@@ -30,11 -32,8 +32,9 @@@ importIconUpload,IconX,} from '@components/icons'- import { Button } from '@components/ui'- import { apiGet, apiSend, gfsDownload, isSilentApiError } from '@lib/api'+ import { Button, Field, TextInput } from '@components/ui'+ import { apiGet, apiSend, getGfsResourceByPath, gfsDownload, isSilentApiError } from '@lib/api'+import { parseEntityChangeFrame } from '@lib/entityChangeStream'import { isGfsDocumentFile } from '@lib/gfsDocumentFile'import {GfsUploadCapabilityError,@@@ -114,16 -76,20 +113,28 @@@ interface Crumbid: string | nullrid: string | nullname: string+ /** Folder crumbs carry the identity their ⋯ menu actions need; the+ * synthetic root has none and gets no menu. */+ kind?: 'directory'+ gfsUri?: string+ version?: number}+interface GfsResolvedLocation {+ resourceId: string+ rid: string+ name: string+ kind: string+ path: string | null+}++ /** Verdict of a breadcrumb ancestry reconstruction attempt (R7-M1 race).+ * 'superseded' means a newer Move, reconstruction, rename, or navigation+ * invalidated this attempt while its requests were in flight — callers must+ * leave the breadcrumb trail AND the recovery notice untouched so the+ * newer operation's state survives. */+ type TrailReconstructionOutcome = 'applied' | 'failed' | 'superseded'+const DRIVE = 'main'const PENDING_GFS_UPLOAD_KEY = 'evenfire:gfs-upload-v2:pending'const GFS_RESOURCE_DRAG_TYPE = 'application/x-evenfire-gfs-resource'@@@ -294,27 -251,47 +309,49 @@@ export function GfsBrowser(): React.JSXconst [dragOverFolderId, setDragOverFolderId] = useState<string | null>(null)const [movingResourceId, setMovingResourceId] = useState<string | null>(null)const [moveTarget, setMoveTarget] = useState<GfsChild | null>(null)+ // R5-M1 recovery: the Move PATCH succeeded but the breadcrumb trail could+ // not be reconstructed from the folder's new location. The trail stays+ // as-was — explicitly stale, never shortened and presented as+ // authoritative — with this notice until a retry rebuilds it or the+ // operator navigates away from the moved folder. The snapshot carries+ // IMMUTABLE identity only (R7-M1): name and version are deliberately NOT+ // captured, so a retry can never replay move-time metadata over a crumb+ // that a later rename/mutation has since advanced.+ const [trailRecovery, setTrailRecovery] = useState<{+ resourceId: string+ gfsUri: string+ } | null>(null)+ // Monotonic epoch for breadcrumb-reconstruction attempts (R7-M1 race). A+ // reconstruction (a move's rebuild or a Retry) captures the epoch at start+ // and may apply its result only while it is still the LATEST attempt. Any+ // newer reconstruction, a later Move's rebuild, a rename, or a navigation+ // that replaces/leaves the trail bumps the epoch, so a superseded in-flight+ // response is discarded instead of overwriting the newer ancestry or+ // clearing the newer operation's recovery notice. Appending a DESCENDANT+ // (openDirectory) does not bump: it never invalidates the retry target's+ // ancestors and the functional apply carries the live tail along.+ const trailReconstructionEpochRef = useRef(0)const draggingResourceRef = useRef<GfsChild | null>(null)const movingResourceRef = useRef<string | null>(null)- const [imagePreview, setImagePreview] = useState<{- byteLength: number- fileName: string- mimeType: string- rid: string- } | null>(null)- const [markdownPreview, setMarkdownPreview] = useState<{- byteLength: number- fileName: string- rid: string- } | null>(null)- const [videoPreview, setVideoPreview] = useState<{- byteLength: number- fileName: string- mimeType: string- rid: string- } | null>(null)+ const [imagePreview, setImagePreview] = useState<Extract<+ OpenPreviewState,+ { kind: 'image' }+ > | null>(null)+ const [markdownPreview, setMarkdownPreview] = useState<Extract<+ OpenPreviewState,+ { kind: 'markdown' }+ > | null>(null)+ const [videoPreview, setVideoPreview] = useState<Extract<+ OpenPreviewState,+ { kind: 'video' }+ > | null>(null)+ const [previewReloadVersion, setPreviewReloadVersion] = useState(0)+ const previewRefreshGenerationRef = useRef(0)+ const scheduleEntityChangeRecoveryRef = useRef<(() => void) | null>(null)+ const openPreviewsRef = useRef<OpenPreviewState[]>([])+ openPreviewsRef.current = [imagePreview, markdownPreview, videoPreview].filter(+ (preview): preview is OpenPreviewState => preview !== null+ )// Resource IDs currently streaming a download (disables that row's button).const [downloadingIds, setDownloadingIds] = useState<ReadonlySet<string>>(() => new Set())@@@ -529,230 -499,15 +566,239 @@@// Reload whenever the current folder changes (navigation).}, [current, load])+ // Navigating away from the moved folder retires the recovery notice: the+ // stale trail it labels is no longer on screen.+ useEffect(() => {+ if (!trailRecovery) return+ if (!crumbs.some(crumb => crumb.id === trailRecovery.resourceId)) {+ setTrailRecovery(null)+ }+ }, [crumbs, trailRecovery])++ useEffect(() => {+ const controller = new AbortController()+ let retryTimer: ReturnType<typeof setTimeout> | null = null+ let recoveryTimer: ReturnType<typeof setTimeout> | null = null+ let retryDelay = 500+ let recoveryDelay = 500+ let active = true+ let invalidateVisibleState: (cursor?: string) => void = () => undefined+ const scheduleRecovery = () => {+ if (!active || recoveryTimer) return+ const delay = recoveryDelay+ recoveryDelay = Math.min(recoveryDelay * 2, 5000)+ recoveryTimer = setTimeout(() => {+ recoveryTimer = null+ invalidateVisibleState()+ }, delay)+ }+ scheduleEntityChangeRecoveryRef.current = scheduleRecovery++ invalidateVisibleState = (cursor?: string) => {+ if (cursor) {+ streamCursorRef.current = cursor+ if (recoveryTimer) clearTimeout(recoveryTimer)+ recoveryTimer = null+ recoveryDelay = 500+ }+ childCacheRef.current.clear()+ revalidateNextLoadRef.current = false+ setSelected(null)+ setRenameTarget(null)+ setDeleteOpen(false)+ setMoveTarget(null)+ setItems([])+ setNextCursor(null)+ setError('')+ setLoading(true)+ const previews = openPreviewsRef.current+ if (previews.length > 0) {+ const generation = ++previewRefreshGenerationRef.current+ setImagePreview(preview => (preview ? { ...preview, unavailable: true } : preview))+ setMarkdownPreview(preview => (preview ? { ...preview, unavailable: true } : preview))+ setVideoPreview(preview => (preview ? { ...preview, unavailable: true } : preview))+ setPreviewReloadVersion(version => version + 1)+ void Promise.all<ResolvedPreviewUpdate | null>(+ previews.map(async preview => {+ try {+ const resolved = (await apiGet('/api/v1/gfs/resolve', {+ uri: preview.gfsUri,+ })) as {+ kind: string+ name: string+ bytes: number+ version: number+ rid: string+ }+ if (resolved.kind !== 'file') return null+ const imageMimeType = gfsImagePreviewMimeType(resolved.name)+ const videoMimeType = gfsVideoPreviewMimeType(resolved.name)+ const shared = {+ gfsUri: preview.gfsUri,+ byteLength: resolved.bytes,+ fileName: resolved.name,+ rid: resolved.rid,+ version: resolved.version,+ unavailable: false,+ }+ if (preview.kind === 'image') {+ return imageMimeType ? { ...shared, kind: 'image', mimeType: imageMimeType } : null+ }+ if (preview.kind === 'video') {+ return videoMimeType ? { ...shared, kind: 'video', mimeType: videoMimeType } : null+ }+ return isGfsMarkdownPreviewFile(resolved.name)+ ? { ...shared, kind: 'markdown' }+ : null+ } catch (error) {+ if (isTransientEntityChangeRefetchError(error)) scheduleRecovery()+ return null+ }+ })+ ).then(updates => {+ if (generation !== previewRefreshGenerationRef.current) return+ for (const update of updates) {+ if (!update) continue+ if (update.kind === 'image') {+ setImagePreview(current => (current?.gfsUri === update.gfsUri ? update : current))+ } else if (update.kind === 'video') {+ setVideoPreview(current => (current?.gfsUri === update.gfsUri ? update : current))+ } else {+ setMarkdownPreview(current => (current?.gfsUri === update.gfsUri ? update : current))+ }+ }+ setPreviewReloadVersion(version => version + 1)+ })+ }+ const visibleCrumb = currentCrumbRef.current+ if (!visibleCrumb) return+ if (visibleCrumb.id === null) {+ void load(visibleCrumb)+ return+ }++ const visibleResourceId = visibleCrumb.id+ const generation = ++hierarchyRefreshGenerationRef.current+ void (async () => {+ const rootCrumb = { ...(crumbsRef.current[0] ?? { id: null, rid: null, name: '/' }) }+ let refreshed: Crumb[] = [rootCrumb]+ let retryHierarchy = false+ try {+ const resolved = (await apiGet('/api/v1/gfs/resolve', {+ uri: `gfs://${DRIVE}/${visibleCrumb.rid ?? ridOfResourceId(visibleResourceId)}`,+ })) as GfsResolvedLocation+ if (resolved.kind !== 'directory' || !resolved.path?.startsWith('/')) {+ throw new Error('Current GFS folder is no longer available')+ }+ let path = ''+ for (const segment of resolved.path.split('/').filter(Boolean)) {+ path += `/${segment}`+ const ancestor = (await apiGet('/api/v1/gfs/by-path', {+ drive: DRIVE,+ path,+ })) as GfsResolvedLocation+ if (ancestor.kind !== 'directory') {+ throw new Error('GFS folder hierarchy changed during refresh')+ }+ refreshed.push({ id: ancestor.resourceId, rid: ancestor.rid, name: ancestor.name })+ }+ if (refreshed[refreshed.length - 1]?.id !== resolved.resourceId) {+ throw new Error('GFS folder hierarchy changed during refresh')+ }+ } catch (error) {+ // Do not keep presenting the stale hierarchy if the current folder+ // was deleted, moved during resolution, or is no longer authorized.+ if (isTransientEntityChangeRefetchError(error)) {+ retryHierarchy = true+ scheduleRecovery()+ } else {+ refreshed = [rootCrumb]+ }+ }+ if (+ generation !== hierarchyRefreshGenerationRef.current ||+ currentCrumbRef.current?.id !== visibleResourceId+ ) {+ return+ }+ if (!retryHierarchy) setCrumbs(refreshed)+ })()+ }++ async function consume(): Promise<void> {+ while (active && !controller.signal.aborted) {+ try {+ const cursor = streamCursorRef.current+ const query = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ''+ const response = await fetch(`/control-api/api/v1/gfs/entity-changes/stream${query}`, {+ cache: 'no-store',+ credentials: 'include',+ headers: { accept: 'application/x-ndjson' },+ signal: controller.signal,+ })+ if (!response.ok || !response.body) {+ throw new Error(`Entity-change stream returned ${response.status}`)+ }+ retryDelay = 500+ const reader = response.body.getReader()+ const decoder = new TextDecoder()+ let pending = ''+ try {+ for (;;) {+ const { done, value } = await reader.read()+ if (done) break+ pending += decoder.decode(value, { stream: true })+ if (pending.length > 32 * 1024)+ throw new Error('Entity-change frame exceeded its limit')+ let newline = pending.indexOf('\n')+ while (newline >= 0) {+ const line = pending.slice(0, newline).replace(/\r$/, '')+ pending = pending.slice(newline + 1)+ const frame = parseEntityChangeFrame(line)+ if (!frame) {+ newline = pending.indexOf('\n')+ continue+ }+ streamCursorRef.current = frame.cursor+ if (frame.type === 'resync_required' || frame.type === 'scope.invalidated') {+ invalidateVisibleState(frame.cursor)+ } else if (frame.type === 'stream.closing') {+ await reader.cancel()+ break+ }+ newline = pending.indexOf('\n')+ }+ }+ } finally {+ reader.releaseLock()+ }+ if (!controller.signal.aborted) throw new Error('Entity-change stream ended')+ } catch {+ if (!active || controller.signal.aborted) return+ // A reconnect may have missed commits. Refetch current authorized state+ // before retrying rather than assuming the old cursor is complete.+ invalidateVisibleState()+ await new Promise<void>(resolve => {+ retryTimer = setTimeout(resolve, retryDelay + Math.random() * retryDelay)+ })+ retryTimer = null+ retryDelay = Math.min(retryDelay * 2, 15_000)+ }+ }+ }++ void consume()+ return () => {+ active = false+ controller.abort()+ if (retryTimer) clearTimeout(retryTimer)+ if (recoveryTimer) clearTimeout(recoveryTimer)+ if (scheduleEntityChangeRecoveryRef.current === scheduleRecovery) {+ scheduleEntityChangeRecoveryRef.current = null+ }+ }+ }, [load])+useEffect(() => {if ((!selected && !renameTarget) || imagePreview || markdownPreview || videoPreview) returnfunction handleKeyDown(event: KeyboardEvent) {diff --cc desktop-app/ui/src/pages/__tests__/FilesPage.test.tsxindex 4fda53428,a9599643c..e3f3ddde0--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx@@@ -3055,10 -4076,11 +4079,12 @@@ describe('FilesPage', () =>mimeType: 'image/svg+xml',name: 'architecture.svg',bytes: 4,+ version: 1,}))- await waitFor(() => expect(screen.queryByRole('dialog', { name: 'Open GFS link' })).toBeNull())+ await waitFor(() =>+ expect(screen.queryByRole('dialog', { name: 'Open EvenDrive link' })).toBeNull()+ )expect(screen.getByRole('button', { name: 'Options for Shared with me' })).toBeTruthy()})diff --cc scripts/tests/test-control-api-runtime-access-contract.shindex 06f28f63f,6545e77c3..ff774eac2--- a/scripts/tests/test-control-api-runtime-access-contract.sh+++ b/scripts/tests/test-control-api-runtime-access-contract.sh@@@ -9,21 -9,19 +9,22 @@@ relation_count="$(awk -F '\t' '!/^[[:spduplicate_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ { seen[$1]++ } END { for (name in seen) if (seen[name] > 1) count++ } END { print count + 0 }' "$PROFILE_FILE")"invalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_dml|upsert|append|read|link_lifecycle|none)$/) { count++ } END { print count + 0 }' "$PROFILE_FILE")"- if [[ "$relation_count" != "95" || "$duplicate_count" != "0" || "$invalid_count" != "0" ]] || \-[[ "$relation_count" == "90" ]]-[[ "$duplicate_count" == "0" ]]-[[ "$invalid_count" == "0" ]]-grep -qx $'gfs_desktop_operator_links\tlink_lifecycle' "$PROFILE_FILE"-grep -qx $'desktop_user_retirement_operations\tlink_lifecycle' "$PROFILE_FILE"-grep -qx $'mcp_secret_rollback_permits\tlegacy_dml' "$PROFILE_FILE"--grep -Fq '$2 !~ /^(legacy_dml|upsert|append|read|link_lifecycle|none)$/' "$MIGRATION_SCRIPT"-grep -Fq "('INSERT', expected.access_profile IN ('legacy_dml', 'upsert', 'append', 'link_lifecycle'))" "$MIGRATION_SCRIPT"-grep -Fq "('UPDATE', expected.access_profile IN ('legacy_dml', 'upsert', 'link_lifecycle'))" "$MIGRATION_SCRIPT"-grep -Fq "('DELETE', expected.access_profile IN ('legacy_dml'))" "$MIGRATION_SCRIPT"-grep -Fq "('TRUNCATE', false)" "$MIGRATION_SCRIPT"-grep -Fq "('REFERENCES', false)" "$MIGRATION_SCRIPT"-grep -Fq "('TRIGGER', false)" "$MIGRATION_SCRIPT"++if [[ "$relation_count" != "96" || "$duplicate_count" != "0" || "$invalid_count" != "0" ]] || \+ ! grep -qx $'entity_change_feed\tnone' "$PROFILE_FILE" || \+ ! grep -qx $'entity_change_outbox\tnone' "$PROFILE_FILE" || \+ ! grep -qx $'entity_change_watermark\tnone' "$PROFILE_FILE" || \++ ! grep -qx $'mcp_secret_rollback_permits\tlegacy_dml' "$PROFILE_FILE" || \+ ! grep -qx $'gfs_desktop_operator_links\tlink_lifecycle' "$PROFILE_FILE" || \+ ! grep -qx $'desktop_user_retirement_operations\tlink_lifecycle' "$PROFILE_FILE" || \+ ! grep -Fq '$2 !~ /^(legacy_dml|upsert|append|read|link_lifecycle|none)$/' "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('INSERT', expected.access_profile IN ('legacy_dml', 'upsert', 'append', 'link_lifecycle'))" "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('UPDATE', expected.access_profile IN ('legacy_dml', 'upsert', 'link_lifecycle'))" "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('DELETE', expected.access_profile IN ('legacy_dml'))" "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('TRUNCATE', false)" "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('REFERENCES', false)" "$MIGRATION_SCRIPT" || \+ ! grep -Fq "('TRIGGER', false)" "$MIGRATION_SCRIPT"; then+ printf 'FAIL: control-api runtime access contract is incomplete or not exact\n' >&2+ exit 1+fiprintf 'PASS: control-api runtime link_lifecycle contract is explicit and least privilege\n'diff --cc scripts/tests/test-gcp-scripts.shindex a997dac95,31111c09a..85bf7380e--- a/scripts/tests/test-gcp-scripts.sh+++ b/scripts/tests/test-gcp-scripts.sh@@@ -1464,12 -1464,9 +1464,12 @@@ assert_control_api_runtime_access_contrinvalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_dml|upsert|append|read|link_lifecycle|none)$/) { count++ } END { print count + 0 }' "$profile_file")"sequence_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ { count++ } END { print count + 0 }' "$sequence_profile_file")"sequence_duplicate_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ { seen[$1]++ } END { for (name in seen) if (seen[name] > 1) count++ } END { print count + 0 }' "$sequence_profile_file")"- sequence_invalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_rw|consume)$/) { count++ } END { print count + 0 }' "$sequence_profile_file")"+ sequence_invalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_rw|consume|none)$/) { count++ } END { print count + 0 }' "$sequence_profile_file")"- if [[ "$relation_count" == "95" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \- if [[ "$relation_count" == "90" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \++ if [[ "$relation_count" == "96" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \+ grep -qx $'entity_change_feed\tnone' "$profile_file" && \+ grep -qx $'entity_change_outbox\tnone' "$profile_file" && \+ grep -qx $'entity_change_watermark\tnone' "$profile_file" && \grep -qx $'gfs_upload_parts\tnone' "$profile_file" && \grep -qx $'gfs_upload_sessions\tnone' "$profile_file" && \grep -qx $'llm_allowed_models\tlegacy_dml' "$profile_file" && \