Skip to content

Conversation

@benoitc
Copy link
Owner

@benoitc benoitc commented Jan 3, 2026

Summary

  • Update hackney dependency to use feature/process-per-connection branch
  • Change is_reference(Ref) to is_pid(Ref) in couchbeam_httpc.erl (connection handles are now PIDs)
  • Remove hackney:request_info/1 call in couchbeam_view_stream.erl (not needed with process-per-connection model)

Test plan

  • All 17 eunit tests pass

- use hackney feature/process-per-connection branch
- change is_reference to is_pid (connection handles are now PIDs)
- remove hackney:request_info call (not needed with process-per-connection)
@benoitc benoitc force-pushed the feature/hackney-process-per-connection branch from af1bc16 to 870ee15 Compare January 3, 2026 16:57
benoitc added 27 commits January 3, 2026 19:08
The oauth module is an optional runtime dependency for OAuth authentication
support. Configure xref to ignore undefined function calls to oauth and
limit xref checks to critical issues (undefined functions, deprecated calls)
rather than unused exports which are expected for a library's public API.
- Replace jsx dependency with Erlang stdlib json:encode/1 and json:decode/1
- Switch from EJSON {[{K,V}]} format to native Erlang maps
- Add json_stream_parse.erl for streaming JSON parsing in views
- Update all modules to use maps:get/put/remove instead of proplists
- Update type definitions: ejson_object() is now map()

Breaking change: Documents are now maps instead of {[{K,V}]} tuples.
Minimum OTP version: 27
- Remove JSX decoder callbacks for longpoll mode
- Use json_stream_parse for longpoll streaming (finds "results" array)
- Use line-based parsing for continuous mode (newline-delimited JSON)
- Update all EJSON patterns to use maps
- Extend json_stream_parse to find both "rows" and "results" arrays
- couchbeam_changes: tests for parse_lines, follow_once, parse_options
- couchbeam_ejson: tests for encode/decode with maps, lists, types, round-trip
- couchbeam_uuids: tests for random and utc_random UUID generation
- Replace JSX decoder with json_stream_parse in couchbeam_view.erl
- Remove JSX callback functions (init, handle_event, wait_rows, etc.)
- Fix EJSON patterns in view_request to use maps
- Fix record field types in couchbeam_changes.erl and couchbeam_view.erl
- Add couchbeam_integration_SUITE with 8 test cases covering:
  server info, db CRUD, doc CRUD, attachments, bulk docs,
  all_docs, views, and changes feed
- Tests skip gracefully if CouchDB is not available
- Configurable via COUCHDB_URL, COUCHDB_USER, COUCHDB_PASS env vars
- Add GitHub Actions job using CouchDB 3.3 Docker service
- Integration job uses continue-on-error to not block main CI
- Remove jsx from rebar.lock (no longer needed)
- Add oauth to main deps for dialyzer PLT
- Add dialyzer config with plt_extra_apps for mimerl, xmerl, oauth
- Fix couchbeam_changes.erl: update follow/2,3 specs (always returns ok)
- Fix couchbeam_httpc.erl: remove dead code patterns (mp_mixed, mp_mixed_eof)
- Update hackney ref to 5e461f6 with renamed hackney_headers
- Disable multipart_test until hackney supports stream_multipart
The hackney process-per-connection branch removed hackney_headers:parse/2.
Updated to use the new API: from_list + get_value + parse_content_type.
Replace calls to hackney:stream_multipart/1 (which is not available in
the process-per-connection branch) with an implementation using
hackney_multipart:parser/1 and hackney:stream_body/1.

- Change wait_mp_doc/2 to wait_mp_doc/3 to accept boundary parameter
- Use hackney_multipart:parser(Boundary) to create a multipart parser
- Feed data from hackney:stream_body/1 to the parser
- Translate continuation-based parser results to expected return format
- Extract boundary from Content-Type params in couchbeam:open_doc/3
Add 9 test groups covering:

Server operations:
- server_info, server_uuids (get_uuid/get_uuids), all_dbs

Database operations:
- create_delete_db, open_or_create_db, db_info_detailed

Document operations:
- doc_crud (with revision history), doc_exists, doc_copy,
  doc_lookup_rev, doc_conflicts

Bulk operations:
- bulk_docs (20 docs), bulk_delete

Attachment operations:
- doc_with_attachment, multiple_attachments (3 files),
  large_attachment (1MB), attachment_streaming

View operations:
- all_docs, all_docs_options (startkey/endkey, limit, skip, descending),
  view_query, view_with_keys, view_pagination (3 pages),
  view_reduce (_count, _sum), view_count, view_first, view_fold

Design document operations:
- design_info, view_cleanup

Changes feed:
- changes_feed, changes_with_filter, changes_with_doc_ids,
  changes_include_docs

Error handling:
- error_not_found, error_conflict, error_invalid_doc

Each test group now uses its own isolated database for better
test isolation and parallel execution potential.
- Update hackney to latest process-per-connection branch with fixed specs
- Remove -dialyzer nowarn attributes that are no longer needed
- Update doc_stream() type to use pid() instead of hackney_client()
- Update stream_attachment/1 spec to use pid()
- Update client_ref field types in changes and view modules
- Add spec for couchbeam_httpc:request/5
- Fix server_uuids test to match actual API return format (list, not {ok, list})
- Fix doc_copy test to expect {ok, DocId, Rev} 3-tuple instead of map
- Add stream_attachment/3 convenience function for starting attachment streams
The function was returning just the binary revision instead of
wrapping it in {ok, Rev}, causing test failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants