|
| 1 | +--- |
| 2 | +name: rxjs-next-migration |
| 3 | +description: Migrate an RxJS 7 application, library, or test suite to RxJS Next through an agent-led workflow that establishes a green behavioral baseline, makes Observable lifecycle choices explicit, uses @rxjs/migrate only for bounded fixture-proved rewrites, repairs without weakening evidence, and records a versioned migration contract. Use for repository assessment, migration planning or execution, lifecycle review, TestScheduler conversion, or migration closeout. |
| 4 | +--- |
| 5 | + |
| 6 | +# RxJS 7 to RxJS Next migration |
| 7 | + |
| 8 | +Treat this as reviewed project work, not a codemod run. The objective is an |
| 9 | +intentional RxJS Next contract backed by the project's own build and behavior |
| 10 | +evidence. A transformed file, a clean diff, or one passing test is not proof |
| 11 | +that the migration is complete. |
| 12 | + |
| 13 | +Work through all eight stages in order. Re-enter an earlier stage whenever new |
| 14 | +evidence changes scope, coverage, or lifecycle intent. Keep the developer |
| 15 | +involved at every explicit pause. |
| 16 | + |
| 17 | +## Non-negotiable rules |
| 18 | + |
| 19 | +- Read and obey repository-local instructions before acting. Protect existing |
| 20 | + work and stay within the authorized repository and paths. |
| 21 | +- Establish the RxJS 7 baseline before changing dependencies or source. |
| 22 | +- Never infer platform sharing versus producer-per-direct-subscription behavior |
| 23 | + from syntax, filenames, operator names, or a currently passing output. |
| 24 | +- Use the installed engine's versioned registry and schemas as authority. Do |
| 25 | + not reconstruct capability mappings from this Skill or from memory. |
| 26 | +- Run the deterministic engine without writes first. A refusal is a successful |
| 27 | + safety outcome, not permission to improvise a mechanical rewrite. |
| 28 | +- Preserve the project's test framework by default. Select a framework adapter |
| 29 | + only when the developer asked for that separate conversion. |
| 30 | +- Do not weaken, skip, delete, or replace a behavioral expectation merely to |
| 31 | + make the migrated suite green. |
| 32 | +- Do not add RxJS 7 compatibility shims, string-named platform methods, local |
| 33 | + substitute operators, or runtime generators unless the developer separately |
| 34 | + authorizes that product work. |
| 35 | +- Keep changes in small coherent batches. Review and verify each batch before |
| 36 | + widening the scope. |
| 37 | +- Do not call a migration complete while a required command is unknown, |
| 38 | + unapproved, skipped, or red without an explicitly accepted blocker. |
| 39 | + |
| 40 | +## Working record |
| 41 | + |
| 42 | +Create or locate a checked-in migration contract manifest and a concise |
| 43 | +human-readable report. Use the schema exported by the installed |
| 44 | +`@rxjs/migrate`; schema validity and migration readiness are separate checks. |
| 45 | +Use [assets/migration-report.md](assets/migration-report.md) for the report. |
| 46 | + |
| 47 | +For every migration unit, preserve source locations and record: |
| 48 | + |
| 49 | +- its current RxJS 7 behavioral claim; |
| 50 | +- the target lifecycle selected by the developer; |
| 51 | +- its evidence classification and supporting tests; |
| 52 | +- approval state, diagnostics, and any intentional divergence; and |
| 53 | +- verification or a named blocker. |
| 54 | + |
| 55 | +## Stage 1: Establish authority and scope |
| 56 | + |
| 57 | +1. Locate repository instructions, package and workspace metadata, lockfiles, |
| 58 | + CI configuration, RxJS versions, build/test commands, and current working |
| 59 | + tree state. |
| 60 | +2. Identify the repository root, migration boundary, permitted writes, |
| 61 | + package manager, network policy, and candidate verification commands. |
| 62 | +3. Record the installed `@rxjs/migrate` version and canonical Skill digest. |
| 63 | + If the installed Skill does not match its package, stop and synchronize it |
| 64 | + before trusting these instructions. |
| 65 | +4. State the proposed read, write, dependency, and command scope before broad |
| 66 | + changes. |
| 67 | + |
| 68 | +Pause for the developer if the target repository or allowed scope is unclear, |
| 69 | +existing changes overlap the migration, or destructive, networked, external, |
| 70 | +or broader actions require new authority. |
| 71 | + |
| 72 | +Exit only when the scope, allowed writes, package manager, and candidate gates |
| 73 | +are recorded. |
| 74 | + |
| 75 | +## Stage 2: Assess usage, lifecycle risk, and coverage |
| 76 | + |
| 77 | +Inventory installed RxJS versions and import forms, then locate Observable |
| 78 | +construction, custom producers, Subjects, subscription ownership, repeated |
| 79 | +subscriptions, retry/refresh/cache paths, schedulers and timing, test helpers, |
| 80 | +interop inputs, cancellation, teardown, and error handling. Include direct and |
| 81 | +transitive operator usage. |
| 82 | + |
| 83 | +For each lifecycle-sensitive path, link exact source evidence and mark it as: |
| 84 | + |
| 85 | +- covered by an existing baseline; |
| 86 | +- requiring a characterization test; |
| 87 | +- explicitly unsupported; or |
| 88 | +- an uncovered risk the developer accepts. |
| 89 | + |
| 90 | +Produce a risk and coverage report before proposing rewrites. Read |
| 91 | +[references/assessment-and-contract.md](references/assessment-and-contract.md) |
| 92 | +for the inventory and characterization protocol. |
| 93 | + |
| 94 | +Exit only when every in-scope lifecycle-sensitive use has one recorded |
| 95 | +coverage disposition. Missing coverage is not evidence that behavior is safe. |
| 96 | + |
| 97 | +## Stage 3: Establish the green RxJS 7 baseline |
| 98 | + |
| 99 | +Run the agreed build, type, lint, unit, integration, and behavior checks against |
| 100 | +the unchanged RxJS 7 project. Record exact commands, environment facts, exit |
| 101 | +codes, and concise results. |
| 102 | + |
| 103 | +Add focused characterization tests where Stage 2 found material gaps. Protect |
| 104 | +observable values, completion/error behavior, producer multiplicity, |
| 105 | +cancellation, abort reasons, teardown ordering, timing, and externally visible |
| 106 | +subscription effects as applicable. Every characterization test must pass on |
| 107 | +RxJS 7 before migration begins. |
| 108 | + |
| 109 | +Pause if a starting gate fails. Diagnose it and ask the developer whether to |
| 110 | +fix it first, narrow scope, or record it as an accepted pre-existing failure. |
| 111 | +Never silently reclassify it as a migration regression or ignore it. |
| 112 | + |
| 113 | +Exit only with a green baseline or explicit approval for each named |
| 114 | +pre-existing failure, plus green characterization tests. |
| 115 | + |
| 116 | +## Stage 4: Classify and approve the target contract |
| 117 | + |
| 118 | +Divide the scope into stable migration units. For each unit, record one target |
| 119 | +lifecycle using the values accepted by the installed manifest schema and one |
| 120 | +evidence classification. Use repository evidence and |
| 121 | +[references/assessment-and-contract.md](references/assessment-and-contract.md) |
| 122 | +to explain the choice. |
| 123 | + |
| 124 | +The engine may identify risk but cannot choose lifecycle intent. `unresolved` |
| 125 | +is a stop state. Pause for the developer when either platform-shared behavior |
| 126 | +or producer-per-direct-subscription behavior is plausible, or when Subject |
| 127 | +semantics, cancellation, scheduler ordering, error behavior, interop, or a |
| 128 | +public behavior change is not proved. |
| 129 | + |
| 130 | +Intentional divergences require a concrete old claim, proposed Next claim, |
| 131 | +user impact, evidence, and developer approval. Validate the manifest |
| 132 | +structurally, then run the installed readiness assessment. Do not proceed with |
| 133 | +a batch containing unresolved intent or required pending approval. |
| 134 | + |
| 135 | +Exit only when the developer has approved every ambiguous choice and |
| 136 | +intentional divergence needed for the next batch. |
| 137 | + |
| 138 | +## Stage 5: Plan and dry-run bounded engine changes |
| 139 | + |
| 140 | +Inspect the installed capability registry and select only entries whose |
| 141 | +version, source form, arity, preconditions, and executable evidence match the |
| 142 | +approved unit. Do not infer support from a familiar name. Follow |
| 143 | +[references/engine-and-batches.md](references/engine-and-batches.md). |
| 144 | +When the batch contains RxJS 7 marble tests, also read |
| 145 | +[references/test-migration.md](references/test-migration.md). |
| 146 | + |
| 147 | +Run `rxjs-migrate` without `--write` using explicit provenance and, when |
| 148 | +required, the approved `cold` or `platform` mode. Preserve the current test |
| 149 | +framework unless a supported adapter was separately selected. Capture the |
| 150 | +versioned JSON report, changed paths, structured diagnostics, and exit code. |
| 151 | + |
| 152 | +Pause when a diagnostic requires review or refuses a transform, when output |
| 153 | +would escape authorized paths, when source does not match the capability |
| 154 | +evidence, or when batch size or semantic reach exceeds the reviewed scope. |
| 155 | +Never conceal unsupported segments inside a partially transformed pipeline. |
| 156 | + |
| 157 | +Exit only after diagnostics and changed-file scope are reviewed and the |
| 158 | +developer has approved any newly broadened batch. |
| 159 | + |
| 160 | +## Stage 6: Apply one small migration batch |
| 161 | + |
| 162 | +Apply only the reviewed dry-run plan. Require an explicit write destination |
| 163 | +inside the authorized project and preserve source provenance. Do not overwrite |
| 164 | +existing output without specific approval. Review the resulting diff before |
| 165 | +additional edits. |
| 166 | + |
| 167 | +Format through the project's normal tools. Ensure ordinary project-owned |
| 168 | +source and direct test declarations remain; do not leave dynamic generators, |
| 169 | +hidden case registries, or compatibility assertion layers in the result. |
| 170 | + |
| 171 | +Immediately check parsing, the narrowest useful type boundary, and engine |
| 172 | +idempotence. Re-running the same transform must produce no new source change |
| 173 | +and stable diagnostics. If it does not, restore the affected batch to the |
| 174 | +reviewed starting point and report an engine defect. |
| 175 | + |
| 176 | +Exit only when the batch parses, type-checks at its narrow boundary, is |
| 177 | +idempotent, and every diagnostic is resolved, carried forward, or escalated. |
| 178 | + |
| 179 | +## Stage 7: Build, test, diagnose, and repair |
| 180 | + |
| 181 | +Run focused characterization and migrated tests first, then the agreed project |
| 182 | +gates. Classify every failure as a migration defect, RxJS Next product gap, |
| 183 | +intentional divergence, environment/baseline issue, or still-unknown result. |
| 184 | +Use [references/verification-and-closeout.md](references/verification-and-closeout.md) |
| 185 | +for the repair rules. |
| 186 | + |
| 187 | +Repair migration defects in a small batch and repeat the relevant gates. For a |
| 188 | +product gap, preserve the failing evidence and report it; do not disguise it |
| 189 | +with a local replacement. For an intentional divergence, change an expectation |
| 190 | +only after the manifest records approved new behavior and user impact. |
| 191 | + |
| 192 | +Pause before any repair that changes public behavior, weakens evidence, |
| 193 | +expands writes, changes dependencies beyond the reviewed plan, needs external |
| 194 | +access, or introduces a compatibility layer. |
| 195 | + |
| 196 | +Exit only when agreed gates pass or each remaining red result has a named, |
| 197 | +evidenced, explicitly accepted blocker. |
| 198 | + |
| 199 | +## Stage 8: Close out and hand off |
| 200 | + |
| 201 | +Update the contract manifest and report with exact source and target versions, |
| 202 | +engine version, capability-registry version, canonical Skill digest, baseline, |
| 203 | +units, diagnostics, divergences, final commands/results, and blockers. Validate |
| 204 | +the manifest with the installed schema and assess readiness separately. |
| 205 | + |
| 206 | +Review [references/review-checklist.md](references/review-checklist.md). Report: |
| 207 | + |
| 208 | +1. what behavior and lifecycle contract changed; |
| 209 | +2. what source and tests changed; |
| 210 | +3. the exact gates run and their results; |
| 211 | +4. migration defects repaired versus product gaps retained; |
| 212 | +5. approved divergences and environment limitations; and |
| 213 | +6. remaining blockers, owners, evidence, and acceptance. |
| 214 | + |
| 215 | +Claim completion only when readiness is `ready`, or |
| 216 | +`ready-with-accepted-blockers` when the developer intentionally chose that |
| 217 | +outcome. Otherwise hand off the migration as incomplete with the next concrete |
| 218 | +decision or action. |
0 commit comments