Skip to content

Commit 1a9d0ec

Browse files
authored
Merge pull request #11 from bgyss/codex/dkcr-hd-scaffold
Document and automate DKCR HD validation workflow
2 parents 6e68e79 + 0564308 commit 1a9d0ec

49 files changed

Lines changed: 2209 additions & 750 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Summary
2+
-
3+
4+
## Files Touched
5+
-
6+
7+
## Testing (required)
8+
- `cargo test`
9+
- Result:
10+
11+
If tests are skipped, include explicit approval and the reason.
12+
13+
## Open Questions
14+
-

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ SwitchRecomp is a preservation-focused static recompilation research project. Th
3030
## Testing Guidelines
3131
- Use `cargo test` for Rust workspace tests.
3232
- Test files live under `crates/*/tests/` or inline in modules.
33-
- Always run the full suite after changes unless the user explicitly says not to.
33+
- Always run the full suite after changes.
34+
- Record the full-suite command and outcome in the PR Testing section and in status updates.
35+
- Do not skip tests unless the user explicitly approves; record the approval and reason in the PR.
3436

3537
## Back Pressure Hooks
3638
Pre-commit hooks provide fast feedback; `prek` is a drop-in replacement that reads the same `.pre-commit-config.yaml`.
@@ -47,6 +49,8 @@ Pre-commit hooks provide fast feedback; `prek` is a drop-in replacement that rea
4749
No established commit conventions are present yet. Until standards are set:
4850
- Use clear, imperative commit messages (e.g., "Add SPEC-070 OS services draft").
4951
- PRs should include a short summary, a list of files touched, and any open questions.
52+
- PRs must include a Testing section with the full suite (`cargo test`) and results.
53+
- Do not use "Testing: Not run" unless the user explicitly approved skipping tests.
5054
- Link related issues if available.
5155

5256
## Research & Sources

PLANS.md

Lines changed: 82 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ This file tracks implementation work derived from specs that do not yet have a c
2323
- SPEC-180 XCI Title Intake
2424
- SPEC-190 Video-Based Validation
2525
- SPEC-200 DKCR HD First-Level Milestone (macOS/aarch64)
26-
- SPEC-210 Automated Recompilation Loop
27-
- SPEC-220 Input Replay and Interaction Scripts
28-
- SPEC-230 Reference Media Normalization
29-
- SPEC-240 Validation Orchestration and Triage
3026

3127
## SPEC-000: Project Charter and Ethics
3228
Outcome
@@ -299,20 +295,13 @@ Exit criteria (from SPEC-180)
299295
Outcome
300296
- Validate the recompiled output against a reference gameplay video without emulator traces.
301297

302-
Note
303-
- DKCR validation is paused until the automation loop, input replay, and normalization specs land (SPEC-210/220/230/240).
304-
305298
Work items
306299
- [x] Define a reference timeline for the first level and store it in `reference_video.toml`.
307300
- [x] Implement a capture workflow for macOS/aarch64 runtime output.
308301
- [x] Add a comparison step that computes video and audio similarity metrics.
309302
- [x] Generate a `validation-report.json` with pass/fail and drift summaries.
310303
- [x] Document manual review steps for mismatches.
311304

312-
External prerequisites (see `docs/dkcr-validation-prereqs.md`)
313-
- Absolute paths to reference and capture artifacts (video or hashes).
314-
- Confirmed first-level start and end timecodes.
315-
316305
Exit criteria (from SPEC-190)
317306
- A single run produces a validation report for the first level.
318307
- Similarity metrics are stable across two consecutive runs.
@@ -322,80 +311,97 @@ Exit criteria (from SPEC-190)
322311
Outcome
323312
- Produce a macOS/aarch64 static recompilation of DKCR HD that reaches and plays the first level.
324313

325-
Note
326-
- DKCR validation is paused until SPEC-210/220/230/240 are implemented.
327-
328314
Work items
329315
- [x] Complete XCI intake for the DKCR HD title (SPEC-180 inputs and outputs).
330316
- [x] Identify required OS services and implement or stub them in the runtime.
331317
- [x] Implement the minimal GPU translation path needed for the first level.
332318
- [x] Create a per-title config and patch set for DKCR HD.
333319
- [x] Run video-based validation against the first level (SPEC-190).
334320

335-
External prerequisites (see `docs/dkcr-validation-prereqs.md`)
336-
- Absolute paths to DKCR reference and capture artifacts.
337-
- Confirmed first-level start and end timecodes.
338-
339321
Exit criteria (from SPEC-200)
340322
- The macOS/aarch64 build boots and reaches the first playable level.
341323
- First-level gameplay matches the reference video within defined tolerances.
342324
- No proprietary assets or keys are stored in the repo or build outputs.
343325

344-
## SPEC-210: Automated Recompilation Loop
345-
Outcome
346-
- Provide a one-command automation loop for intake, build, capture, and validation.
347-
348-
Work items
349-
- [x] Define `automation.toml` schema and validator.
350-
- [x] Implement an orchestrator CLI that runs intake -> lift -> build -> run -> capture -> validate.
351-
- [x] Emit a deterministic `run-manifest.json` with step timings and artifact hashes.
352-
- [x] Add resume/caching logic keyed by input hashes.
353-
- [x] Add integration tests using non-proprietary fixtures.
354-
355-
Exit criteria (from SPEC-210)
356-
- One command runs the full loop and produces a run manifest and validation report.
357-
- Re-running with identical inputs yields identical artifacts.
358-
- Proprietary assets remain external.
359-
360-
## SPEC-220: Input Replay and Interaction Scripts
361-
Outcome
362-
- Deterministic input playback aligned to reference timelines.
363-
364-
Work items
365-
- [x] Define `input_script.toml` schema with events and markers.
366-
- [x] Implement input script loader and runtime playback module.
367-
- [x] Add tools/tests for deterministic playback and alignment.
368-
- [x] Document authoring and replay workflows.
369-
370-
Exit criteria (from SPEC-220)
371-
- Input scripts replay deterministically across two runs.
372-
- Playback order is stable for simultaneous events.
373-
- Markers align to reference timecodes.
374-
375-
## SPEC-230: Reference Media Normalization
376-
Outcome
377-
- Normalize reference video/audio into a canonical, comparable format.
378-
379-
Work items
380-
- [x] Define canonical reference profile (resolution, fps, audio).
381-
- [x] Implement normalization workflow and metadata capture.
382-
- [x] Update `reference_video.toml` schema to record normalization details.
383-
- [x] Add hash generation tests for normalized outputs.
384-
385-
Exit criteria (from SPEC-230)
386-
- Reference media can be normalized deterministically.
387-
- Hashes for normalized outputs are stable across runs.
388-
389-
## SPEC-240: Validation Orchestration and Triage
390-
Outcome
391-
- Automated validation with structured reports and triage summaries.
392-
393-
Work items
394-
- [x] Define `validation-config.toml` and report schema extensions.
395-
- [x] Implement triage summary generation (drift, likely causes).
396-
- [x] Integrate validation orchestration into the automation loop.
397-
- [x] Add tests for report determinism and failure summaries.
398-
399-
Exit criteria (from SPEC-240)
400-
- Validation runs emit deterministic reports and triage summaries.
401-
- Failures include actionable context and artifact references.
326+
## Future Work Notes: DKCR HD Video Validation (SPEC-190/200)
327+
Requirements to finalize:
328+
- Define the capture spec (resolution, fps, constant frame rate, audio rate/bit depth/channels, container/codec).
329+
- Define alignment parameters (search window, pre-roll, min match window, segment length).
330+
- Document drift thresholds for video metrics and audio correlation with pass/warn/fail tiers.
331+
- Capture runtime configuration (performance mode, GPU backend, resolution scale, frame pacing, input map).
332+
- Record hashes for XCI intake outputs, module.json, manifest.json, and bundle manifest.
333+
- Record tool versions (recomp-cli, ffmpeg, capture tooling) per validation run.
334+
- Track each run with a validation artifact index and store reports under a dated output root.
335+
- Record host metadata (hardware model, OS version, GPU driver/toolchain versions).
336+
337+
Required per-run metadata (external):
338+
- Run id, start/end timestamps, duration, and title/config identifiers.
339+
- Git commit hash, build manifest hash, bundle manifest hash, and intake output hash.
340+
- Runtime config snapshot and capture config snapshot with absolute paths.
341+
- Alignment parameters and similarity thresholds used for the run.
342+
343+
Validation artifact index fields (external):
344+
- Paths and sha256 hashes for reference capture, recompiled capture, and alignment outputs.
345+
- Paths and sha256 hashes for reports, summary json, and run logs.
346+
- Pointers to the run metadata record and per-stage timing summary.
347+
348+
Artifact paths and naming (external only):
349+
- Reference captures: `/Volumes/External/validation/dkcr-hd/reference/YYYY-MM-DD/`.
350+
- Recompiled captures: `/Volumes/External/validation/dkcr-hd/recompiled/YYYY-MM-DD/`.
351+
- Alignment outputs: `/Volumes/External/validation/dkcr-hd/alignment/YYYY-MM-DD/`.
352+
- Reports: `/Volumes/External/validation/dkcr-hd/reports/YYYY-MM-DD/validation-report.json`.
353+
- Run metadata: `/Volumes/External/validation/dkcr-hd/runs/YYYY-MM-DD/run.json`.
354+
- Artifact index: `/Volumes/External/validation/dkcr-hd/index/YYYY-MM-DD/run-index.json`.
355+
- Provenance entries should include the external paths and file hashes.
356+
357+
Timeline checklist (per validation run):
358+
- Day 0: capture reference footage and compute hashes.
359+
- Day 1: capture recompiled footage under matching settings.
360+
- Day 1-2: run alignment + metric generation, record drift windows.
361+
- Day 2: manual review of flagged windows and finalize report.
362+
- Day 3: summarize deltas and file follow-up issues.
363+
364+
## Future Work Notes: Automation Ideas (Local + Cloud)
365+
Local automation ideas:
366+
- A `scripts/run_recomp_pipeline.sh` wrapper that runs intake, lift, pipeline, build, and validation
367+
with consistent logging and a summary JSON.
368+
- Cache build artifacts under `out/` with per-run timestamps and a manifest index.
369+
- Emit a single `run.log` plus `summary.json` so automation can surface failures quickly.
370+
- Add a `run.json` manifest with input hashes, config paths, tool versions, and stage timings.
371+
- Support `--resume` to reuse intake/lift outputs and `--clean` to purge temp outputs.
372+
- Create per-run working directories named `runs/YYYYMMDD-HHMMSS-shortsha/`.
373+
374+
Cloud automation ideas:
375+
- Containerize the pipeline (Rust toolchain + hactool/hactoolnet + ffmpeg).
376+
- Use object storage for XCI intake outputs, validation artifacts, and reports.
377+
- Inject key material via a secrets manager; never write keys to persistent storage.
378+
- Run jobs on ephemeral workers with a per-run working directory and explicit cleanup.
379+
- Record container image digests and worker hardware profiles in run metadata.
380+
- Add artifact retention rules and a nightly prune job for stale runs.
381+
382+
Agent-driven pipeline flow (candidate):
383+
1. Intake: validate provenance, run XCI extraction, emit module/manifest.
384+
2. Lift: decode and emit lifted module and segments.
385+
3. Build: run `recomp-cli run`, build emitted project, package bundle.
386+
4. Validate: capture and align video, run `recomp-validation`, emit report.
387+
5. Report: upload artifacts, summarize pass/fail and drift windows.
388+
6. Archive: write run metadata and validation artifact index entries.
389+
390+
Dependencies to document:
391+
- Rust toolchain, `cargo`, `nix` (optional dev shell).
392+
- `hactool` or `hactoolnet` for XCI extraction.
393+
- `ffmpeg` for capture and alignment steps.
394+
- Storage and logging backends for automation outputs.
395+
- Capture tooling and codec requirements for the validation pipeline.
396+
397+
## Future Work Notes: Automation/Docs Backlog
398+
Automation requests:
399+
- XciExtractor helper that wraps tool discovery, key validation, Program NCA selection, and deterministic output layout.
400+
- Validation artifacts index generator that emits a single JSON with paths, hashes, and run metadata pointers.
401+
- Playback comparison tooling that produces side-by-side video with timecode overlays and drift markers.
402+
- Run registry that aggregates per-run summary.json files into a searchable index.
403+
404+
Documentation requests:
405+
- XciExtractor usage and key-handling guidance with expected output layout.
406+
- Validation artifact index schema and example run metadata record.
407+
- Playback comparison workflow with expected inputs and review checklist.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ Legal and provenance policy:
3232

