|
| 1 | +# ADR-0006: Shared action types as the action identity contract |
| 2 | + |
| 3 | +- **Status:** accepted |
| 4 | +- **Date:** 2026-03-21 |
| 5 | +- **Deciders:** @Aksem |
| 6 | +- **Tags:** actions, api, architecture, environments |
| 7 | + |
| 8 | +## Context |
| 9 | + |
| 10 | +Handlers may discover and invoke other actions at runtime through `IActionRunner`. |
| 11 | +That raises a contract question: how should one action identify another across |
| 12 | +extension environments? |
| 13 | + |
| 14 | +Two architectural directions were considered: |
| 15 | + |
| 16 | +- **Type-based identification.** Actions are identified by their shared action |
| 17 | + definition type. Callers depend on the same lightweight definition package and |
| 18 | + use that type when requesting an action. |
| 19 | +- **String-based identification.** Actions are identified by a string key that can |
| 20 | + be resolved even when the action definition type is not installed in the caller's |
| 21 | + environment. |
| 22 | + |
| 23 | +The main force behind the string-based option is cross-environment invocation: one |
| 24 | +environment may want to call an action implemented elsewhere. If action definitions |
| 25 | +are not available everywhere, a string identifier appears to decouple callers from |
| 26 | +those packages. |
| 27 | + |
| 28 | +However, introducing string identity shifts the architecture toward looser and less |
| 29 | +verifiable contracts. It makes action lookup depend on convention rather than shared |
| 30 | +types, and it weakens refactor safety and discoverability. |
| 31 | + |
| 32 | +This decision therefore depends on a broader packaging rule: whether FineCode treats |
| 33 | +action definitions as lightweight shared contracts that can be installed in every |
| 34 | +participating environment, or as implementation-bound artifacts that may be absent |
| 35 | +from some environments. |
| 36 | + |
| 37 | +## Related ADRs Considered |
| 38 | + |
| 39 | +None — no existing ADR covers the `IActionRunner` API design. |
| 40 | + |
| 41 | +## Decision |
| 42 | + |
| 43 | +FineCode will use **type-based action identification**. Actions are identified |
| 44 | +through their shared action definition types, not through string-only |
| 45 | +identifiers. |
| 46 | + |
| 47 | +This decision establishes the following architectural rule: |
| 48 | + |
| 49 | +- **Action definition packages are shared contract packages.** They must remain |
| 50 | + lightweight, dependency-safe, and installable in any environment that needs to |
| 51 | + refer to those actions. |
| 52 | +- **Action implementations belong elsewhere.** Heavy runtime dependencies, |
| 53 | + platform-specific integrations, and tool execution logic belong in handler or |
| 54 | + environment-specific packages, not in the shared action-definition package. |
| 55 | + |
| 56 | +With that boundary in place, cross-environment action invocation still works because |
| 57 | +all participating environments can depend on the same shared action-definition |
| 58 | +package. A string-based lookup mechanism is therefore not part of the primary |
| 59 | +architecture. |
| 60 | + |
| 61 | +## Consequences |
| 62 | + |
| 63 | +- **Action identity is explicit and type-safe.** Callers and runners share the same |
| 64 | + contract type, which improves readability, refactor safety, and tooling support. |
| 65 | +- **Package boundaries matter more.** Action-definition packages must be kept small |
| 66 | + and free of heavy implementation dependencies. Extensions that define new actions |
| 67 | + are expected to separate contract types from execution logic. |
| 68 | +- **Cross-environment compatibility becomes a packaging concern, not a lookup concern.** |
| 69 | + Environments that collaborate on actions must share the relevant contract package. |
| 70 | +- **String-only lookup is deferred, not rejected.** If FineCode later needs to invoke |
| 71 | + actions whose definitions genuinely cannot be installed in the calling environment, |
| 72 | + the architecture should be revisited and an additional identifier mechanism may be |
| 73 | + introduced at that time. |
0 commit comments