Skip to content

To master#331

Merged
sgerbino merged 15 commits into
masterfrom
develop
Jun 21, 2026
Merged

To master#331
sgerbino merged 15 commits into
masterfrom
develop

Conversation

@sgerbino

Copy link
Copy Markdown
Collaborator

No description provided.

sgerbino and others added 15 commits June 15, 2026 14:14
Make the codecov project status a failing check (target auto, 0%
threshold) instead of informational, so any drop in include/ + src/
coverage fails it. Requires the check to be marked required in branch
protection. ci.yml already uploads coverage on every PR.
The join statement removes the race between thread_pool and main thread.
Several buffer free functions rendered their parameters as bulleted lists
or not at all. MrDocs renders @param as a Name/Description table, and
MrDocs added first-class function-object (niebloid) support, so the
old workarounds are no longer needed.

- buffer_slice: convert the @Par Parameters/@Li list to @param tags;
  document the deleted rvalue (const&&) overload.
- when_any: add @param to the variadic overload.
- front, buffer_copy, begin, end, buffer_size, buffer_empty: restore the
  original anonymous-struct niebloid form (drop the obsolete
  *_mrdocs_workaround_t type names), mark each with @functionobject, and
  move @param/@return onto each operator() so MrDocs renders an
  "Algorithm Function Object" page with a parameter table.

ready already used @param and renders correctly; left unchanged.
… ranges

The generic mutable overload took an lvalue reference `make_buffer(T&)`,
so a `boost::span<char>` passed as a temporary could not bind to it and
fell through to the const overload, returning a `const_buffer` (#147).
`std::span<char>` only escaped this via a dedicated by-value overload.

Change the generic mutable overloads to a forwarding reference
`make_buffer(T&&)` so by-value mutable contiguous ranges bind there and
return `mutable_buffer`. Remove the now-redundant explicit C-array,
std::array, std::vector, std::basic_string, and std::span overloads,
which the concept-based generic overloads fully subsume; prune the
includes they required.

Behavior is preserved for all non-empty inputs; for empty array/
const-string/span the returned (size-0) buffer's data pointer is now
normalized to nullptr, matching vector/string.

Add a prvalue std::span regression test plus a boost::span test guarded
by __has_include so Capy still builds and passes without Boost present.
The run_async trampoline's unhandled_exception swallowed every escaping
exception, so an unhandled task error vanished silently and the documented
"exceptions are rethrown" behavior never happened.

Make the trampoline call std::terminate instead: an exception reaches it
only by escaping a handler (a handler that threw, or the default handler on
an otherwise-unhandled task error), which is a genuine fault with no owner
to receive it. Failing fast is loud and leak-free (the process ends), and
needs no executor cooperation. To observe an error instead, pass an error
handler (it receives the exception_ptr); to catch one, co_await the work
inside a coroutine.

Cooperative cancellation must not be treated as a fault: the default
handler discards a stop_requested_exception (quitter's stop sentinel) so a
stopped quitter completes silently rather than terminating. The result-only
handler delegates to the same logic.

Document the new behavior and exclude the terminate lines from coverage. Add
a POSIX fork-based death test covering both terminate paths (no handler, and
a rethrowing handler); it is guarded out on Windows.
read and write reported any error_code surfaced by the final
read_some/write_some, even when that completion delivered the last bytes
and filled the buffer. A generic observer (when_any/when_all) then saw a
completed transfer as a failure. The most common trigger is end-of-stream
coincident with a full read (read_some returns [eof, n] that fills the
buffer).

Report the contingency only when the buffer was not fully transferred:
when n == buffer_size(buffers) the transfer succeeded and ec is success.
Tighten the documented postcondition accordingly.

Codify the same invariant in the ReadStream and WriteStream concept
contracts: a read_some/write_some that fills its buffer reports success,
so n == buffer_size(buffers) implies no error (a coincident condition such
as end-of-stream surfaces on a subsequent call).

Add a mock stream that reports a contingency in the same completion that
transfers bytes (the test read/write streams report errors with zero
bytes) and cover both the filled-is-success and short-transfer-is-reported
cases.
Repo wg21-papers was reorganized, link bekame stale.
The macos-26 runner ships Xcode 26.5 / Apple Clang 21, so the CMake
build no longer needs the visibility workaround there. macos-15
(Apple Clang 17) is still affected and keeps the flag. The workaround
only ever mattered for CMake builds; b2 defaults to hidden visibility
and is unaffected.

Closes #194
This is an attempt to formally describe the contract of functions that
take the dynamic byffer ant the initial size hint.
…ror_condition

Override default_error_condition in error_cat so each
capy error maps to its canonical portable condition: canceled ->
std::errc::operation_canceled, timeout -> std::errc::timed_out, and
eof/stream_truncated/not_found to their cond::* equivalents.
when_any selects a winner by success (!ec); a failing child neither wins
nor cancels its siblings. This was reported as a bug (#265)
but is by design. Document the behavior explicitly and the two patterns for
treating an error as a win, and replace the dangling "see Racing Tasks"
reference (which pointed at an unpublished doc/unlisted/ page).

- doc/.../4f.composition.adoc: add "Errors Do Not Win" and "Treating an
  Error as a Win" subsections under when_any; drop the dead reference.
- include/boost/capy/when_any.hpp: add a @note to the variadic when_any
  docstring pointing readers to the patterns.
Add an "Asynchronous Sleep" section to the concurrent composition page
that frames delay as the non-blocking counterpart to sleep_for. Cross-link the custom-IoAwaitable guide to delay_awaitable as a production example of the
stop-callback-must-post pattern, and list delay.hpp/timeout.hpp in the
page reference table.
Audited the Antora book and header Javadoc against the implementation
and corrected every factual and conceptual discrepancy, treating the
code as canonical.

Key corrections:
- read_some/write_some error contract: n < buffer_size on error, and a
  full buffer always means success (conditions deferred to the next
  read); rewrote the chapter 9 rationale and fixed the 9n header misquote
- BufferSource/BufferSink: span-based pull/prepare plus consume, matching
  the real concepts (was pointer+count with integer returns)
- cancellation: this_coro::stop_token and error::canceled (removed the
  nonexistent get_stop_token and error::operation_aborted)
- dynamic buffers: fixed-capacity adapters over external storage built via
  pointer or the dynamic_buffer factory (was grow-on-demand)
- any_* wrappers: owning by value vs reference by pointer (no S& ctor)
- IoAwaitable/IoRunnable concepts, Executor concept, composed-op return
  types (io_task), and assorted symbol/path fixes

Verified all 489 code examples compile against the real API. Fixed real
breakage: mutable_buffer(array) to make_buffer, co_await std::move on a
named task, the mmap_source io_result return, the fabricated
test::stream(fuse) constructor, and buffer_to_string on bufgrind slices.

Build instructions link capy with no external dependencies, and the
thread_pool examples call join() to drain outstanding work.
The OS Integration section listed only IOCP and io_uring and presented
io_uring as the Linux mechanism. Corosio's default backend selection is
IOCP > epoll > kqueue > select; io_uring is opt-in, so Linux defaults to
epoll, not io_uring.

Describe cancellation by backend class instead: completion-based backends
(IOCP, io_uring when enabled) cancel in the kernel, while readiness-based
backends (epoll, kqueue, select) remove the pending operation from the
reactor before its syscall runs. State the reported error,
std::errc::operation_canceled, and drop the fragile per-syscall names.
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://331.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-06-21 16:23:03 UTC

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.07%. Comparing base (7f2dc8e) to head (9144290).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #331      +/-   ##
==========================================
- Coverage   98.09%   98.07%   -0.03%     
==========================================
  Files         164      164              
  Lines        8873     8774      -99     
==========================================
- Hits         8704     8605      -99     
  Misses        169      169              
Flag Coverage Δ
linux 98.17% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/boost/capy/buffers.hpp 100.00% <ø> (ø)
include/boost/capy/buffers/buffer_copy.hpp 100.00% <ø> (ø)
include/boost/capy/buffers/buffer_slice.hpp 100.00% <ø> (ø)
include/boost/capy/buffers/make_buffer.hpp 100.00% <100.00%> (ø)
include/boost/capy/detail/run_callbacks.hpp 100.00% <100.00%> (ø)
include/boost/capy/error.hpp 100.00% <ø> (ø)
include/boost/capy/ex/run_async.hpp 100.00% <ø> (ø)
include/boost/capy/ex/strand.hpp 100.00% <ø> (ø)
include/boost/capy/ex/thread_pool.hpp 100.00% <ø> (ø)
include/boost/capy/io_result.hpp 100.00% <ø> (ø)
... and 8 more

... and 15 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f2dc8e...9144290. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://331.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://331.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://331.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-06-21 16:38:43 UTC

@sgerbino sgerbino merged commit 9144290 into master Jun 21, 2026
77 checks passed
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.

5 participants