Files
octopus-workflow/core/skills/implement/reference/fidelity-verification.md
T

3.6 KiB
Raw Blame History

Fidelity Verification — Detailed Processes

Extracted from implement/SKILL.md (Mode: port) Phase A6 and B5. Read this file when executing the test porting and fidelity verification phases.


Phase A6 — Port Tests & Verify Fidelity

  1. Port every test from the source — not just the happy path. Edge cases, error paths, and boundary tests must all be ported.
  2. Rewrite assertions to match the target test framework's assertion style.
  3. Run ported tests — they must pass. If a test fails:
    • Behavior mismatch: fix the implementation to match source behavior.
    • Test logic error (e.g. wrong assertion library syntax): fix the test.
    • Infrastructure gap (e.g. test tried to connect to Redis): adapt the test to the alternative from Phase A4.
  4. Full test suite — run the target project's existing tests + ported tests. No regression in existing tests.
  5. Fidelity checklist — for each source behavior, verify manually or automatically:

Fidelity Verification Template

## Fidelity Verification

| Source Behavior                   | Tested?       | Result | Notes                                        |
| --------------------------------- | ------------- | ------ | -------------------------------------------- |
| User login with valid credentials | ✅ ported     | PASS   |                                              |
| User login with invalid password  | ✅ ported     | PASS   |                                              |
| Session expiry at 1h              | ✅ ported     | PASS   | Adapted to DB session store                  |
| Rate limiting: 5 attempts / min   | ⚠️ not ported | —      | Target has no rate limiting infra → deferred |

Phase B5 — Verify (Integration + Fidelity)

After all chunks are implemented and reviewed, run core/skills/verify/SKILL.md with the fidelity baseline (wiki page port-{name}/source-analysis/10-fidelity-baseline, read via wiki 读写 API(见 TERMINOLOGY) as the acceptance criteria:

  • Every FID-* item must be traced to a passing test in the target project.

  • Full test suite (existing + ported) must pass with no regressions.

  • Typecheck and lint must be clean.

  • Fidelity deviations from any chunk are consolidated into a final fidelity report.

  • Reverse coverage (Ported? audit): The Source Function Inventory (produced in Phase A1 / B1) "Ported?" column must have zero unexplained ☐ entries. Any residual ☐ MUST carry a matching [DEFER] row — with a reactivation trigger — in the Port Fidelity Report. A bare ☐ is a FAIL, not a deferral. This closes the #1 port-completeness gap: functions that were never ported and never consciously deferred.

  • Symbol-level completeness (SRC-CMP): Run an automated export-symbol diff between source and target packages. Every source symbol absent from the target MUST appear as [DEFER] in the report; a silent gap is a FAIL.

    diff <(codegraph exports <source-pkg>) <(codegraph exports <target-pkg>)
    # Each left-only symbol must be DEFER'd or ported — silent gaps fail B5.
    

Port Fidelity Report Template

## Port Fidelity Report

| FID-*   | Behavior           | Chunk       | Target Test          | Status |
| ------- | ------------------ | ----------- | -------------------- | ------ |
| FID-001 | Login valid creds  | chunk-auth  | auth/login.test.ts   | PASS   |
| FID-002 | Login invalid pw   | chunk-auth  | auth/login.test.ts   | PASS   |
| FID-004 | Rate limiting      | chunk-auth  | —                    | DEFER  |

**Summary**: {X}/{Y} behaviors verified, {Z} deferred