diff --git a/.github/workflows/baseimage.yaml b/.github/workflows/baseimage.yaml index 4e4e35de0e..d4c28a7968 100644 --- a/.github/workflows/baseimage.yaml +++ b/.github/workflows/baseimage.yaml @@ -41,7 +41,7 @@ jobs: node-version-file: '.nvmrc' - uses: pnpm/action-setup@v5 with: - version: latest + version: 10 - name: Docker build run: | cd ./dev/base-image diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8aa098d587..2e4df4f069 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -672,7 +672,7 @@ jobs: node-version-file: '.nvmrc' - uses: pnpm/action-setup@v5 with: - version: latest + version: 10 - name: Cache node modules uses: actions/cache@v5 env: diff --git a/foundations/core/packages/core/src/classes.ts b/foundations/core/packages/core/src/classes.ts index dc242de928..c9db96401a 100644 --- a/foundations/core/packages/core/src/classes.ts +++ b/foundations/core/packages/core/src/classes.ts @@ -668,6 +668,7 @@ export interface Version extends Doc { export interface MigrationState extends Doc { plugin: string state: string + durationMs?: number } /** diff --git a/foundations/core/packages/model/src/migration.ts b/foundations/core/packages/model/src/migration.ts index 0c97d1ebb0..c82b8c2eaf 100644 --- a/foundations/core/packages/model/src/migration.ts +++ b/foundations/core/packages/model/src/migration.ts @@ -176,22 +176,28 @@ export async function tryMigrate ( const states = client.migrateState.get(plugin) ?? new Set() for (const migration of migrations) { if (states.has(migration.state)) continue - if (migration.mode == null || migration.mode === mode) { - try { - client.logger.log('running migration', { plugin, state: migration.state }) - await migration.func(client, mode) - } catch (err: any) { - client.logger.error('Failed to run migration', { plugin, state: migration.state, err }) - Analytics.handleError(err) - continue - } + // Do not persist MigrationState when this migration is not applicable to the + // current mode — otherwise it would be skipped forever on the correct mode. + if (migration.mode != null && migration.mode !== mode) { + continue } + const startedAt = Date.now() + try { + client.logger.log('running migration', { plugin, state: migration.state }) + await migration.func(client, mode) + } catch (err: any) { + client.logger.error('Failed to run migration', { plugin, state: migration.state, err }) + Analytics.handleError(err) + continue + } + const finishedAt = Date.now() const st: MigrationState = { plugin, state: migration.state, + durationMs: finishedAt - startedAt, space: core.space.Configuration, modifiedBy: core.account.System, - modifiedOn: Date.now(), + modifiedOn: finishedAt, _class: core.class.MigrationState, _id: generateId() } @@ -212,19 +218,23 @@ export async function tryUpgrade ( const states = state.get(plugin) ?? new Set() for (const upgrades of migrations) { if (states.has(upgrades.state)) continue - const _client = await client() - if (upgrades.mode == null || upgrades.mode === mode) { - try { - await upgrades.func(_client, mode) - } catch (err: any) { - console.error(err) - Analytics.handleError(err) - continue - } + if (upgrades.mode != null && upgrades.mode !== mode) { + continue } + const _client = await client() + const startedAt = Date.now() + try { + await upgrades.func(_client, mode) + } catch (err: any) { + console.error(err) + Analytics.handleError(err) + continue + } + const finishedAt = Date.now() const st: Data = { plugin, - state: upgrades.state + state: upgrades.state, + durationMs: finishedAt - startedAt } const tx = new TxOperations(_client, core.account.System) await tx.createDoc(core.class.MigrationState, core.space.Configuration, st) diff --git a/models/card/src/index.ts b/models/card/src/index.ts index e7c21586c4..14c76397eb 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -1153,18 +1153,6 @@ function defineTabs (builder: Builder): void { card.section.Properties ) - builder.createDoc( - card.class.CardSection, - core.space.Model, - { - label: card.string.RichtextProperties, - component: card.sectionComponent.MarkupPropertiesSection, - order: 150, - navigation: [] - }, - card.section.MarkupProperties - ) - builder.createDoc( card.class.CardSection, core.space.Model, diff --git a/models/core/src/core.ts b/models/core/src/core.ts index 0866c91bb7..02e69d551b 100644 --- a/models/core/src/core.ts +++ b/models/core/src/core.ts @@ -358,6 +358,7 @@ export class TVersion extends TDoc implements Version { export class TMigrationState extends TDoc implements MigrationState { plugin!: string state!: string + durationMs?: number } @Model(core.class.PluginConfiguration, core.class.Doc, DOMAIN_MODEL) diff --git a/models/process/src/index.ts b/models/process/src/index.ts index 5f939b9f42..562b75eeb1 100644 --- a/models/process/src/index.ts +++ b/models/process/src/index.ts @@ -550,7 +550,7 @@ export function createModel (builder: Builder): void { { key: 'showDone', type: 'toggle', - defaultValue: true, + defaultValue: false, actionTarget: 'query', action: process.function.ShowDoneQuery, label: process.string.ShowDone diff --git a/plugins/card-resources/src/components/MarkupProperties.svelte b/plugins/card-resources/src/components/MarkupProperties.svelte index e2c3ddd382..d0a6b1d8f4 100644 --- a/plugins/card-resources/src/components/MarkupProperties.svelte +++ b/plugins/card-resources/src/components/MarkupProperties.svelte @@ -63,14 +63,9 @@ {#each keys as key} -
+
+