Let a configuration key contain a dot - #67
Merged
Merged
Conversation
Fixes H2 of the sixth cold review.
The dot is this language's path separator, so Microsoft.AspNetCore written bare
meant four nested keys. .NET flattens configuration with a colon and treats a dot
as an ordinary character, so Logging:LogLevel:Microsoft.AspNetCore — the log-level
filter every ASP.NET Core application sets — needs a literal dot inside one key.
It could not be written at all, and the failure was silent: the generated file
looked reasonable, the logger built a rule for category "Microsoft:AspNetCore",
and the filter the author asked for was discarded. The README's own ASP.NET Core
example carried the defect.
A path segment may now be a quoted string, accepted anywhere an identifier is: on
its own, in the middle of a dotted path (Nested."A.B".C), and as a nested block
name. The bare form still nests, so no existing configuration changes meaning.
It also covers keys with any other punctuation — "Content-Type" needed quoting
just as much.
An interpolation inside a key is refused rather than taken literally. A key is
part of the file's structure and has to be known before anything is evaluated, so
"${x}" would be a trap either way; saying so is better than guessing.
Verified end to end against a real ConfigurationBuilder: the generated file
flattens to Logging:LogLevel:Microsoft.AspNetCore, which is what the logging
filter matches on.
Seven tests, including two guards — the bare dotted path must still nest, and the
rejections must fire — plus the README example corrected and the feature
documented.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Corrige H2 de la sixième revue.
Le problème
Le point est le séparateur de chemin du langage, donc
Microsoft.AspNetCoreécrit nu signifiait quatre clés imbriquées. Or .NET aplatit la configuration avec un deux-points et traite le point comme un caractère ordinaire :Logging:LogLevel:Microsoft.AspNetCore— le filtre de niveau de log que toute application ASP.NET Core règle — a besoin d'un point littéral dans une seule clé.C'était inexprimable, et l'échec était silencieux : le fichier généré avait l'air correct, le logger construisait une règle pour la catégorie
Microsoft:AspNetCore, et le filtre demandé était jeté. L'exemple ASP.NET Core du README portait le défaut.Le design
Un segment de chemin peut être une chaîne entre guillemets, acceptée partout où un identifiant l'est :
La forme nue continue d'imbriquer, donc aucune configuration existante ne change de sens.
Une interpolation dans une clé est refusée plutôt que prise au pied de la lettre : une clé fait partie de la structure du fichier et doit être connue avant toute évaluation, donc
"${x}"serait un piège dans les deux sens — le dire vaut mieux que le deviner.Vérification
Bout en bout contre un vrai
ConfigurationBuilder:Sept tests, dont deux garde-fous — le chemin pointé nu doit toujours imbriquer, et les refus doivent se déclencher. Exemple du README corrigé et fonctionnalité documentée.
384 → 391 tests.
🤖 Generated with Claude Code