Automattic / Automattic/wp-codebox

Define resolved workflow specs for canonicalized recipe input paths

Aperta
#1,697 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
16
Fork
4
Merge medio
59m
PR unite (30g)
131

Descrizione

## Summary

WP Codebox currently treats recipe input mount paths as both caller-facing declarations and executable runtime paths. When recipe input mounts are canonicalized/materialized under `/tmp/wp-codebox-inputs/...`, workflow command args can still reach runtime execution with the original declared paths such as `/wp-codebox-vendor` or `/home/wpcom/public_html`.

The immediate symptom is #1696, but the architectural issue is broader: path canonicalization is a late helper rewrite rather than a single authoritative recipe execution boundary.

## Current path identities

- Declared recipe paths: caller-facing paths such as `/wp-codebox-vendor` and `/home/wpcom/public_html`.
- Canonical runtime paths: internal materialized paths such as `/tmp/wp-codebox-inputs/2-wp-codebox-vendor-...`.
- Command argument paths: values embedded in workflow args such as `cwd=`, `autoload-file=`, `tests-dir=`, `test-root=`, `phpunit-xml=`, etc.

These path identities can diverge. We have evidence that `recipeInputMountPathMap()` and `rewriteInputMountPathArgs()` produce the right canonical args, while `wordpress.phpunit` runtime execution still receives the original declared path.

## Desired model

Recipe execution should have a first-class resolved workflow spec phase:

1. Runtime setup prepares input mounts and returns a path resolution context.
2. Workflow steps are converted to resolved execution specs exactly once before `runtime.execute()`.
3. Runtime commands receive resolved runtime paths only.
4. Declared paths remain available as evidence/metadata, not executable args.
5. Diagnostics expose original args and resolved args.
6. If an executable arg still references a canonicalized declared mount target, recipe-run should fail loud before runtime execution.

## Acceptance criteria

- All recipe workflow command execution paths pass through one resolver before runtime execution.
- Nested workload/fuzz workflow execution uses the same resolver.
- `wordpress.phpunit` with input mounts for `/wp-codebox-vendor` and `/home/wpcom/public_html` receives canonical `/tmp/wp-codebox-inputs/...` args.
- Evidence records both original and resolved args for debugging.
- A guard catches unresolved canonicalized mount targets in executable args.
- Fix remains generic: no Homeboy or WPCOM-specific logic.

## Related

- Immediate bug: #1696
- WPCOM blocker run: `runner-exec-test-wpcom-homeboy-lab-e66e6a80-e042-4727-aa17-75b3a17ccf31`

## AI assistance

- **AI assistance:** Yes
- **Tool(s):** openai/gpt-5.5 via OpenCode
- **Used for:** Diagnosing the path model failure and drafting this architectural issue.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Traccia recipeInputMountPathMap(), rewriteInputMountPathArgs() e i percorsi del workflow che chiamano runtime.execute(); confronta l’esecuzione di workload ordinari e annidati, inclusa l’esecuzione fuzz, compreso wordpress.phpunit. Definisci il confine della specifica del workflow risolta, in modo che i comandi runtime ricevano percorsi canonici, mentre le evidenze conservino gli argomenti originali e risolti e recipe-run rifiuti le destinazioni di mount non risolte.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
backend
Tipo di issue
Refactoring
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.