Skip to content

2.1.1#21

Merged
playmiel merged 7 commits intomainfrom
dev
Mar 13, 2026
Merged

2.1.1#21
playmiel merged 7 commits intomainfrom
dev

Conversation

@playmiel
Copy link
Owner

@playmiel playmiel commented Mar 10, 2026

This pull request introduces several improvements focused on release automation, version consistency, and a significant internal rename for clarity. The main highlights include adding a new auto-tag workflow, enhancing the release workflow with changelog extraction and AI-style summaries, and renaming the CookieJar class to AsyncCookieJar throughout the codebase for clarity and consistency.

Release automation and version management:

  • Added a new GitHub Actions workflow (.github/workflows/auto-tag.yml) that automatically creates a Git tag when a version bump is detected, ensuring the version is consistent across library.json, library.properties, and src/HttpCommon.h.
  • Enhanced the release workflow (.github/workflows/release.yml) to extract the changelog for the current version, generate an AI-style release summary, and use the new version as the release name. [1] [2]
  • Introduced a new script (scripts/sync-version.sh) to synchronize version numbers across all source-of-truth files, enforcing semantic versioning and reducing human error.

Internal refactoring and naming consistency:

  • Renamed the CookieJar class and related files to AsyncCookieJar for improved clarity and alignment with the library's asynchronous design. This includes renaming files, updating class names, and modifying all usages throughout the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

Version bump:

  • Updated the version to 2.1.1 in both library.json and library.properties as part of the release process. [1] [2]

Minor improvements:

  • Increased the stack size of the auto-loop task in AsyncHttpClient to 4096 words for improved stability.
  • Added a guard in the AsyncHttpClient::cleanup method to prevent recursion during request cleanup, improving reliability.

Summary by CodeRabbit

  • New Features

    • Automated release tagging and generated release notes in CI.
  • Bug Fixes

    • Improved async operation stability with reentrancy protection.
    • Transport now notifies callbacks on connection close for cleaner shutdown behavior.
  • Chores

    • Version bumped to 2.1.1.
    • Added scripts to synchronize and verify version across project metadata.

@playmiel playmiel self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 09:32
@playmiel playmiel added the bug Something isn't working label Mar 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the project’s release automation/versioning and performs an internal naming refactor by renaming CookieJar to AsyncCookieJar, alongside a few stability fixes in request processing and transport shutdown.

Changes:

  • Added GitHub Actions automation for auto-tagging on version bumps and enhanced release notes generation (including changelog extraction + structured summary).
  • Introduced scripts/sync-version.sh and bumped version metadata to 2.1.1 across library.json, library.properties, and src/HttpCommon.h.
  • Renamed CookieJar to AsyncCookieJar across the codebase; added request-queue reentrancy guard and adjusted transport close behavior to reduce callback hazards.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/test_redirects/test_main.cpp Updates include to renamed AsyncCookieJar header.
test/test_cookies/test_main.cpp Updates include to renamed AsyncCookieJar header.
src/TlsTransport.cpp Clears AsyncClient callbacks on close to avoid late callback invocation.
src/TcpTransport.cpp Clears AsyncClient callbacks on close to avoid late callback invocation.
src/HttpCommon.h Version bump to 2.1.1.
src/AsyncHttpClient.h Renames friend/ptr type to AsyncCookieJar; adds _inTryDequeue guard flag.
src/AsyncHttpClient.cpp Uses AsyncCookieJar; increases auto-loop stack; adds tryDequeue recursion guard + safer loop iteration.
src/AsyncCookieJar.h Renames class and include guards to AsyncCookieJar.
src/AsyncCookieJar.cpp Renames implementation symbols/includes to AsyncCookieJar.
scripts/sync-version.sh New helper script to sync versions across metadata files.
library.properties Version bump to 2.1.1.
library.json Version bump to 2.1.1.
.github/workflows/release.yml Adds changelog extraction and structured release body generation.
.github/workflows/auto-tag.yml New workflow to validate version consistency and auto-create vX.Y.Z tags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +203 to +204
bool _inTryDequeue = false; // reentrancy guard to prevent cleanup → tryDequeue recursion
std::unique_ptr<AsyncCookieJar> _cookieJar;
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

_inTryDequeue is accessed from multiple code paths that can run on different tasks/threads when ESP32 auto-loop is enabled (e.g., auto-loop task + request/callback paths), but it’s a plain bool. Reads/writes to a non-atomic flag without consistently holding _reqMutex is a C++ data race (undefined behavior). Consider making this an std::atomic_bool (or guarding all accesses with lock()/unlock()), and use an atomic test-and-set/exchange pattern so the reentrancy check is safe.

