Resolves the effective chart-review settings from LaunchDarkly.
The chartReviewSettingOverrides JSON flag is merged OVER
DEFAULT_CHART_REVIEW_SETTINGS — never taken wholesale. A partial flag value
(e.g. a LaunchDarkly environment that defines only some of the keys) must
still leave every required field (maxTokens) populated. Taking the flag value as-is
({ ...overrides }) was what let an environment switch enqueue chart-review
jobs whose params had undefined required fields; those failed the
jobbable's zod validate() and were silently dropped, so the queues stopped
processing.
The dedicated canary booleans live in their own boolean flags (so they can
use LD percentage rollouts / entity targeting independently of the settings
JSON) and are applied last, taking precedence over the JSON.
It is provider-agnostic: callers pass any BaseFeatureFlagProvider plus a
logger and FlagContext. The tRPC paths (run mutation,
update-ai-summarized-note, superadmin requeue) pass the request-scoped
provider; the triggered-chart-review jobbable passes the process-wide
server provider keyed on the entity. Keeping resolution in one place means
triggered runs honor the same entity-/LD-targeted settings manual runs do.
Lives in @repo/legacy/chart-review (next to settings.ts /
DEFAULT_CHART_REVIEW_SETTINGS) so both @repo/trpc and @repo/jobs can
import it without @repo/jobs depending on @repo/trpc.
Resolves the effective chart-review settings from LaunchDarkly.
The
chartReviewSettingOverridesJSON flag is merged OVERDEFAULT_CHART_REVIEW_SETTINGS— never taken wholesale. A partial flag value (e.g. a LaunchDarkly environment that defines only some of the keys) must still leave every required field (maxTokens) populated. Taking the flag value as-is ({ ...overrides }) was what let an environment switch enqueue chart-review jobs whose params hadundefinedrequired fields; those failed the jobbable's zodvalidate()and were silently dropped, so the queues stopped processing.The dedicated canary booleans live in their own boolean flags (so they can use LD percentage rollouts / entity targeting independently of the settings JSON) and are applied last, taking precedence over the JSON.
It is provider-agnostic: callers pass any
BaseFeatureFlagProviderplus a logger andFlagContext. The tRPC paths (runmutation,update-ai-summarized-note, superadminrequeue) pass the request-scoped provider; the triggered-chart-review jobbable passes the process-wide server provider keyed on the entity. Keeping resolution in one place means triggered runs honor the same entity-/LD-targeted settings manual runs do.Lives in
@repo/legacy/chart-review(next tosettings.ts/DEFAULT_CHART_REVIEW_SETTINGS) so both@repo/trpcand@repo/jobscan import it without@repo/jobsdepending on@repo/trpc.