← Back to Pull requests

Initial message fix #593

Open
akbashev opened this pull request with 39 lines diff across 5 files
View on GitHub
akbashev akbashev commented on Jul 16, 2024 08:34 UTC
Author

Last week I've been checking bidirectional examples with latest Xcode 16 beta 3 and realised it uses HBv2, which is supported only by macOS 14+, and it's not perfect. After downgrading to HBv1—same problem with returning stream until some bytes are sent appeared. Haven't figured out yet why, maybe some tech inside uses URLSession. So, this PR fixes two things:

  • Moved server to Vapor for two reasons: 1) anyway can't use HBv2 now and 2) it could be more familiar to others;

  • Moved back to URLSession for client and added initial message hack.
  • It's working for now. I'll be checking from time to time status of Swift Server tools, maybe we can improve it in the future.

    Diff: 39 lines (+23 / -16) across 5 files Reviewer: czechboy0 Review duration: 1254328m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.38) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.38 · 39 lines diff across 5 files
    0.38
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    88%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.221
    Real PR Conversation Timeline
    7 items
    czechboy0 czechboy0 commented on code on Jul 16, 2024 10:36 UTC
    Code Review
    Examples/bidirectional-event-streams-client-example/Package.swift:1
    @@ -20,14 +20,14 @@ let package = Package(
         dependencies: [
             .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
             .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.2.0"),
    -        .package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
    +        .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),

    I think it's fine to keep it using AHC? Since it doesn't require the initial message hack?

    akbashev akbashev commented on code on Jul 16, 2024 11:06 UTC
    Code Review
    Examples/bidirectional-event-streams-client-example/Package.swift:1
    @@ -20,14 +20,14 @@ let package = Package(
         dependencies: [
             .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
             .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.2.0"),
    -        .package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
    +        .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),

    @czechboy0 we could, it doesn't matter in the end as there something with transport happening (both for vapor and hbv1), so we anyway need initial message

    czechboy0 czechboy0 commented on code on Jul 16, 2024 11:12 UTC
    Code Review
    Examples/bidirectional-event-streams-client-example/Package.swift:1
    @@ -20,14 +20,14 @@ let package = Package(
         dependencies: [
             .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
             .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.2.0"),
    -        .package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
    +        .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),

    there something with transport happening (both for vapor and hbv1)

    Can you elaborate what you're seeing? Are you saying even when using AHC, you still don't get the stream established without an initial message?

    akbashev akbashev commented on code on Jul 16, 2024 11:29 UTC
    Code Review
    Examples/bidirectional-event-streams-client-example/Package.swift:1
    @@ -20,14 +20,14 @@ let package = Package(
         dependencies: [
             .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
             .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.2.0"),
    -        .package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
    +        .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),

    Can you elaborate what you're seeing? Are you saying even when using AHC, you still don't get the stream established without an initial message?

    Yep, exactly. I will try to investigate, but for now think we can just update the example.

    czechboy0 czechboy0 requested changes on Nov 22, 2024 14:05 UTC
    Changes Requested Reviewer

    @akbashev if you have some time, please investigate where this issue might be, I'd prefer not to switch the example until we have a good understanding of why it doesn't work

    akbashev akbashev commented on Nov 27, 2024 09:13 UTC
    Author

    @czechboy0 will check, last time I've tried—it was a bit hard, cause it's hard to debug "not happening" events.

    Reviewers
    Assignees
    akbashev akbashev
    Labels
    risk: low confidence: 88.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.9% (MEDIUM) · Higher = larger blast radius
    37.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.6% · Lower = rushed or shallow review
    88.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.3% · Safe to merge
    4.3%