SY-4333: Move Signal Propagation Out of Distribution Layer#2494
Conversation
…depend-on-arc-service
…depend-on-arc-service
…l-service-so-it-doesnt-depend-on-arc-service # Conflicts: # core/pkg/service/channel/calculation/calcstate/state_config_test.go
…depend-on-arc-service
…depend-on-arc-service
…depend-on-arc-service
…-arc-service' into sy-4333-move-signal-propagation-out-of-distribution-layer
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (76.37%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## rc #2494 +/- ##
==========================================
+ Coverage 67.67% 67.77% +0.10%
==========================================
Files 2546 2565 +19
Lines 124876 126780 +1904
Branches 9153 9164 +11
==========================================
+ Hits 84507 85929 +1422
- Misses 33833 34141 +308
- Partials 6536 6710 +174
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@greptile /rerun |
|
@greptile /rerun |
There was a problem hiding this comment.
Should this still be a sub-package? The primary reason I had to put these in a separate package was to avoid circular deps. That isn't necessary anymore, so why isn't this core/pkg/service/ontolgoy.PublishSignals?
There was a problem hiding this comment.
So core/pkg/service/signals only depends on the distribution layer channels service. That means that there won't be a circular dep issue, and this package can get moved directly into the service layers channel service right?
There was a problem hiding this comment.
Changed it so that the signals service imports channel.Service and framer.Service. will be moving most channel functionality out of the distribution layer into the service layer channel service and the ontology will eventually be in core/pkg/service/ontology as well.
|
@greptile /rerun |
Issue Pull Request
Linear Issue
SY-4333
Description
Moves change-data-capture (CDC) signal propagation out of the distribution layer and into the service layer, where it belongs architecturally. After this change the distribution layer has no knowledge of signals at all.
Package move
signalspackage moves fromcore/pkg/distribution/signalstocore/pkg/service/signals.distribution/{channel,group,ontology}/signals→service/{channel,group,ontology}/signals.Layer wiring
distribution/layer.gono longer constructs thesignals.Provider, runs any CDC publishers, or exposes aSignalsfield, and theEnableServiceSignalsconfig knob is removed.service/layer.gonow owns provider construction and starts the channel, group, and ontology publishers on open. All downstream services consumel.Signalsinstead ofcfg.Distribution.Signals.label,status,channel, andgroupsignals already behave.Layering fix
distribution/mock/cluster.go) no longer exposes asignals.Provideror importsservice/signals, removing a distribution→service layering inversion. Service-layer tests that need a provider construct one directly from the mock node'sChannel/Framer.Ontology relationship CDC simplification
service/ontology/signalsnow publishes relationship changes straight from the ontology's relationship gorp table viasignals.PublishFromGorp(the same pattern group signals use), replacing a hand-written observable translator. The set/delete wire format is unchanged (the relationship key string, which round-trips viaParseRelationship). Resource CDC stays on the aggregate resource observer, since resources are sourced from every registered ontology service rather than a single gorp table.Tests
service/channel/signalsandservice/group/signals.BeforeSuiteand no longer rely onOrderedcontainers.Basic Readiness
Greptile Summary
This PR moves CDC (change-data-capture) signal propagation from the distribution layer into the service layer, resolving a layering inversion where
distribution/signalshad knowledge of service-level concerns. Thesignals.Provideris now constructed inservice/layer.goand distributed downward instead of up fromdistribution/layer.go.distribution/signals→service/signals; per-entity publishers for channel, group, and ontology move alongside it.distribution/layer.gono longer carries aSignalsfield orEnableServiceSignalsconfig knob.layer.go: rack, task, arc, label, and status CDC publishers are now wired directly inOpenLayer; services that have custom CDC logic (user, rbac, ranger, etc.) still accept a*signals.Providerfrom the layer instead of fromcfg.Distribution.Signals.Confidence Score: 5/5
This is a clean architectural refactoring with no behaviour changes to the CDC wire format or channel names. Safe to merge.
The channel names produced by DefaultGorpPublisherConfig are preserved identically for all entry types (Status[any] has a CustomTypeName implementation returning Status; all other types are non-generic). The signal publisher pipelines are functionally identical to what was in the distribution layer. Service initialization order in layer.go is correct, and all Observe() hooks are present on their respective services.
No files require special attention. The most complex change is the new GorpPublisherConfig generic machinery in service/signals/gorp.go, which is well-validated and covered by existing tests.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD subgraph ServiceLayer["service/layer.go (OpenLayer)"] SL_Signals["signals.Provider (NEW)"] SL_CDC["CDC Publishers (NEW)"] SL_Other["User / RBAC / Ranger / ... Services"] end subgraph DistLayer["distribution/layer.go"] DL_Channel["Channel"] DL_Group["Group"] DL_Ontology["Ontology"] end subgraph CDCPubs["CDC Publishers"] P1["sy_channel_set/delete"] P2["sy_group_set/delete"] P3["sy_ontology_resource/relationship"] P4["sy_label_set/delete"] P5["sy_status_set/delete"] P6["sy_rack_set/delete"] P7["sy_task_set/delete"] P8["sy_arc_set/delete"] end SL_Signals --> SL_CDC SL_CDC --> CDCPubs SL_Signals --> SL_Other DL_Channel --> P1 DL_Group --> P2 DL_Ontology --> P3 CDCPubs -.->|stream| FreeChannels["Free Virtual Channels"]%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD subgraph ServiceLayer["service/layer.go (OpenLayer)"] SL_Signals["signals.Provider (NEW)"] SL_CDC["CDC Publishers (NEW)"] SL_Other["User / RBAC / Ranger / ... Services"] end subgraph DistLayer["distribution/layer.go"] DL_Channel["Channel"] DL_Group["Group"] DL_Ontology["Ontology"] end subgraph CDCPubs["CDC Publishers"] P1["sy_channel_set/delete"] P2["sy_group_set/delete"] P3["sy_ontology_resource/relationship"] P4["sy_label_set/delete"] P5["sy_status_set/delete"] P6["sy_rack_set/delete"] P7["sy_task_set/delete"] P8["sy_arc_set/delete"] end SL_Signals --> SL_CDC SL_CDC --> CDCPubs SL_Signals --> SL_Other DL_Channel --> P1 DL_Group --> P2 DL_Ontology --> P3 CDCPubs -.->|stream| FreeChannels["Free Virtual Channels"]Reviews (4): Last reviewed commit: "Merge branch 'rc' into sy-4333-move-sign..." | Re-trigger Greptile