Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Spear.append/3 raw?: true raw return #97

Merged
merged 7 commits into from
May 9, 2024

Commits on May 2, 2024

  1. fix: Spear.append/3 raw?: true raw return

    Issue NFIBrokerage#96
    
    Passing a `raw?: true` option to `Spear.append/3` or `Spear.Client/append`
    continued to return `:ok` instead of `{:ok, AppendResp.t()}`.
    
    This contradicted the docs and the `Spear.append_batch/5` behaviour.
    
    Solution:
    
    This commit adds the conditional case in `Spear.append/3`
    to return `{:ok, AppendResp.t()}` when `raw?` is `true`.
    
    `Spear.Client.append` will also be fixed as a result.
    
    Additional Notes:
    
    * Added to `SpearTest`: to test `append/3` for both raw true and false
    * Added to `SpearTest`: to test `append_batch/5` for both raw true and false.
    * Updated the `Spear.append/3` type spec to add the missing
      `{:ok, AppendResp.t()}` return type.
    * Updated the `Spear.Client.append/3` and `Spear.Client.append/4`
      callback specs to add the missing `{:ok, AppendResp.t()}` return type.
    byu committed May 2, 2024
    Configuration menu
    Copy the full SHA
    77dabbb View commit details
    Browse the repository at this point in the history

Commits on May 3, 2024

  1. fix: append_batch raw test, add compat tag

    adding compat tag to the append_batch tests,
    which weren't carried over from the append_batch test
    copy pasting.
    byu committed May 3, 2024
    Configuration menu
    Copy the full SHA
    168ba91 View commit details
    Browse the repository at this point in the history
  2. fix: spear_test mix format

    Fixes a `mix format --check-formatted` issue in `spear_test.exs`
    that was caught with Elixir 1.14, vs not catching in Elixir 1.16.2.
    byu committed May 3, 2024
    Configuration menu
    Copy the full SHA
    f86a938 View commit details
    Browse the repository at this point in the history

Commits on May 6, 2024

  1. fix: Spear.append raw?: returns full AppendResp

    Before, it was pulling out the "result", now we're returning
    the raw proto
    byu committed May 6, 2024
    Configuration menu
    Copy the full SHA
    a1038cc View commit details
    Browse the repository at this point in the history
  2. fix append raw error (again)

    1. fixes the unintentionally added extra nesting of `{:ok, {:ok, resp}}`
      Instead, when success and raw flag set, returns `{:ok, raw_response_pb}`.
    2. Adds the extra raw response check so that `append/3` returns
        `{:error, raw_unexpected_version_response_pb}` if there is the wrong
        expected version response AND raw flag set.
    
    If I just did
    
    ```
      {:ok, response} when raw? == true ->
            {:ok, response}
    ```
    
    An `{:ok, raw_unexpected_version_response_pb}` could have been returned
    on unexpected version error response.
    byu committed May 6, 2024
    Configuration menu
    Copy the full SHA
    f2c5fb4 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2024

  1. fix: append/3 returns {:ok, raw_resp} for all

    `raw?: true` cases regardless of `:success` or `:wrong_expected_version`
    
    Also, cleans up the test cases to use `Streams.append_resp`
    pattern matching.
    byu committed May 7, 2024
    Configuration menu
    Copy the full SHA
    02e9ba3 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2024

  1. Configuration menu
    Copy the full SHA
    a291c79 View commit details
    Browse the repository at this point in the history