Copilot uses AI. Check for mistakes.
Copy link

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

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: 7a8fc9df91

ℹ️ 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".

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19f7c8cb-632f-447f-822f-9542ab88c446

📥 Commits

Reviewing files that changed from the base of the PR and between 9e4b821 and c4f4495.

📒 Files selected for processing (1)
  • scripts/sync-version.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/sync-version.sh

📝 Walkthrough

Walkthrough

Bumps library version to 2.1.1; adds automated tagging and enhanced release-note generation workflows; introduces scripts to sync/verify version fields; renames CookieJar → AsyncCookieJar; adds a reentrancy guard in AsyncHttpClient; ensures transport close() invokes callbacks before closing.

Changes

Cohort / File(s) Summary
CI / Release Workflows & Scripts
/.github/workflows/auto-tag.yml, /.github/workflows/release.yml, scripts/sync-version.sh, scripts/verify-release.sh
Adds an auto-tagging GitHub Action that extracts version from library.json, validates it against library.properties and src/HttpCommon.h, and creates/pushes an annotated tag if missing. Updates release workflow to fetch full history, extract changelog, generate structured release notes (AI-style), and create releases using a generated body. Adds sync-version.sh to propagate a semver across library.json, library.properties, and src/HttpCommon.h; verify-release.sh now uses jq to read version.
Manifests / Version Bump
library.json, library.properties, src/HttpCommon.h
Version bumped from 2.1.0 → 2.1.1 across manifest files and public macro.
Cookie jar rename (API/internal type rename)
src/AsyncCookieJar.h, src/AsyncCookieJar.cpp, src/AsyncHttpClient.h, src/AsyncHttpClient.cpp, test/test_cookies/test_main.cpp, test/test_redirects/test_main.cpp
Renames CookieJar to AsyncCookieJar in headers, implementations, forward/friend declarations, and tests. Adjusts header guard name. No behavioral changes beyond renaming.
AsyncHttpClient internal safety & task
src/AsyncHttpClient.cpp, src/AsyncHttpClient.h
Adds std::atomic_bool _inTryDequeue{false} reentrancy guard to prevent recursive tryDequeue calls, updates logic to early-exit on reentrancy, and increases auto-loop task stack size (2048 → 4096). Adjusts cleanup/loop flows to respect the guard.
Transport close behavior
src/TcpTransport.cpp, src/TlsTransport.cpp
When a client exists, close() now invokes registered callbacks (onConnect, onData, onDisconnect, onError, onTimeout) with nullptr before closing the client.
Tests
test/test_cookies/test_main.cpp, test/test_redirects/test_main.cpp
Update includes to use AsyncCookieJar.h instead of CookieJar.h.

Sequence Diagram(s)

sequenceDiagram
  participant GH as GitHub Actions
  participant Repo as Repository (files)
  participant Git as Git/Remote (origin)
  GH->>Repo: Trigger on push to main affecting manifests
  GH->>Repo: Read `library.json` (jq -> version)
  GH->>Repo: Validate version vs `library.properties` and `src/HttpCommon.h`
  alt versions mismatch
    GH-->>GH: Emit error annotation, abort
  else versions match
    GH->>Git: Check if tag v<version> exists
    alt tag exists
      GH-->>GH: Emit notice "tag exists", skip
    else tag missing
      GH->>Git: Create annotated tag v<version>
      GH->>Git: Push tag to origin
      GH-->>GH: Emit notice "tag created"
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through files, a nimble chap,
A version nudge, then set the trap;
Tags will sprout and notes will sing,
CookieJar wears Async's ring;
Guards in place—no recursive spring! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title '2.1.1' only states a version number without describing the actual changes; it lacks specificity about what was modified or improved. Revise the title to be more descriptive, such as 'Release v2.1.1: Automation and AsyncCookieJar rename' or 'Add release automation and rename CookieJar to AsyncCookieJar' to clearly convey the main changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/verify-release.sh (1)

13-17: ⚠️ Potential issue | 🟡 Minor

Use strict jq extraction to properly detect missing/null versions.

The current jq -r '.version' at line 13 outputs the literal string "null" when the version key is missing from library.json. The check [[ -n "${VERSION_JSON}" ]] passes because "null" is non-empty, allowing the failure to go undetected. This leaves VERSION_JSON containing the string "null" instead of failing cleanly.