3333
## Samples and Flow Docs
3434
- `samples/memory-image/` shows the memory image initialization flow (segment blob + lifted module).
35-
- `docs/static-recompilation-flow.md` outlines a hypothetical macOS static recompilation flow and verification pipeline.
36-
- `docs/validation-matrix-template.md`, `docs/title-run-sheet-template.md`, `docs/thresholds/default.json`, `docs/batch-manifest-schema.md`, `docs/batch-manifest-schema.json`, and `docs/batch-pipeline-layout.md` are reusable validation templates.
35+
- `samples/validation/` contains non-proprietary validation artifact index templates.
36+
- `docs/static-recompilation-flow.md` outlines a hypothetical macOS static recompilation flow and verification pipeline (see the Real XCI intake section for external-tool usage).
37+
- `docs/xci-intake.md` documents the XCI intake workflow and mock extractor format.
38+
- `docs/validation-artifacts.md` defines validation artifact indexing, workflows, and dependencies.
39+
- `docs/validation-video.md` describes the hash-based video validation workflow.
40+
- `scripts/capture-validation.sh`, `scripts/capture-video-macos.sh`, `scripts/capture_video.sh`, and `scripts/validate_artifacts.sh` provide capture and validation helpers.
3741

3842
## Back Pressure Hooks
3943
These hooks add fast, consistent feedback to keep the repo autonomous and reduce review churn. Hooks are defined in `.pre-commit-config.yaml` and can be run with `prek` (preferred) or `pre-commit`.

crates/recomp-cli/src/automation.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(dead_code)]
2+
// Automation scaffolding is intentionally compiled but not yet wired into the CLI.
3+
14
use recomp_pipeline::homebrew::{
25
intake_homebrew, lift_homebrew, IntakeOptions, LiftMode, LiftOptions,
36
};

0 commit comments

Comments
 (0)