Skip to content

feat(migration): pin behavior with characterization tests around Java migrations - #380

Closed
Himanich wants to merge 2 commits into
adobe:mainfrom
Himanich:feature/migration-characterization-tests
Closed

Himanich wants to merge 2 commits into
adobe:mainfrom
Himanich:feature/migration-characterization-tests

Conversation

@Himanich

Copy link
Copy Markdown
Contributor

What

Adds behavior pinning (characterization tests) to the migration skill so Java migrations are verified for behavioral preservation, not just that they compile. mvn compile proves the code builds; a pinned test proves it still does the same thing across the migration.

Scope — migration only, 4 before-eligible patterns

guavaCache, scheduler, resourceChangeListener, eventListener/eventHandler — these preserve a behavioral seam a single test can bind to on both sides of the edit.

  • replication (sync→async) and assetApi (in-JVM→external) change the execution model → no cheap characterization; they stay compile/build-only.
  • Non-Java patterns (htlLint, dispatcher, templates, legacy UI, vault deps, osgiConfig) are out of scope.
  • A standalone code-assessment run on the same pattern does not pin — pinning is a migration policy for the riskier cross-version change. code-assessment is untouched by this PR.

How it works (migration Step 5)

Per finding: write one test → run green before the edit → transform → re-run after. Green = behavior preserved (pinned); red after the edit = real regression → revert that finding's edit (pin-fail → reverted).

Kept nominal / not overkill

  • One test per finding from a fixed skeleton (3 skeletons total), ≤ ~25 lines.
  • Existing test harness only (JUnit 5 + Mockito + io.wcm aem-mock) — never adds dependencies.
  • Stable-seam required; one attempt then skip-fast; exactly two runs. Low yield on legacy code is by design.
  • No new run-log — outcomes recorded inline in the Step 6 batch report; naturally bounded by the batch-of-5.

Files

  • plugins/aem/cloud-service/skills/migration/references/characterization-tests.md (new — eligibility, efficiency contract, 3 skeletons)
  • plugins/aem/cloud-service/skills/migration/SKILL.md (Branch B pointer, Step 5 pin + re-run, Step 6 report line)

🤖 Generated with Claude Code

… migrations

Add a bounded, skip-fast characterization-test step to the migration
skill's per-finding apply loop (Step 5) for the before-eligible Java
cascade patterns (guavaCache, scheduler, resourceChangeListener,
eventListener/eventHandler). Each finding gets one fill-in test run
green before the transform and re-run after, proving behavior is
preserved — compile alone only proves it builds.

replication and assetApi (execution-model changes) and all non-Java
patterns stay compile/build-only. A standalone code-assessment run does
not pin — this is a migration policy.

Efficiency contract keeps effort nominal: one test per finding from a
fixed skeleton, existing test harness only, stable-seam required, one
attempt then skip, exactly two runs. Outcomes recorded inline in the
Step 6 batch report; no new run-log or dependencies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… gating

Review fixes on the characterization-tests reference:

- Run command: drop `-q` (it suppresses BUILD SUCCESS and the Surefire
  `Tests run:` summary on a passing build, so a green run reads as a failure)
  and add `-DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false`
  (`-am` builds upstream reactor modules through the `test` phase, where the
  `-Dtest` filter matches nothing and Surefire otherwise fails them with
  "No tests matching pattern" before the target test runs). Both verified
  against a real 2-module reactor.
- Harness gating: require io.wcm aem-mock only for the AemContext skeletons
  (B/C); skeleton A (guavaCache) needs only JUnit 5 + Mockito, so a missing
  io.wcm no longer forces a spurious no-test-harness skip.
- Step 5: record `pin-skip: <reason>` to match Step 6 and the reference's
  outcome vocabulary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

This branch is waiting to be deployed

1 waiting deployment
eval 819ef072 Waiting Sep 21, 2026 by Himanich via tessl-eval #844
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant