Skip to content

Add settex import: adopt an existing configuration, proven equivalent - #73

Merged
74nu5 merged 1 commit into
mainfrom
feat/settex-import
Jul 19, 2026
Merged

Add settex import: adopt an existing configuration, proven equivalent#73
74nu5 merged 1 commit into
mainfrom
feat/settex-import

Conversation

@74nu5

@74nu5 74nu5 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

La voie d'adoption pour le problème qui a fait naître ce projet. Personne ne réécrit à la main une configuration de production qui marche — et une migration probablement juste est pire que pas de migration : une clé manquée se manifeste à l'exécution, dans l'environnement où elle a été manquée.

La commande

settex import path/to/appsettings.json
#   + environment Development from appsettings.Development.json
# ✓ Imported 1 environment(s); round-trip verified exact.
#   → path/to/appsettings.settex

Les appsettings.{Environment}.json voisins deviennent des blocs env automatiquement. Avant d'écrire quoi que ce soit, la commande compile le texte généré à travers le vrai pipeline et compare chaque clé aplatie — comme le provider .NET les voit, séparées par : et insensibles à la casse — avec les originaux. Une seule clé qui diffère, et rien n'est écrit : les écarts sont listés.

La comparaison porte sur la configuration effective par environnement (base fusionnée avec l'overlay), parce que c'est ce qui tourne — la forme exacte de l'overlay est un détail d'implémentation du delta.

Ce que la génération encaisse

  • Clés qui sont des mots-clés Settex (env, settings — un vrai config peut légitimement les avoir) → citées
  • Clés non-identifiantes ("Microsoft.AspNetCore", "Content-Type") → citées
  • ${ littéral dans une valeur → échappé en $${
  • Antislashs, guillemets, sauts de ligne, tabulations → échappés
  • Tableaux d'objets → item { }, tableaux et objets vides préservés
  • Clé contenant "${"refus bruyant, le parser rejetant l'interpolation dans les clés

Prouvé sur la réalité avant d'être commité

La configuration de production du serveur Bitwarden (148 clés aplaties, 26 objets de tableau, tableaux vides, imbrication profonde) s'importe avec parité exacte — vérifiée par le contrôle intégré et indépendamment par un vrai ConfigurationBuilder chargeant les deux paires côte à côte.

Tests

Cinq tests, dont deux qui prouvent que le vérificateur sait échouer — un vérificateur qui ne peut pas échouer est un slogan, pas un contrôle. Le kitchen-sink couvre chaque forme qui a cassé quelque chose durant cette campagne.

415 → 420 tests.

🤖 Generated with Claude Code

The adoption path for the problem this project exists to solve. Nobody rewrites a
working production configuration by hand, and a migration that is merely probably
right is worse than none — a missed key surfaces at runtime, in the environment
where it was missed.

settex import takes the base appsettings.json, picks up the sibling
appsettings.{Environment}.json files as env blocks, and generates the .settex.
Before writing anything it compiles the generated text through the real pipeline
and compares every flattened key — the way .NET's configuration provider sees
them, colon-separated and case-insensitive — against the originals. One differing
key and nothing is written; the differences are listed instead. The effective
configuration per environment is compared, base merged with overlay, because that
is what runs — the overlay's exact shape is an implementation detail of the delta.

Generation handles what a real family contains: keys that are Settex keywords
(env, settings — a real config can legitimately have them) and keys that are not
identifiers are quoted; a literal ${ in a value is escaped to $${; backslashes,
quotes, newlines and tabs are escaped; arrays of objects become tagged items;
empty arrays and empty objects survive. A key containing "${" is refused loudly,
since the parser rejects interpolation in keys and an unquotable key would
otherwise produce a file that cannot compile.

Proven against production reality before being committed: the Bitwarden server's
real Api configuration — 148 flattened keys, 26 array objects, empty arrays, deep
nesting — imports with exact parity, verified both by the built-in check and
independently by a real ConfigurationBuilder loading the original pair and the
generated pair side by side.

Five tests. The kitchen-sink round-trip covers every shape that broke something
this campaign; two prove the verifier itself can fail — a verifier that cannot is
a slogan, not a check; one pins the loud refusal; and a CLI end-to-end test
imports a family with a keyword key and an object array, then builds the written
file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@74nu5
74nu5 merged commit b346927 into main Jul 19, 2026
3 checks passed
@74nu5
74nu5 deleted the feat/settex-import branch July 19, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant