fix(socialMeta): coerced numeric/boolean override silently dropped#7692
Merged
JohnMcLear merged 2 commits intodevelopfrom May 7, 2026
Merged
fix(socialMeta): coerced numeric/boolean override silently dropped#7692JohnMcLear merged 2 commits intodevelopfrom
JohnMcLear merged 2 commits intodevelopfrom
Conversation
Qodo flagged on PR #7691: Settings.coerceValue() turns numeric-looking env vars into numbers and "true"/"false" into booleans, so e.g. SOCIAL_META_DESCRIPTION="2026" arrives at the resolver as the number 2026. The previous resolver gated on `typeof override === 'string'`, so it silently fell back to the i18n catalog with no warning — the operator's docker config would appear broken. Accept string|number|boolean and stringify before the empty-check; null / undefined / unsupported types still fall through to the catalog. Two new unit specs cover the numeric and boolean coercion paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
4 tasks
Review Summary by QodoFix socialMeta resolver silently dropping coerced numeric/boolean overrides
WalkthroughsDescription• Accept coerced numeric/boolean overrides in socialMeta resolver • Stringify override values before empty-check validation • Add unit tests for numeric and boolean coercion paths • Prevent silent fallback to i18n catalog on type mismatch Diagramflowchart LR
A["Settings.coerceValue<br/>coerces env vars"] -->|"numeric/boolean<br/>override"| B["resolveDescriptionWithOverride"]
B -->|"Accept string|number|boolean"| C["Stringify value"]
C -->|"Non-empty after trim"| D["Return override"]
C -->|"Empty/whitespace"| E["Fall back to i18n"]
B -->|"null/undefined"| E
File Changes1. src/node/utils/socialMeta.ts
|
Code Review by Qodo
1.
|
Action Qodo bug-find: SettingsType.socialMeta.description and SocialMetaSettings.description still claimed `string | null`, but Settings.coerceValue() can produce number|boolean from env-var-driven config — the previous resolver fix was correct at runtime but the type mismatch forced `as unknown as string` casts in the new tests. Widen both declared types to `string | number | boolean | null` to match runtime reality, drop the typeof string|number|boolean guards in the resolver (the union now narrows automatically) and remove the test casts. Behaviour is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Action follow-up to Qodo's bug-find on #7691.
Settings.coerceValue()turns numeric-looking env vars into numbers and"true"/"false"into booleans, so e.g.SOCIAL_META_DESCRIPTION=\"2026\"arrives at the resolver as the number2026— and the previous resolver gated ontypeof override === 'string', so it silently fell back to the i18n catalog. Operator's docker config would appear broken with no log.Resolver now accepts
string | number | boolean, stringifies, and runs the same empty/whitespace-treated-as-unset check as before.null/undefined/ unsupported types still fall through to the i18n catalog.Test plan
SOCIAL_META_DESCRIPTION=2026→ og:description renders as"2026"🤖 Generated with Claude Code