[codex] align relay agent activity Effect services#3179
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🚀 Expo continuous deployment is ready!
|
ApprovabilityVerdict: Approved Mechanical refactoring that reorganizes Effect service type definitions by inlining You can customize Macroscope's approvability policy. Learn more. |
b1ec08c to
c24202d
Compare
Dismissing prior approval to re-evaluate c24202d
Co-authored-by: codex <codex@users.noreply.github.com>
c24202d to
878c7d7
Compare
Dismissing prior approval to re-evaluate 878c7d7
Summary
Context.Servicetags and replaces standalone shape references withService["Service"].makevalues and canonicallayerexports without syntheticEffect.succeedwrappers.layerCloudflareQueues.reason; the human-readable message is derived from that reason.Behavior
Delivery, persistence, queueing, and APNs request behavior are unchanged. The invalid-job error payload is more structured while retaining the existing messages through its getter.
Validation
vp test src/agentActivityfrominfra/relay— 8 files / 50 tests passedvp check— passed; 20 pre-existing unrelated warningsvp run typecheck— passedgit diff --check origin/main...HEAD— passedNote
Low Risk
Mostly structural typing and imports; the only behavioral API shift is
ApnsDeliveryJobInvalidexposingreasoninstead of a storedmessagefield—callers that relied on serialized error data should usereason.Overview
Refactors relay agent-activity modules to match the repo’s Effect
Context.Servicepattern: standalone*Shapeinterfaces are removed and service contracts are inlined on each service class. Call sites and tests now type mocks and implementations viaSomeService["Service"]instead ofSomeServiceShape.ApnsClientswitches to submodule imports foreffect/unstable/http(Headers,HttpClient,HttpClientRequest) and usestype-only config import; implementation typing referencesApnsClient["Service"].ApnsDeliveryJobInvalidno longer stores a free-textmessagefield. It carries a finitereasoncode (e.g.invalid-queue-payload,invalid-signature,missing-live-activity-aggregate); human-readable text is unchanged via amessagegetter mapped fromreason. Validation andprocessSignedJobpaths construct errors with reason codes.Minor import/style updates:
Function.castviaeffect/Functionnamespace in persistence modules. No intended change to publish/deliver/register runtime behavior beyond the error payload shape for invalid queue jobs.Reviewed by Cursor Bugbot for commit 878c7d7. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Refactor relay agent activity services to inline
Context.Servicetypes and addreasoncodes toApnsDeliveryJobInvalid*Shapeinterfaces from all agent activity services (ApnsClient,ApnsDeliveries,LiveActivities,AgentActivityRows,Devices, etc.) and inlines the service shape directly into theContext.Servicegeneric, aligning with the Effect service pattern used elsewhere in the relay.ApnsDeliveryJobInvalidin apnsDeliveryJobs.ts to carry areasonfield with specific literal codes (e.g.'missing-live-activity-aggregate','invalid-signature') instead of a rawmessagefield;messageis now derived via a getter.validatePayloadShapeandverifySignedApnsDeliveryJobto constructApnsDeliveryJobInvalidwith the newreasoncodes.ApnsDeliveryJobInvaliderror objects now expose a structuredreasoncode for programmatic inspection; callers reading.messagefrom the schema field will need to use the getter instead.Macroscope summarized 878c7d7.