Commit 83bf89e
authored
propose: v2 brownfield annotations — split @CodebaseRoute, enum-typed kinds (#36)
* propose: v2 brownfield annotations — split @CodebaseRoute, enum-typed kinds
Direct outcome of feedback during the first real-project rollout:
- User reached for @CodebaseRoute(framework=kafka, …) for an outbound
Kafka producer (right concept, wrong annotation). The asymmetry of
the v1 set (one inbound annotation across HTTP+async, two outbound
annotations split by transport) was the proximate cause.
- User asked why clientKind is a string when the valid set is a
small enum. Typos fail silently with stderr warning.
- User asked why @CodebaseRoute is unified across HTTP+async when
client/producer are split.
v2 design (per user direction: breaking change OK, no migration):
- Split @CodebaseRoute into @CodebaseHttpRoute and @CodebaseAsyncRoute
- All 'kind'/'framework' fields become typed enums in the annotation set
- @CodebaseClient.clientKind: String → CodebaseClientKind enum (required)
- @CodebaseProducer.clientKind → producerKind (rename) +
CodebaseProducerKind enum
- Drop the optional cluster-name 'broker' field on both
@CodebaseAsyncRoute (Java method-name collision with the new
enum 'broker()') and @CodebaseProducer (uniform cleanup;
resolver does nothing with it on either side)
No code change in this propose; planning + implementation are separate.
Test baseline unchanged: 290 passed, 4 skipped.
* propose: tighten v2 — direction-honest, no redundant kind/framework/broker
Review feedback exposed three more problems with the first v2 draft:
1. `framework` on @CodebaseHttpRoute is never used by the resolver.
Verified by grepping build_ast_graph.py / graph_enrich.py:
- Only used as a list_routes filter and routes_by_framework
cosmetic count.
- Never branched on by the call-edge matcher.
Drop it; the extractor still populates Route.framework
internally from source annotations.
2. `broker` on @CodebaseAsyncRoute is fully derivable from `kind`
(bijection: kafka_topic⇒kafka, rabbit_queue⇒rabbitmq, etc.).
Drop both `broker` and `kind` from the user-facing annotation;
the kind is inferred from the listener-annotation context.
3. The really important one: v1 @CodebaseRoute(kind=http_consumer)
was an OUTBOUND Feign declaration (caller-side declaration of a
remote endpoint), but @CodebaseRoute was advertised as inbound.
The annotation lied about its direction. Move Feign declarations
to @CodebaseClient(clientKind=feign_method, …) where they
honestly belong.
Net result: v2 inbound annotations carry only path+method or topic.
Outbound annotations carry kind enum + destination hints. Two
enums live (CodebaseClientKind, CodebaseProducerKind), down from
five in the earlier v2 draft.
Resolver flow change: pass6 hint-recovery walk now consults
@CodebaseClient records on the caller member instead of the
caller's http_consumer route. list_routes stops returning Feign
declaration rows — covered by a follow-up propose for a
list_clients MCP tool.
No code change in this propose; tests unchanged at 290 passed,
4 skipped.1 parent ea353c6 commit 83bf89e
1 file changed
Lines changed: 466 additions & 0 deletions
0 commit comments