Use the -e flag with a proper filter to fail if the version is missing or invalid:

Suggested fix
-VERSION_JSON=$(jq -r '.version' library.json)
+VERSION_JSON=$(jq -er '.version | select(type=="string" and length>0)' library.json)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/verify-release.sh` around lines 13 - 17, The VERSION_JSON extraction
can silently return the string "null"; update the VERSION_JSON assignment to
invoke jq with the -e flag and a filter that yields the version or empties (e.g.
use the alternative operator to return empty when .version is null/missing) so
jq exits non-zero on missing/invalid versions; keep the existing VERSION_PROP
check and ensure the script fails when jq returns non-zero (so VERSION_JSON will
never be the literal "null").
🧹 Nitpick comments (1)
src/AsyncHttpClient.cpp (1)

38-38: Stack size increased from 2048 to 4096 words.

This doubles the auto-loop task stack to 16KB on ESP32. While this addresses potential stack overflows (particularly during TLS operations with deep call stacks), it also doubles memory consumption for this task.

Consider documenting the rationale for this increase (e.g., observed stack overflow, TLS requirements) or making this configurable via a build-time macro if memory is constrained on some targets.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/AsyncHttpClient.cpp` at line 38, The hardcoded stack size value "4096" in
AsyncHttpClient.cpp should be made configurable and documented: replace the
literal with a build-time macro (e.g., ASYNC_HTTP_CLIENT_TASK_STACK_WORDS or
AUTO_LOOP_STACK_WORDS) and add a brief comment explaining why the stack was
increased (observed stack overflow/TLS deep call stacks) and noting memory
trade-offs; also add a default fallback value (4096) via `#ifndef/`#define so
builds that don't define the macro keep the current behavior. Use the
symbol/context around where the task is created (the auto-loop/task creation
call that currently passes 4096) to locate and update the code and add the
explanatory comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/sync-version.sh`:
- Around line 23-96: The script currently logs "✗ ... not found" for missing
source-of-truth files (library.json, library.properties, src/HttpCommon.h) but
continues and can report success; change the file-check branches so the script
fails fast: when any of the if [[ -f ... ]] checks finds the file missing (the
branches that echo "✗ ... not found"), immediately exit with a non-zero status
(e.g., exit 1) or set a global failure flag and at the end call exit 1 if set;
update the echo lines accordingly so success ("✓ ...") is only reached when the
corresponding Python block ran and the script exits non-zero on any missing
file.

---

Outside diff comments:
In `@scripts/verify-release.sh`:
- Around line 13-17: The VERSION_JSON extraction can silently return the string
"null"; update the VERSION_JSON assignment to invoke jq with the -e flag and a
filter that yields the version or empties (e.g. use the alternative operator to
return empty when .version is null/missing) so jq exits non-zero on
missing/invalid versions; keep the existing VERSION_PROP check and ensure the
script fails when jq returns non-zero (so VERSION_JSON will never be the literal
"null").

---

Nitpick comments:
In `@src/AsyncHttpClient.cpp`:
- Line 38: The hardcoded stack size value "4096" in AsyncHttpClient.cpp should
be made configurable and documented: replace the literal with a build-time macro
(e.g., ASYNC_HTTP_CLIENT_TASK_STACK_WORDS or AUTO_LOOP_STACK_WORDS) and add a
brief comment explaining why the stack was increased (observed stack
overflow/TLS deep call stacks) and noting memory trade-offs; also add a default
fallback value (4096) via `#ifndef/`#define so builds that don't define the macro
keep the current behavior. Use the symbol/context around where the task is
created (the auto-loop/task creation call that currently passes 4096) to locate
and update the code and add the explanatory comment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7debfd9d-210e-419f-a5f2-dd0009a2063c

📥 Commits

Reviewing files that changed from the base of the PR and between aa23647 and 9e4b821.

📒 Files selected for processing (15)
  • .github/workflows/auto-tag.yml
  • .github/workflows/release.yml
  • library.json
  • library.properties
  • scripts/sync-version.sh
  • scripts/verify-release.sh
  • src/AsyncCookieJar.cpp
  • src/AsyncCookieJar.h
  • src/AsyncHttpClient.cpp
  • src/AsyncHttpClient.h
  • src/HttpCommon.h
  • src/TcpTransport.cpp
  • src/TlsTransport.cpp
  • test/test_cookies/test_main.cpp
  • test/test_redirects/test_main.cpp

@playmiel playmiel merged commit 0d95317 into main Mar 13, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants