Skip to content

Commit eb34e19

Browse files
aledbfclaude
andcommitted
fix(parity): 5 divergencias + 8 casos nuevos (wave A, batch 1)
Divergencias destapadas por la auditoría de cobertura, corregidas y validadas contra el oráculo (contract lane): - features test: wording de mutua-exclusión alineado a TS ('Cannot combine ...') - templates apply: mensaje fijo 'Invalid template arguments provided.' (sin detalle del parser) - set-up: faltaba validateRemoteEnvs (--remote-env malformado ahora rechazado en parse) - features/templates publish: --namespace faltante emite 'Missing required argument: namespace' (era el phrasing de cobra por MarkFlagRequired) Casos nuevos (contract, matched): features-publish.missing-required, templates.publish-missing-namespace, up.invalid-default-user-env-probe, build.compose-output-not-supported, features.test-reject-{global-scenarios-and-features, skip-scenarios-and-global-scenarios}, templates.apply-invalid-template-args-exit1, set-up.invalid-remote-env. Contract lane: 64 matched, 0 failed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4e8c0e5 commit eb34e19

4 files changed

Lines changed: 104 additions & 5 deletions

File tree

‎docs/migration/parity-matrix.yaml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,95 @@ initial_cases:
184184
current_status: match
185185
notes: "config sin features → TS error a stderr exit 1; Go antes imprimía {installOrder:[]} exit 0."
186186

187+
# --- Wave A: casos nuevos (algunos destaparon divergencias, ya corregidas) ---
188+
- id: features-publish.missing-required
189+
lane: contract
190+
command: features-publish
191+
priority: p1
192+
docker_required: false
193+
ts_cmd: "features publish src/test/configs"
194+
asserts: [exit_code, stderr_normalized]
195+
class: required-args
196+
current_status: match
197+
notes: "TS: 'Missing required argument: namespace'. Go emitía el phrasing de cobra (MarkFlagRequired); ahora publishCollection valida namespace vacío con el mismo mensaje."
198+
199+
- id: templates.publish-missing-namespace
200+
lane: contract
201+
command: templates
202+
priority: p1
203+
docker_required: false
204+
ts_cmd: "templates publish src/test/configs"
205+
asserts: [exit_code, stderr_normalized]
206+
class: required-args
207+
current_status: match
208+
notes: "Idéntico a features-publish.missing-required: mensaje 'Missing required argument: namespace'."
209+
210+
- id: up.invalid-default-user-env-probe
211+
lane: contract
212+
command: up
213+
priority: p1
214+
docker_required: false
215+
ts_cmd: "up --workspace-folder src/test/configs/image --default-user-env-probe bogus"
216+
asserts: [exit_code, stderr_normalized]
217+
class: enum-validation
218+
current_status: match
219+
notes: "TS rechaza el enum yargs; Go valida el mismo enum antes de tocar Docker."
220+
221+
- id: build.compose-output-not-supported
222+
lane: contract
223+
command: build
224+
priority: p1
225+
docker_required: false
226+
ts_cmd: "build --workspace-folder src/test/configs/compose-image-with-features --output type=local"
227+
asserts: [exit_code, stdout_normalized, stderr_normalized]
228+
class: wired-flags
229+
current_status: match
230+
notes: "compose + --output → TS lanza '--output not supported.'"
231+
232+
- id: features.test-reject-global-scenarios-and-features
233+
lane: contract
234+
command: features
235+
priority: p1
236+
docker_required: false
237+
ts_cmd: "features test --global-scenarios-only --features x"
238+
asserts: [exit_code, stderr_normalized]
239+
class: parse-validation
240+
current_status: match
241+
notes: "Mutua-exclusión. Go emitía otro wording; ahora usa el del oráculo ('Cannot combine --global-scenarios-only and --features')."
242+
243+
- id: features.test-reject-skip-scenarios-and-global-scenarios
244+
lane: contract
245+
command: features
246+
priority: p1
247+
docker_required: false
248+
ts_cmd: "features test --skip-scenarios --global-scenarios-only"
249+
asserts: [exit_code, stderr_normalized]
250+
class: parse-validation
251+
current_status: match
252+
notes: "Go alineado al texto+orden del oráculo ('Cannot combine --skip-scenarios and --global-scenarios-only')."
253+
254+
- id: templates.apply-invalid-template-args-exit1
255+
lane: contract
256+
command: templates
257+
priority: p1
258+
docker_required: false
259+
ts_cmd: "templates apply --template-id ghcr.io/x/y:1 --template-args [1,2,3]"
260+
asserts: [exit_code, stderr_normalized]
261+
class: parse-validation
262+
current_status: match
263+
notes: "Go emitía el detalle del parser; ahora mensaje fijo 'Invalid template arguments provided.' como TS."
264+
265+
- id: set-up.invalid-remote-env
266+
lane: contract
267+
command: set-up
268+
priority: p1
269+
docker_required: false
270+
ts_cmd: "set-up --container-id fake --remote-env BROKEN"
271+
asserts: [exit_code, stderr_normalized]
272+
class: format-validation
273+
current_status: match
274+
notes: "set-up no validaba --remote-env; ahora llama validateRemoteEnvs como sus comandos hermanos."
275+
187276
- id: read-configuration.missing-required
188277
lane: contract
189278
command: read-configuration

‎internal/cli/collection_commands.go‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ func realFeaturesPublishCmd() *cobra.Command {
7575
cmd.Flags().StringVarP(&registry, "registry", "r", "ghcr.io", "OCI registry.")
7676
cmd.Flags().StringVarP(&namespace, "namespace", "n", "", "Collection namespace.")
7777
cmd.Flags().StringVar(&logLevel, "log-level", "info", "Log level.")
78-
cmd.MarkFlagRequired("namespace")
7978

8079
return cmd
8180
}
@@ -105,7 +104,6 @@ func realTemplatesPublishCmd() *cobra.Command {
105104
cmd.Flags().StringVarP(&registry, "registry", "r", "ghcr.io", "OCI registry.")
106105
cmd.Flags().StringVarP(&namespace, "namespace", "n", "", "Collection namespace.")
107106
cmd.Flags().StringVar(&logLevel, "log-level", "info", "Log level.")
108-
cmd.MarkFlagRequired("namespace")
109107

110108
return cmd
111109
}
@@ -191,10 +189,10 @@ func realFeaturesTestCmd() *cobra.Command {
191189
RunE: func(cmd *cobra.Command, args []string) error {
192190
// Validate conflicting flags (matches TS behavior)
193191
if globalOnly && len(featuresList) > 0 {
194-
return fmt.Errorf("--global-scenarios-only and --features cannot be used together")
192+
return fmt.Errorf("Cannot combine --global-scenarios-only and --features")
195193
}
196194
if globalOnly && skipScenarios {
197-
return fmt.Errorf("--global-scenarios-only and --skip-scenarios cannot be used together")
195+
return fmt.Errorf("Cannot combine --skip-scenarios and --global-scenarios-only")
198196
}
199197

200198
target := projectFolder
@@ -344,6 +342,11 @@ func packageCollection(targetFolder, outputDir, collectionType string, forceClea
344342
// with a fake oci.Registry and a capturing Output to drive the partial-publish
345343
// error path hermetically.
346344
func publishCollection(targetFolder, registry, namespace, collectionType, logLevelStr string) error {
345+
// TS parity: yargs demandOption → "Missing required argument: namespace"
346+
// (canonicalized by the harness), not cobra's "required flag(s) ... not set".
347+
if namespace == "" {
348+
return fmt.Errorf("Missing required argument: namespace")
349+
}
347350
// TS parity: --log-level is a yargs choice; reject out-of-range instead of
348351
// silently defaulting to Info (collectionCommonUtils/publish.ts:14).
349352
if err := validateEnum("log-level", logLevelStr, []string{"info", "debug", "trace"}); err != nil {

‎internal/cli/setup.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ func newSetUpCmd() *cobra.Command {
5959
if err := validateTerminalImplications(terminalColumns, terminalRows); err != nil {
6060
return writeValidationError(out, err.Error())
6161
}
62+
// TS parity: set-up rejects malformed --remote-env at parse time like
63+
// its siblings (exec/up/run-user-commands); Go was missing this.
64+
if err := validateRemoteEnvs(remoteEnvs); err != nil {
65+
return writeValidationError(out, err.Error())
66+
}
6267

6368
logDst, closeLog, logErr := logWriter(logFile, terminalLogFile)
6469
if logErr != nil {

‎internal/cli/templates_apply.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ func realTemplatesApplyCmd() *cobra.Command {
4343
var options map[string]string
4444
if templateArgs != "" {
4545
if err := jsonc.Unmarshal([]byte(templateArgs), &options); err != nil {
46-
return fmt.Errorf("Invalid template arguments: %w", err)
46+
// TS emits a fixed message (no parser detail) so both the
47+
// non-object and malformed-JSON paths canonicalize identically.
48+
return fmt.Errorf("Invalid template arguments provided.")
4749
}
4850
}
4951
if options == nil {

0 commit comments

Comments
 (0)