Repository navigation
Modules declare themselves with a descriptor instead of six registration edits #17
Description
Activity
Chaque src/Config-*.ps1 exporte Get-Wcd<Nom>Descriptor. L'orchestrateur globe Config-*.ps1; le tableau $modules et le switch ($modName) ont disparu, et Get-WcdModuleProgressPlan / Get-WcdTechnicalStepLabels assemblent des descripteurs.
Un ecart avec l'issue. L'issue dit "la checklist, en ordre d'execution". Elle ne l'est pas, et ne l'a jamais ete: les Modules tournent Identity -> Power -> Decimal -> Taskbar -> Language -> Applications -> ..., la checklist se lit Identity -> Restart -> Taskbar -> Language -> Keyboard -> Decimal -> Power -> ... Un descripteur porte donc Order et RowOrder. Les deux vivent dans le fichier du Module: c'est toujours un point d'enregistrement, pas six.
Ce que le descripteur absorbe:
- Etapes dependantes du Form Factor — une Etape porte
Planned = $falseplutot que d'etre absente.Config-Powerplanifie toujours cinq Etapes sur portable et deux sur bureau, et les trois libelles batterie/capot survivent pour le Diagnostic. - Etapes issues du manifeste — le descripteur recoit
$Config. - Modules conditionnels —
Steps = @()veut toujours dire "sauter ce Module", et ses lignes sont quand meme emises: un renommage refuse doit toujours au technicien une Etape manuelle qui le dit. - Lignes qui ne sont pas une-par-Module — une ligne est soit
@{ Label; Steps }soit un@{ Label; Kind; Detail }fixe, avecMissingKind/MissingDetail/OmitWhenMissingpour les cas qui en ont besoin. - La ligne de redemarrage reste dans le Diagnostic, comme l'issue le demande, mais nommee:
Resolve-WcdRestartEntry. Les Etapes manuelles finales aussi — elles n'appartiennent a aucun Module.
Les descripteurs prennent -Translations plutot que de lire $script:T, donc un Module reste testable seul.
Sortie identique octet pour octet, verifiee. Un harnais point-source les deux arbres et compare le plan de progression, chaque ligne de checklist (Step, Label, Kind, Detail) et le rendu, pour 7 scenarios x 2 langues — portable/bureau, workstation/vdi, applications refusees, identite appliquee, redemarrage en attente, sans imprimante, winget absent, rien n'a tourne, alimentation non elevee. 554 lignes, zero difference.
tests/ModuleDescriptor.Tests.ps1 passe les douze Modules par Test-WcdModuleDescriptor sous trois profils d'execution, verifie l'unicite de Order/RowOrder, verifie que chaque ligne ne reference que des Etapes que le Module declare, et verifie que le garde rejette bien chaque champ manquant.
Supprimes comme morts: $T.ModuleNotFound dans les deux tables (un fichier globe ne peut pas etre introuvable) et les libelles PrinterAdd / PrinterSkip, qu'aucun Module n'emettait.
Chapitre 7 du manuel reecrit: un fichier, un bloc de code, plus un tableau expliquant chaque champ. Le libelle de ligne dans les deux tables $T est signale comme la seule chose encore hors du fichier — et le test de parite de #20 attrape l'oubli du second.
Chapter 7 of the manual documents adding a Module as "four small edits, all in
files you already have." It is really six, across three files, and the manual is
honest about it — which is the tell. A seam that needs a six-item checklist
outside the Module is not a seam.
Today,
src/Config-MyThing.ps1must also be declared in:Invoke-WcdConfiguration.ps1-> the$modulesarrayInvoke-WcdConfiguration.ps1-> theswitch ($modName)dispatch armWcdHelpers.ps1->Get-WcdModuleProgressPlanWcdHelpers.ps1->Get-WcdTechnicalStepLabelsInvoke-WcdConfiguration.ps1->$T.Checklist, in both language tablesInvoke-WcdConfiguration.ps1->Get-WcdFinalChecklistEntriesMiss one and nothing fails. A missing progress-plan entry drops the Module from
the run silently — the
$moduleStepPlan.ContainsKeyguard treats "not planned"and "planned as empty" differently, and a Module absent from the hashtable runs
with a
$nullstep list. A missing$T.Checklistkey renders a blank label onthe checklist.
The descriptor
Each
Config-*.ps1exports one function returning what the orchestrator needs:The orchestrator globs
src/Config-*.ps1in run order, dot-sources each, callsits descriptor, and builds the progress plan, the step labels and the checklist
rows from what comes back.
Get-WcdModuleProgressPlanandGet-WcdTechnicalStepLabelsbecome the thing that assembles descriptorsrather than the thing that hardcodes twelve Modules.
What the descriptor has to handle
The current hardcoded tables are not uniform, and the descriptor has to absorb
that or it is not an improvement:
Config-Powerplans five Steps on a Laptopand two on a Desktop; the checklist row has the same split. Hence
$ExecutionOptionsas a descriptor parameter.Config-ApplicationsandConfig-Printergettheir Step keys and labels from the manifest at runtime. Hence
$Config.Config-Identityplans zero Steps when thetechnician declined both, and the orchestrator skips the Module entirely.
An empty
Stepsarray must keep meaning exactly that.Config-Diskproduces two rows,Config-WindowsUpdatefolds two Steps into one row, and the restart row israised from Results across two Modules. The restart row is special enough to
stay in the Diagnostic rather than move into a descriptor.
ordered list of Module names, or add an
Orderfield — but that is oneregistration point, not six.
Ordering
Do #16 first. This rewrites
Get-WcdFinalChecklistEntries, and thatfunction currently has no test to rewrite it against.
Done when
Config-*.ps1exports a descriptor function$modulesswitch ($modName)dispatch is deletedGet-WcdModuleProgressPlanandGet-WcdTechnicalStepLabelsassemble from descriptorsConfig-Identitytests/gains a descriptor-contract test every Module is run through