config-validator shows inconsistent results when using JSON5 or JSONC config #44808
Replies: 1 comment
|
The reason this can differ between Path 1 — validation (fresh, per-branch)
// lib/workers/repository/reconfigure/utils.ts
export async function getReconfigureConfig(branchName) {
await scm.checkoutBranch(branchName);
const configFileName = await detectConfigFile();
...
configFileParsed = parseJson(configFileRaw, configFileName);
Path 2 — the PR comment (cache-first)The comment is not built from the config that was just validated. newConfig = await mergeInheritedConfig(newConfig);
newConfig = await mergeRenovateConfig(newConfig, reconfigureBranch);
await scm.checkoutBranch(config.defaultBranch!);
extractResult = await extractDependencies(newConfig, false);
...
commentEnsured = await ensureReconfigurePrComment(newConfig, ...);and // lib/workers/repository/init/merge.ts
export async function detectRepoFileConfig(branchName?: string) {
const cache = getCache();
let { configFileName } = cache;
if (isNonEmptyString(configFileName)) {
configFileRaw = await platform.getRawFile(configFileName, undefined, branchName);
if (configFileRaw) {
let configFileParsed = parseJson(configFileRaw, configFileName);
return { configFileName, configFileParsed }; // <-- early return
}
logger.debug('Existing config file no longer exists');
delete cache.configFileName;
}
// only now does it fall through to a fresh detectConfigFile()
Your Mend-hosted config has How to confirm which case you're inTwo things to check in the debug log for the reconfigure run:
If both files are present, note that If Workaround meanwhileSince the divergence is cache-driven, forcing a cache miss should make the comment match validation — either drop Repro repo is helpful, thanks for including it — a maintainer can tell quickly from it whether both files coexist on the branch, which distinguishes the two cases above. |
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
A Mend.io-hosted app
Which platform you running Renovate on?
GitHub.com
Which version of Renovate are you using?
43.275.2
Please tell us more about your question or problem
I created a branch
renovate/reconfigurewhere I added arenovate.json5file. I use the:enablePrecommitpreset. However, the Renovate comment explaining what will happen does not show that it is enabled and that I will get a PR for a pre-commit hook.When the file is
renovate.jsonit works. See this comment: mschoettle/renovate-test-reconfigure#1 (comment) (click on "edited" and the first entry, it will show the diff going from.jsonto.json5).The problem also happens with
.jsonc(noticed in a private repo).Minimal reproduction repo: https://github.com/mschoettle/renovate-test-reconfigure
Logs (if relevant)
Logs
All reactions