|
| 1 | +# MVP Implementation Sequencing |
| 2 | + |
| 3 | +This document derives a recommended implementation sequence from `plans/mvp-implementation-backlog.md`. |
| 4 | + |
| 5 | +It is not a replacement for the backlog. |
| 6 | + |
| 7 | +Use it to: |
| 8 | + |
| 9 | +- understand which tasks are true prerequisites for others |
| 10 | +- identify which work can proceed in parallel |
| 11 | +- avoid prompting agents to implement downstream tasks before the required contracts are stable enough |
| 12 | + |
| 13 | +Use `docs/mvp-scope.md` as the target-state definition and `plans/mvp-implementation-backlog.md` as the source of truth for task definitions, dependencies, and status. |
| 14 | + |
| 15 | +## How To Read This Document |
| 16 | + |
| 17 | +This is a dependency-driven sequencing guide, not a strict linear priority list. |
| 18 | + |
| 19 | +The MVP backlog is a DAG with multiple work lanes. Some tasks are: |
| 20 | + |
| 21 | +- **hard blockers**: downstream implementation should not proceed until they are resolved or narrowed enough |
| 22 | +- **soft blockers**: they affect a lane, but some limited work can still proceed under the documented assumptions |
| 23 | +- **parallelizable**: they can be worked on independently once their local prerequisites are stable enough |
| 24 | + |
| 25 | +This document combines: |
| 26 | + |
| 27 | +- explicit task dependencies from `plans/mvp-implementation-backlog.md` |
| 28 | +- execution judgment about which tasks are safest or most useful to do earlier within those dependency constraints |
| 29 | + |
| 30 | +When this document recommends an order that is not strictly enforced by the backlog, treat it as advisory rather than mandatory. |
| 31 | + |
| 32 | +For `open_question` tasks, “done” means producing a concrete output that downstream work can reference: |
| 33 | + |
| 34 | +- a documented decision |
| 35 | +- a narrowed contract |
| 36 | +- or an explicit recorded deferral |
| 37 | + |
| 38 | +## Sequencing Principles |
| 39 | + |
| 40 | +1. Freeze shared contracts before asking agents to implement multiple dependent tasks. |
| 41 | +2. Unlock work by lane once the minimum required contracts for that lane are stable enough. |
| 42 | +3. Do not wait for every open question to be fully closed before starting all implementation. |
| 43 | +4. Do not start downstream implementation by embedding an implicit answer to an unresolved contract question. |
| 44 | +5. Prefer prompting one `MVP-###` task at a time unless the supporting change is strictly required by that task’s `Done when` or `Verify`. |
| 45 | + |
| 46 | +## Phase 0: Shared Contract And Decision Gate |
| 47 | + |
| 48 | +These tasks define semantics or interfaces that multiple lanes depend on. |
| 49 | + |
| 50 | +The grouping is recommended because these tasks have broad downstream impact. It is not a claim that every one of them must be fully closed before any implementation begins. |
| 51 | + |
| 52 | +### Hard Blockers |
| 53 | + |
| 54 | +- `MVP-004` Define and document the byte-billing and payment/header contract used in the real runtime path |
| 55 | + - Blocks most runtime payment, provider integration, and client integration work. |
| 56 | +- `MVP-027` Freeze canonical payment identity, `collection_id` reuse, and session-vs-payment keying semantics |
| 57 | + - Blocks reconnect, provider state, settlement lifecycle, and operator retrieval/collection work. |
| 58 | +- `MVP-028` Define the MVP authentication and authorization contract for oracle and provider operator surfaces |
| 59 | + - Blocks authenticated admin/operator implementation for oracle and provider APIs. |
| 60 | + |
| 61 | +### Soft Blockers |
| 62 | + |
| 63 | +- `MVP-001` Freeze the pricing exposure contract between oracle metadata and provider handshake |
| 64 | + - Primarily blocks discovery/oracle integration where pricing semantics could drift. |
| 65 | + - Some oracle work can proceed if pricing remains explicitly non-authoritative or advisory. |
| 66 | +- `MVP-023` Define the final MVP observability floor beyond structured logs and status tooling |
| 67 | + - Primarily blocks final observability closure, not all operator visibility work. |
| 68 | + |
| 69 | +### Guidance |
| 70 | + |
| 71 | +- Start MVP execution by resolving as many hard blockers as possible. |
| 72 | +- Do not require all soft blockers to be fully closed before any implementation begins. |
| 73 | +- For `MVP-001` and `MVP-023`, allow limited implementation so long as the current assumptions remain explicit and no irreversible semantics are baked into code. |
| 74 | +- `MVP-033` is already resolved enough for downstream discovery and client-integration work to rely on its contract. |
| 75 | + |
| 76 | +## Phase 1: Lane Unlocks |
| 77 | + |
| 78 | +Once enough of the Phase 0 gate is stable, work can proceed in parallel lanes. |
| 79 | + |
| 80 | +The lane ordering below respects explicit backlog dependencies. Ordering within a lane is recommended unless the backlog dependency graph makes it mandatory. |
| 81 | + |
| 82 | +### Lane A: Discovery And Consumer Entry |
| 83 | + |
| 84 | +Minimum prerequisites: |
| 85 | + |
| 86 | +- `MVP-033` resolved enough for implementation |
| 87 | +- `MVP-001` stable enough for the chosen oracle/pricing exposure behavior |
| 88 | + |
| 89 | +Recommended sequence: |
| 90 | + |
| 91 | +1. `MVP-005` Implement a standalone oracle service with manual whitelist and recommended-provider response |
| 92 | +2. `MVP-007` Integrate consumer sidecar with oracle discovery while preserving direct-provider fallback |
| 93 | +3. `MVP-017` Integrate the real consumer/client path with consumer sidecar init, usage reporting, and session end |
| 94 | +4. `MVP-030` Add runtime compatibility and preflight checks for real provider/plugin deployments |
| 95 | + |
| 96 | +Notes: |
| 97 | + |
| 98 | +- `MVP-033` is resolved for MVP with the following contract: |
| 99 | + - consumer sidecar derives network from the Substreams package by default |
| 100 | + - if a package/module resolves a specific `networks` entry, that takes precedence over top-level `network` |
| 101 | + - explicit input remains supported only as fallback when package derivation is unavailable |
| 102 | + - mismatch between explicit and package-derived values fails fast after normalization |
| 103 | + - missing usable network also fails fast |
| 104 | +- `MVP-017` also depends on `MVP-011`, so only the entry/lifecycle portion should move first. |
| 105 | +- `MVP-030` is late in the lane because it depends on real-path integration existing. |
| 106 | + |
| 107 | +### Lane B: Runtime Payment And Stream Control |
| 108 | + |
| 109 | +Minimum prerequisites: |
| 110 | + |
| 111 | +- `MVP-004` |
| 112 | + |
| 113 | +Recommended sequence: |
| 114 | + |
| 115 | +1. `MVP-010` Implement session-local low-funds detection and provider Continue/Pause/Stop decisions during streaming |
| 116 | +2. `MVP-012` Add deterministic RAV issuance thresholds suitable for real runtime behavior |
| 117 | +3. `MVP-014` Integrate provider gateway validation into the real provider streaming path |
| 118 | +4. `MVP-015` Wire real byte metering from the provider/plugin path into gateway payment state |
| 119 | +5. `MVP-011` Propagate provider stop/pause decisions through consumer sidecar into the real client path |
| 120 | +6. `MVP-016` Enforce gateway Continue/Pause/Stop decisions in the live provider stream lifecycle |
| 121 | +7. `MVP-031` Wire the live PaymentSession and RAV-control loop into the real client/provider runtime path |
| 122 | + |
| 123 | +Notes: |
| 124 | + |
| 125 | +- `MVP-010` and `MVP-014` are the main foundations in this lane. |
| 126 | +- `MVP-031` is effectively the capstone runtime-payment task because it depends on real provider and consumer integration plus thresholding. |
| 127 | + |
| 128 | +### Lane C: Provider State, Settlement, And Operator Retrieval |
| 129 | + |
| 130 | +Minimum prerequisites: |
| 131 | + |
| 132 | +- `MVP-027` |
| 133 | + |
| 134 | +Recommended sequence: |
| 135 | + |
| 136 | +1. `MVP-003` Define the durable provider-side payment and settlement data model |
| 137 | +2. `MVP-008` Add durable provider storage for accepted RAV, session state, and collection lifecycle state |
| 138 | +3. `MVP-029` Implement provider collection lifecycle transitions and update surfaces for `collectible`, `collect_pending`, `collected`, and retryable collection state |
| 139 | +4. `MVP-009` Expose provider inspection and settlement-data retrieval APIs for accepted/collectible RAV state |
| 140 | +5. `MVP-022` Add authentication and authorization to provider admin/operator APIs |
| 141 | +6. `MVP-019` Implement provider inspection CLI flows for collectible/accepted RAV data |
| 142 | +7. `MVP-020` Implement manual collection CLI flow that crafts/signs/submits collect transactions locally |
| 143 | +8. `MVP-032` Expose operator runtime/session/payment inspection APIs and CLI/status flows |
| 144 | +9. `MVP-018` Implement operator funding CLI flows for approve/deposit/top-up beyond local demo assumptions |
| 145 | + |
| 146 | +Notes: |
| 147 | + |
| 148 | +- `MVP-008` and `MVP-029` can begin in parallel once `MVP-003` and `MVP-027` are stable enough. |
| 149 | +- `MVP-009` depends on `MVP-029`, so this part of the sequence is required by the backlog rather than just recommended. |
| 150 | +- `MVP-018` comes late because the current backlog explicitly ties it to operator runtime/low-funds inspection surfaces. |
| 151 | + |
| 152 | +### Lane D: Reconnect And Resume |
| 153 | + |
| 154 | +Minimum prerequisites: |
| 155 | + |
| 156 | +- `MVP-027` |
| 157 | + |
| 158 | +Recommended sequence: |
| 159 | + |
| 160 | +1. `MVP-002` Freeze reconnect handshake semantics so provider can return fresh or latest-known resumable RAV during normal session init |
| 161 | +2. `MVP-008` durable provider state work must be stable enough for reconnect behavior |
| 162 | +3. `MVP-013` Implement provider-authoritative reconnect/resume in the normal handshake path |
| 163 | + |
| 164 | +Notes: |
| 165 | + |
| 166 | +- This lane depends on both protocol and persistence work. |
| 167 | +- Reconnect should not be treated as complete until it is proven against provider-authoritative durable state, not just consumer-local memory. |
| 168 | + |
| 169 | +### Lane E: Security And Deployment |
| 170 | + |
| 171 | +Minimum prerequisites: |
| 172 | + |
| 173 | +- `MVP-028` for authenticated operator/admin surfaces |
| 174 | + |
| 175 | +Recommended sequence: |
| 176 | + |
| 177 | +1. `MVP-021` Make TLS the default non-dev runtime posture for oracle, sidecar, and provider integration paths |
| 178 | +2. `MVP-006` Add authenticated oracle administration for whitelist and provider metadata management |
| 179 | +3. `MVP-022` Add authentication and authorization to provider admin/operator APIs |
| 180 | +4. `MVP-030` Add runtime compatibility and preflight checks for real provider/plugin deployments |
| 181 | + |
| 182 | +Notes: |
| 183 | + |
| 184 | +- `MVP-021` can proceed relatively early even though it has no hard dependency on `MVP-028`. |
| 185 | +- `MVP-030` overlaps discovery and runtime work and should land once the real deployment path is concrete enough to validate. |
| 186 | + |
| 187 | +### Lane F: Observability, Validation, And Docs |
| 188 | + |
| 189 | +Minimum prerequisites: |
| 190 | + |
| 191 | +- `MVP-023` for final observability scope |
| 192 | + |
| 193 | +Recommended sequence: |
| 194 | + |
| 195 | +1. `MVP-024` Implement basic operator-facing inspection/status surfaces and log correlation |
| 196 | +2. `MVP-025` Add MVP acceptance coverage for the primary end-to-end scenarios in docs/tests/manual verification |
| 197 | +3. `MVP-026` Refresh protocol/runtime docs so they match the MVP architecture and explicit open questions |
| 198 | + |
| 199 | +Notes: |
| 200 | + |
| 201 | +- `MVP-024` can begin in a limited way before `MVP-023` is fully closed if it stays within the current “basic visibility” assumption. |
| 202 | +- `MVP-025` should be updated incrementally throughout implementation, but its final closure belongs near the end. |
| 203 | +- `MVP-026` should be completed after the key open-question outputs it depends on are stable. |
| 204 | + |
| 205 | +## Suggested Implementation Phases |
| 206 | + |
| 207 | +This is the most practical high-level order to use when prompting agents. |
| 208 | + |
| 209 | +It is a recommended rollout sequence, not a canonical priority order embedded in the backlog itself. |
| 210 | + |
| 211 | +### Phase 0: Resolve Or Narrow Shared Contracts |
| 212 | + |
| 213 | +- `MVP-004` |
| 214 | +- `MVP-027` |
| 215 | +- `MVP-028` |
| 216 | +- `MVP-001` |
| 217 | +- `MVP-023` |
| 218 | + |
| 219 | +Already resolved: |
| 220 | + |
| 221 | +- `MVP-033` |
| 222 | + |
| 223 | +### Phase 1: Start The First Implementable Lanes |
| 224 | + |
| 225 | +- Discovery foundation: |
| 226 | + - `MVP-005` |
| 227 | + - `MVP-007` |
| 228 | +- Runtime foundation: |
| 229 | + - `MVP-010` |
| 230 | + - `MVP-012` |
| 231 | + - `MVP-014` |
| 232 | +- Provider state foundation: |
| 233 | + - `MVP-003` |
| 234 | + - `MVP-008` |
| 235 | + - `MVP-029` |
| 236 | +- Security foundation: |
| 237 | + - `MVP-021` |
| 238 | + |
| 239 | +### Phase 2: Integrate Runtime And Retrieval Paths |
| 240 | + |
| 241 | +- `MVP-015` |
| 242 | +- `MVP-011` |
| 243 | +- `MVP-016` |
| 244 | +- `MVP-017` |
| 245 | +- `MVP-009` |
| 246 | +- `MVP-022` |
| 247 | +- `MVP-002` |
| 248 | + |
| 249 | +### Phase 3: Complete Reconnect, Runtime Control, And Operator Flows |
| 250 | + |
| 251 | +- `MVP-013` |
| 252 | +- `MVP-031` |
| 253 | +- `MVP-006` |
| 254 | +- `MVP-019` |
| 255 | +- `MVP-020` |
| 256 | +- `MVP-032` |
| 257 | +- `MVP-018` |
| 258 | +- `MVP-030` |
| 259 | + |
| 260 | +### Phase 4: Finalize Visibility, Acceptance, And Documentation |
| 261 | + |
| 262 | +- `MVP-024` |
| 263 | +- `MVP-025` |
| 264 | +- `MVP-026` |
| 265 | + |
| 266 | +## Tasks That Can Safely Start Before Every Open Question Is Closed |
| 267 | + |
| 268 | +These are useful to know when sequencing agent work. |
| 269 | + |
| 270 | +This section is interpretive guidance based on the assumptions register and dependency graph. It is not a direct restatement of the backlog. |
| 271 | + |
| 272 | +### Safe To Start Early |
| 273 | + |
| 274 | +- `MVP-021` |
| 275 | + - TLS default posture is broadly independent of most unresolved protocol questions. |
| 276 | +- `MVP-024` |
| 277 | + - Basic log correlation and status surfaces can begin before observability scope is finalized. |
| 278 | +- `MVP-025` |
| 279 | + - Acceptance coverage scaffolding can be built incrementally while implementation proceeds. |
| 280 | + |
| 281 | +### Safe To Start If Assumptions Remain Explicit |
| 282 | + |
| 283 | +- `MVP-005` |
| 284 | + - Can begin before `MVP-001` is fully closed if pricing authority remains clearly non-final in the API/implementation. |
| 285 | +- `MVP-003` |
| 286 | + - Some schema design can begin while `MVP-027` is being narrowed, but it should not be treated as finalized until identity semantics are stable. |
| 287 | +- `MVP-024` |
| 288 | + - Can proceed in a reduced/basic form before `MVP-023` is fully closed. |
| 289 | + |
| 290 | +### Should Usually Wait |
| 291 | + |
| 292 | +- `MVP-007` |
| 293 | + - Should wait until the chain/network and pricing exposure contracts are stable enough. |
| 294 | +- `MVP-013` |
| 295 | + - Should wait until reconnect semantics and durable provider state are both stable enough. |
| 296 | +- `MVP-019` and `MVP-020` |
| 297 | + - Should wait until retrieval APIs, auth, and collection lifecycle semantics are in place. |
| 298 | + |
| 299 | +## Prompting Guidance For Sequenced Work |
| 300 | + |
| 301 | +When prompting an agent, reference both the task and its place in the sequencing. |
| 302 | + |
| 303 | +Recommended pattern: |
| 304 | + |
| 305 | +1. State the current phase or lane. |
| 306 | +2. State the exact `MVP-###` task. |
| 307 | +3. Name the resolved prerequisites the agent is allowed to rely on. |
| 308 | +4. Name any unresolved upstream questions the agent must not answer implicitly in code. |
| 309 | + |
| 310 | +Example: |
| 311 | + |
| 312 | +```text |
| 313 | +We are currently in Phase 1, Runtime foundation. |
| 314 | +Implement MVP-010 only. |
| 315 | +You may rely on MVP-004 as the frozen runtime billing/payment contract. |
| 316 | +Do not broaden into MVP-011 or MVP-016 except for strictly necessary supporting edits. |
| 317 | +If you find that MVP-010 still requires unresolved semantics beyond MVP-004, mark it blocked instead of choosing an implicit contract in code. |
| 318 | +``` |
| 319 | + |
| 320 | +## Notes |
| 321 | + |
| 322 | +- This document derives sequence from the current dependency structure in `plans/mvp-implementation-backlog.md`. |
| 323 | +- If task dependencies change, this document should be updated to match. |
| 324 | +- When the backlog and this document disagree, the backlog is the source of truth. |
0 commit comments