|
| 1 | +# ADR-0007: Single registration per action definition |
| 2 | + |
| 3 | +- **Status:** proposed |
| 4 | +- **Date:** 2026-03-21 |
| 5 | +- **Deciders:** @Aksem |
| 6 | +- **Tags:** actions, architecture, languages |
| 7 | + |
| 8 | +## Context |
| 9 | + |
| 10 | +FineCode actions are architectural contracts that callers discover and invoke |
| 11 | +across projects and environments. If a project can register the same action |
| 12 | +definition more than once under different project-local names, callers must know |
| 13 | +those registration details to select the intended action. That makes action |
| 14 | +identity depend on configuration rather than on the shared contract itself. |
| 15 | + |
| 16 | +This is especially problematic after [ADR-0006](0006-shared-action-types-as-the-action-identity-contract.md), |
| 17 | +which establishes shared action definition types as the identity contract. Allowing |
| 18 | +multiple registrations of the same action definition would make that lookup |
| 19 | +ambiguous at the project level. |
| 20 | + |
| 21 | +Multiple registrations also create avoidable routing work for file-oriented |
| 22 | +actions. If the same generic action definition is registered once per language, |
| 23 | +each registration or handler must independently decide which subset of files it |
| 24 | +should process. That pushes grouping and dispatch concerns into repeated |
| 25 | +project-local registrations instead of making them an explicit part of the |
| 26 | +action architecture. |
| 27 | + |
| 28 | +Multi-language actions still need a way to specialize behavior by language, but |
| 29 | +that need should be addressed through explicit composition or specialization |
| 30 | +mechanisms, not by registering the same action definition multiple times. |
| 31 | + |
| 32 | +## Related ADRs Considered |
| 33 | + |
| 34 | +- [ADR-0006](0006-shared-action-types-as-the-action-identity-contract.md) — |
| 35 | + establishes action definition types as the identity contract. This ADR extends |
| 36 | + that rule from action lookup to project registration. |
| 37 | + |
| 38 | +## Decision |
| 39 | + |
| 40 | +FineCode permits **at most one registration of a given action definition within a |
| 41 | +project**. |
| 42 | + |
| 43 | +A project-local registration name or configuration may vary, but it does not |
| 44 | +create a new action identity and does not justify additional registrations of the |
| 45 | +same action definition. |
| 46 | + |
| 47 | +Variation in tool behavior, language specialization, or environment-specific |
| 48 | +execution belongs in handlers, specialized action definitions, or other explicit |
| 49 | +composition mechanisms, not in repeated registrations of the same action |
| 50 | +definition. |
| 51 | + |
| 52 | +For multi-language file-oriented actions, the architecture must use some |
| 53 | +coordination mechanism other than "register the same generic action definition |
| 54 | +once per language". |
| 55 | + |
| 56 | +## Consequences |
| 57 | + |
| 58 | +- **Stable cross-project action identity.** Any caller can reference an action by |
| 59 | + its shared definition, regardless of which project or preset is active. This |
| 60 | + keeps action lookup APIs based on action definitions unambiguous. |
| 61 | +- **Project configuration cannot model language variants as duplicate registrations.** |
| 62 | + Multi-language behavior must be represented through explicit action |
| 63 | + specialization or routing design. |
| 64 | +- **Routing can be centralized instead of repeated.** When a dispatch-style |
| 65 | + implementation is used, file grouping and delegation can happen once rather than |
| 66 | + being reimplemented in each registration or handler. |
| 67 | +- **Some designs become more explicit.** Projects that support multiple ecosystems |
| 68 | + may need additional specialized action definitions or orchestration handlers, but |
| 69 | + the boundary between action identity and execution strategy stays clearer. |
| 70 | + |
| 71 | +### Alternatives Considered |
| 72 | + |
| 73 | +**Multiple registrations of the same action definition under different names.** |
| 74 | +Rejected because it makes action selection depend on project-local conventions, |
| 75 | +creates ambiguity for action-definition-based lookup, and encourages routing logic |
| 76 | +to be expressed as duplicate registrations instead of as explicit architecture. |
| 77 | + |
| 78 | +## Related Decisions |
| 79 | + |
| 80 | +- Refines [ADR-0006](0006-shared-action-types-as-the-action-identity-contract.md) |
| 81 | +- Related implementation mechanism: [ADR-0008](0008-class-metadata-for-language-subaction-discovery.md) |
| 82 | + |
| 83 | +## Implementation Notes |
| 84 | + |
| 85 | +One supported implementation for multi-language file actions is a dispatch |
| 86 | +handler that invokes language-specific actions. That is an implementation pattern, |
| 87 | +not the architectural rule recorded by this ADR. |
0 commit comments