Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(server): use RuntimeConfigModel on Runtime service #10036

Draft
wants to merge 1 commit into
base: 02-08-feat_server_impl_runtimeconfigmodel
Choose a base branch
from

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Feb 8, 2025

move runtime from base to core

close CLOUD-120

@github-actions github-actions bot added app:server test Related to test cases labels Feb 8, 2025
Copy link
Member Author

fengmk2 commented Feb 8, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 7c80c35 to e92a1c5 Compare February 8, 2025 06:00
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from 8e761a8 to 87450be Compare February 8, 2025 06:00
@fengmk2 fengmk2 requested a review from forehalo February 8, 2025 06:01
@fengmk2 fengmk2 marked this pull request as ready for review February 8, 2025 06:01
@graphite-app graphite-app bot requested review from a team February 8, 2025 06:01
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from 87450be to 7070771 Compare February 8, 2025 06:03
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from e92a1c5 to 14064ca Compare February 8, 2025 06:03
Copy link

codecov bot commented Feb 8, 2025

Codecov Report

Attention: Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.

Project coverage is 53.99%. Comparing base (8a49bc4) to head (67b19c7).

Files with missing lines Patch % Lines
...ackages/backend/server/src/core/runtime/service.ts 87.09% 4 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                              @@
##           02-08-feat_server_impl_runtimeconfigmodel   #10036      +/-   ##
=============================================================================
- Coverage                                      54.02%   53.99%   -0.03%     
=============================================================================
  Files                                           2323     2323              
  Lines                                         107064   107008      -56     
  Branches                                       17736    17734       -2     
=============================================================================
- Hits                                           57843    57782      -61     
- Misses                                         47892    47897       +5     
  Partials                                        1329     1329              
Flag Coverage Δ
server-test 78.30% <93.10%> (-0.05%) ⬇️
unittest 31.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 14064ca to 470d695 Compare February 10, 2025 08:54
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from 7070771 to f34cea6 Compare February 10, 2025 08:54
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 470d695 to 841df8c Compare February 10, 2025 10:54
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch 2 times, most recently from 7f53769 to f712fe0 Compare February 10, 2025 13:08
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 841df8c to 886fa35 Compare February 10, 2025 13:08
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from f712fe0 to 879dc03 Compare February 12, 2025 02:01
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 886fa35 to a3c58bd Compare February 12, 2025 02:01
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from 879dc03 to cb2a226 Compare February 13, 2025 15:34
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from a3c58bd to 88c9ebc Compare February 13, 2025 15:34
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 88c9ebc to 309176f Compare February 14, 2025 02:56
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch 4 times, most recently from af99810 to 0505384 Compare February 14, 2025 04:33
@fengmk2 fengmk2 force-pushed the 02-08-feat_server_impl_runtimeconfigmodel branch from 309176f to 8a49bc4 Compare February 14, 2025 15:30
@fengmk2 fengmk2 force-pushed the 02-08-refactor_server_use_runtimeconfigmodel_on_runtime_service branch from 0505384 to 67b19c7 Compare February 14, 2025 15:30
Page,
Edgeless,
}

export enum WorkspaceRole {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the pr clean

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will rewrite it after 0.20 released.

@fengmk2 fengmk2 marked this pull request as draft February 20, 2025 07:28
@@ -1,4 +1,4 @@
import { FlattenedAppRuntimeConfig } from '../config/types';
import { FlattenedAppRuntimeConfig } from '../../base/config/types';

declare global {
interface Events {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line +5]

time to impl it.

'runtime.init'
'runtime.changed'

instances can keep runtime config in memory to avoid read it every time used. or adjust the runtime when value changed

@OnEvent('runtime.changed')
updateConcurrency(changes: Partial<Runtime>) {
  if (changes['job/worker.concurrency']) {
    this.worker.concurrency = changes['job/worker.concurrency']
  }
}

See this comment inline on Graphite.

deletedAt: null,
},
});
const existingConfigs = await this.models.runtimeConfig.findManyByModule();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to always run data migration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and there was a bug regarding this. when beta introduces a new config, and stable got redeployed, the new one will be marked deleted and cause beta down

value: value as any,
deletedAt: null,
},
const config = await this.models.runtimeConfig.upsert(key, {
Copy link
Member

@forehalo forehalo Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a way to define validator on values. basic type validator for String/Number/Boolean, or custom like Semver.valid for versioning checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:server test Related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants