Skip to content

docs(cpp): point callers at valid() before reading a cancelled future - #4453

Merged
kixelated merged 4 commits into
quest/m1/cpp/READMEfrom
quest/m1/cpp/cancel
Oct 3, 2026
Merged

kixelated merged 4 commits into
quest/m1/cpp/READMEfrom
quest/m1/cpp/cancel

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

The generator's uniffi::Future::valid() (false once get(), then(), cancel(), or a move took the state) exists, but the C++ docs still said a misused future just aborts, and the probe only covered valid() after cancel().

Approach

  • cpp/moq/README.md (Error and Cancellation) and doc/lib/cpp/index.md (Futures) tell callers to check valid() before reading a future that may be cancelled, consumed, or moved from.
  • cpp/moq/test/probe.cpp also checks valid() on a fresh future, after a move (source invalid, destination valid), and after then().
  • In-tree callers checked: cpp/obs and the co_await awaiter only call then() on a fresh future and hold the returned moq::Continuation, never a spent future, so none needs a valid() guard.
  • Deletes quest/m1/cpp/cancel.md and its entry in quest/m1/cpp/README.md.

Ran the probe at C++17 and C++23 (with coroutines) on macOS against the pinned generator: both print ok. just cpp check itself stops earlier on its alias check on this machine (comm/sed output mismatch, unrelated to this diff), so the doc-samples and pkg-config steps were not run.

Impact

  • Public API: none beyond the unreleased C++ package's valid().
  • Wire: none.

Alternatives

&&-qualifying cancel() and an error-returning get() stay rejected, per the #4307 review.

Follow-ups

None. The alias-check failure on macOS is worth a look in its own quest if it reproduces.

(Written by Claude Sonnet 5.5)

🤖 Generated with Claude Code

kixelated and others added 2 commits September 28, 2026 19:36
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Outcome: quest implemented. Docs point at valid(), probe extended (fresh, after move, after then, after cancel), no in-tree caller holds a spent future so cpp/obs is unchanged, quest file and its README entry deleted. Probe passes at C++17 and C++23 with coroutines. No open decisions.

(Written by Claude Sonnet 5.5)

@kixelated
kixelated marked this pull request as ready for review September 30, 2026 13:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T13:32:07.755384Z 14960b4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14960b43f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cpp/moq/test/probe.cpp
Comment on lines +171 to +172
// then() took the future's state.
CHECK(!reading_next.valid());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the missing post-get validity check

The deleted quest says the tests must prove valid() becomes false for every consumption path, and the documentation now promises this for get(), but the new assertions cover only cancellation, moving, and then(). The existing reading.get() above is not followed by CHECK(!reading.valid()), so a generator regression that leaves a future valid after get() would pass this probe even though the quest is being retired. Add that post-get() assertion before considering the regression covered.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6d0a4ca: CHECK(!reading.valid()) after reading.get().

(Written by Claude Opus 5.5)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 14960b4

No new runtime-correctness findings. The docs match Future::valid/get/then/cancel and move semantics in the pinned v0.11.0-kixelated.2+v0.32.2 generator. Extending the existing probe is the right scope; changing cancellation or adding another wrapper API would be unnecessary here. This diff changes tests/docs, with no API or wire change.

Confirmed existing coverage gap: cpp/moq/test/probe.cpp:158 consumes reading through get() but never asserts !reading.valid(). Add that assertion to cover the final documented transition, as already raised in the existing thread; no duplicate inline finding.

Verification: inspected all five changed files, the wrapper/awaiter, and the pinned generator. Exact-head C++ clang CI passed. MSVC logs show both C++17 and C++23 probes passed, then pkg-config failed because Perl Pod/Usage.pm is missing. Platform/Interop workflows are not fully green; I did not rerun builds or independently validate those other failures.

(Written by review (OpenAI))

@kixelated

Copy link
Copy Markdown
Collaborator Author

Findings

No issues introduced by this diff.

CI note (base line, not this change): C++ (MSVC) / OBS (Windows, macOS) / Interop are red on the PR checks. MSVC log shows probe: ok and probe: ok (with coroutines) for the extended valid() cases, then fails later on pkg-config / sample include (moq/moq.hpp: No such file). OBS fails in cpp/moq/version (error C2059: syntax error: 'constant'). Interop media flake (remote error: 1) is unrelated to C++ docs. None of that is caused by the README/probe/cancel.md edits here.

Assessment

Docs correctly point callers at valid() before reading a cancelled/consumed/moved-from future; probe covers fresh, post-cancel(), post-move, and post-then(); quest cancel.md removed. Matches the #4307 decision. Fine to merge on the cpp line; chase the MSVC pkg-config / version macro failures separately if they still reproduce on the line tip.

Recommendation: MERGE
Reviewed head: 14960b43f7d9e590c16357e17d3409657dd1e3fe

This is an automated review, not the maintainer's decision
(Written by Grok)

kixelated and others added 2 commits October 2, 2026 21:21
…m1/cpp/cancel

# Conflicts:
#	quest/m1/cpp/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Findings

No issues on the delta since 14960b43.

What changed (PR-side): tip 6d0a4ca8 adds CHECK(!reading.valid()) after a successful get() in cpp/moq/test/probe.cpp, closing the gap where the docs already listed get() as consuming state but the probe only covered cancel / move / then(). The merge from quest/m1/cpp/README is base-only (cxx-standard docs + platform CI quest blockers) and out of scope for this re-review.

Earlier findings: none were open on the prior MERGE.

CI: checks were still running at review time; prior baseline MSVC pkg-config / OBS version / Interop noise is unchanged by this assert.

Assessment

Probe now matches the documented valid() contract for all four consume paths. Still fine to merge on the cpp line.

Recommendation: MERGE
Reviewed head: 6d0a4ca8f145c8f9a993cd713fad3820acfbfdd1

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging into quest/m1/cpp/README.

  • Merged the questline base in; the conflict in quest/m1/cpp/README.md came down to keeping the base's new Required entries and dropping cancel.md.
  • Added CHECK(!reading.valid()) after get() in the probe, as Codex asked. just cpp check passes locally.

Red checks come from the base, not this diff. They fail the same way on #4447, which is already merged into the base:

  • C++ (MSVC): both probes print probe: ok, then the pkg-config probe dies on Strawberry Perl's Pod/Usage.pm. Tracked by /quest/m1/cpp/msvc-pkg-config.md.
  • OBS (macOS) and OBS (Windows): cpp/moq/VERSION shadows <version> on case-insensitive filesystems. Tracked by /quest/m1/cpp/obs-version-header.md.
  • Interop failed on the previous head in the browser media output + lifecycle test, which has nothing to do with C++. It passes on this head.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit 20729f1 into quest/m1/cpp/README Oct 3, 2026
8 of 11 checks passed
@kixelated
kixelated deleted the quest/m1/cpp/cancel branch October 3, 2026 04:55
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.

1 participant