Skip to content

Maintenance; static tracker#46

Open
AndyGura wants to merge 13 commits into
mainfrom
chore/dependency-bump-2026-05-27
Open

Maintenance; static tracker#46
AndyGura wants to merge 13 commits into
mainfrom
chore/dependency-bump-2026-05-27

Conversation

@AndyGura
Copy link
Copy Markdown
Collaborator

@AndyGura AndyGura commented May 27, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added automated CI/CD workflows for testing and code quality checks.
  • Bug Fixes

    • Fixed compiler warnings in tracker implementation.
  • Documentation

    • Reformatted documentation for consistency using standard Markdown syntax.
    • Updated examples to reflect latest package structure.
  • Chores

    • Updated dependencies to latest stable versions.
    • Enhanced metrics integration with improved labeling support.
    • Added Prettier configuration for consistent code formatting.

Review Change Stack

Co-authored-by: Junie <junie@jetbrains.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9be99095-2510-467f-b35a-50e830b13e60

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces release 0.0.7, consolidating CI/CD workflows, refactoring the StreamTracker metrics API from PromTracker-based to Tracker/Renderer pattern, and updating dependencies across the ecosystem. Examples are migrated to use the new API, legacy documentation is removed, and test syntax is modernized.

Changes

Release 0.0.7 Core Changes

Layer / File(s) Summary
CI/CD Workflow Restructuring and Release Configuration
.github/workflows/ci.yml, .github/workflows/pull_request_build.yml, .gitignore, .prettierrc, mops.toml
Consolidates build pipelines into unified ci.yml with test and fmt jobs. Adds Prettier configuration with Motoko plugin support. Updates .gitignore for ICP cache and bumps package version to 0.0.7 with dependency updates: core 2.5.0, swb 1.2.3, promtracker 1.0.1, async-test 0.0.4, moc toolchain 1.8.2.
StreamTracker API Refactoring: Tracker + Renderer Pattern
src/StreamTracker.mo
Replaces PromTracker-based metrics construction with Tracker.Tracker + PT.Renderer design. Constructor signatures change from (metrics: PromTracker, labels: Text, stable_: Bool) to (tracker: Tracker.Tracker, renderer: PT.Renderer, labels: [Label.Label]). Metrics created via tracker.newGauge/tracker.newCounter, and values registered via renderer.addValueRef/renderer.removeValue instead of direct PromTracker mutation.
Type Additions and Supporting Code
src/internal/types.mo, test/A.mo, test/B.mo, CHANGELOG.md
Introduces ChunkMessageInfo type alias. Fixes test actor file terminators. Adds 0.0.7 release notes documenting dependency updates and compiler warning fix in src/Tracker.mo, reformats prior version entries.
Example Refactoring and Dependency Updates
examples/*/mops.toml, examples/main/src/*, examples/minimal/src/*, examples/promtracker/src/*
Updates all example dependency versions. Converts imports from relative paths to package modules (mo:stream/StreamSender, mo:stream/StreamReceiver). Refactors promtracker receiver/sender to use Tracker/Renderer + include Http(...) mixin for metrics exposition. Simplifies upgrade persistence to stream state only.
Tracker Test Suite Migration to New API
test/coderabbit/tracker.test.mo
Refactors all tracker tests to use Tracker.new() + PT.Renderer() pattern with StreamTracker.Receiver/StreamTracker.Sender constructors. Replaces PT.PromTracker instances and updates exposition calls to metrics.renderExposition(). Migrates label format from strings to tuple pairs, removes "stable metrics flag" test.
Syntax Modernization and Test Formatting
test/async.test.mo, test/coderabbit/*.test.mo
Updates Motoko option/variant syntax to compact form (?#ok instead of `? `#ok). Reformats test assertions and callback checks for consistency. Adjusts test completion output and assertion ordering.
Documentation Cleanup and README Formatting
README.md, examples/README.md, test/TEST_SUMMARY.md, docs/*.md
Removes legacy API documentation (StreamReceiver.md, StreamSender.md, Tracker.md, index.md, types.md). Reformats README files for consistent Markdown list syntax. Expands TEST_SUMMARY.md with detailed Key Scenarios for each test section.

Sequence Diagram(s)

sequenceDiagram
    participant ExampleActor as Example Actor
    participant Tracker
    participant Renderer
    participant StreamTracker
    participant StreamReceiver
    ExampleActor->>Tracker: Tracker.new()
    ExampleActor->>Renderer: PT.Renderer()
    Renderer->>Tracker: addValue(metrics.toValue())
    ExampleActor->>StreamTracker: StreamTracker.Receiver(tracker, renderer, labels)
    ExampleActor->>StreamReceiver: StreamReceiver.new(...)
    StreamTracker->>StreamReceiver: init(receiver)
    ExampleActor->>Renderer: include Http(renderer.renderExposition, "/metrics")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • research-ag/stream#43: Both PRs modify the examples/promtracker metrics HTTP endpoint handling by replacing custom http_request handlers with include Http(...) mixin wiring.
  • research-ag/stream#45: Both PRs update the examples/promtracker actor upgrade/persistence logic for share/unshare state management across canister upgrades.
  • research-ag/stream#44: Both PRs directly modify GitHub Actions CI workflow setup for example canister builds using icp-cli tooling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Maintenance; static tracker' is vague and generic. While it partially references a real change (StreamTracker rename), it uses non-descriptive phrasing that doesn't clearly convey the main intent of the changeset—which is a v0.0.7 maintenance release with dependency bumps and significant API updates to StreamTracker, documentation removal, and CI workflow reorganization. Consider a more descriptive title such as 'v0.0.7: Upgrade dependencies, refactor StreamTracker API, and reorganize CI workflows' to better reflect the scope and primary changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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

@AndyGura AndyGura changed the title [WIP] v0.0.7: maintenance and static version [WIP] maintenance; v0.0.7 May 27, 2026
@AndyGura
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@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: 9

Caution

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

⚠️ Outside diff range comments (2)
test/TEST_SUMMARY.md (1)

75-77: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update tracker test summary to reflect the new Tracker/Renderer API.

These lines still describe legacy PromTracker/stable-flag behavior, but this release migrated tests to Tracker.new() + PT.Renderer() and removed the stable-metrics-flag block. The summary should match the current test architecture.

Also applies to: 214-214

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/TEST_SUMMARY.md` around lines 75 - 77, The test summary still mentions
legacy PromTracker and the stable-metrics-flag; update the three bullet lines to
describe the current Tracker/Renderer API (e.g., reference Tracker.new() and
PT.Renderer() usage and custom label behavior) and remove or reword any mention
of PromTracker or stable-metrics-flag so the summary accurately reflects the new
test architecture and behaviors validated by the tests.
test/coderabbit/tracker.test.mo (1)

119-123: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Dispose assertions are currently non-validating.

assert expositionAfter.size() >= 0 is always true, so these checks won’t catch regressions in cleanup behavior.

Proposed assertion tightening
-  assert expositionAfter.size() >= 0;
+  assert expositionAfter.size() <= expositionBefore.size();

Also applies to: 302-305

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/coderabbit/tracker.test.mo` around lines 119 - 123, The current
assertion uses assert expositionAfter.size() >= 0 which is vacuous; change the
test to capture the exposition before disposal (e.g. let expositionBefore =
metrics.renderExposition()), call metrics.dispose() (or the existing dispose
call), then assert that expositionAfter.size() <= expositionBefore.size() (and
optionally assert expositionAfter.size() < expositionBefore.size() when you
expect at least one entry removed) to ensure cleanup actually reduced or did not
increase metrics; make the same replacement for the other identical assertions
mentioned (the block around the later occurrence).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 1-9: The workflow named "CI" lacks an explicit permissions block;
add a top-level permissions section to restrict the default GITHUB_TOKEN scope
(e.g., set contents: read) so the job tokens run with least privilege; update
the YAML near the workflow header (where "name: CI" and "on:" are defined) to
include a permissions: block with at minimum "contents: read" (and any other
minimal permissions required by your jobs).
- Around line 14-15: Replace mutable GitHub Actions tags with immutable commit
SHAs for each `uses:` reference: change `actions/checkout@v6`,
`actions/setup-node@v6`, and `caffeinelabs/setup-mops@v1` to their respective
full 40-character commit SHA pins (e.g., `actions/checkout@<40-char-sha>`),
optionally appending a human-readable `# v6` or `# v1` comment for reference;
update the `uses:` entries where they appear so the workflow uses fixed SHAs
instead of floating tags.
- Line 17: CI uses unpinned Node and formatter packages which makes runs
non-deterministic; update the workflow to pin node-version from "latest" to a
specific LTS (recommend "24.x" or "22.x") for both occurrences and pin the
formatter installs from unpinned packages to exact versions by installing
prettier@3.8.3 and prettier-plugin-motoko@0.13.0 in the formatter step so the
Prettier/Motoko plugin behavior is stable.
- Line 14: The CI workflow uses actions/checkout@v6 which by default persists
credentials; update each checkout step (the occurrences of actions/checkout@v6)
to include persist-credentials: false so the runner does not write the auth
token/SSH key into local Git config — modify both checkout usages found in the
workflow to add the persist-credentials: false input under the uses entry.
- Line 20: Replace the unsafe "curl ... | sh" invocation that downloads and
executes icp-cli-installer.sh directly by changing the CI step that runs the
curl command to instead: download the installer to a file (reference
icp-cli-installer.sh), fetch and verify a published checksum or signature (e.g.,
.sha256/.asc) using a known-good key or checksum file, only then make the
downloaded file executable and run it; update the workflow step name/description
accordingly and fail the job if verification fails so the CI step that currently
contains the curl pipe is no longer executing unverified remote code.

In `@CHANGELOG.md`:
- Line 13: Update the stale changelog entry in CHANGELOG.md that currently says
"- Fixed compiler warnings in `src/Tracker.mo`" to reference the correct file
name `src/StreamTracker.mo`; replace the backticked path `src/Tracker.mo` with
`src/StreamTracker.mo` so the note points to the existing source file.

In `@examples/promtracker/src/sender.mo`:
- Around line 51-58: The sender exposition is missing because the tracker
metrics (pt) were never registered with the renderer; after creating pt
(Tracker.new()) and obtaining the renderer instance (Renderer()) call
renderer.addValue(pt.toValue()) so the gauges/counters that StreamTracker.Sender
registers on pt are exposed; ensure this call happens before including or
serving renderExposition and before tracker.init(sender) so renderer has the pt
values available.

In `@README.md`:
- Around line 120-123: The README usage examples mix import styles; update all
example import statements so they consistently use the package-style imports
(e.g., import StreamSender "mo:stream/StreamSender" and import StreamReceiver
"mo:stream/StreamReceiver") instead of relative paths—replace the relative
imports used in the sender/receiver examples (the blocks that reference
StreamSender and StreamReceiver around the shown sections) with the mo:stream/*
form so copy-paste from the docs works outside the repo layout.

In `@test/coderabbit/tracker.test.mo`:
- Around line 348-350: The test currently only checks that exposition from
metrics.renderExposition() is non-empty; change the assertions to also verify
the custom label is present by asserting the rendered exposition string includes
the literal custom_label="value" (e.g., convert exposition to string via
exposition.toString() or exposition.render() as appropriate) for the existing
check around variable exposition and similarly update the other occurrence at
lines 368-370 so both tests assert the presence of custom_label="value" in the
rendered output.

---

Outside diff comments:
In `@test/coderabbit/tracker.test.mo`:
- Around line 119-123: The current assertion uses assert expositionAfter.size()
>= 0 which is vacuous; change the test to capture the exposition before disposal
(e.g. let expositionBefore = metrics.renderExposition()), call metrics.dispose()
(or the existing dispose call), then assert that expositionAfter.size() <=
expositionBefore.size() (and optionally assert expositionAfter.size() <
expositionBefore.size() when you expect at least one entry removed) to ensure
cleanup actually reduced or did not increase metrics; make the same replacement
for the other identical assertions mentioned (the block around the later
occurrence).

In `@test/TEST_SUMMARY.md`:
- Around line 75-77: The test summary still mentions legacy PromTracker and the
stable-metrics-flag; update the three bullet lines to describe the current
Tracker/Renderer API (e.g., reference Tracker.new() and PT.Renderer() usage and
custom label behavior) and remove or reword any mention of PromTracker or
stable-metrics-flag so the summary accurately reflects the new test architecture
and behaviors validated by the tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: da53f7d7-099c-4843-91ce-d95dca6a64ee

📥 Commits

Reviewing files that changed from the base of the PR and between c62a42b and 7c443a9.

📒 Files selected for processing (34)
  • .github/workflows/ci.yml
  • .github/workflows/pull_request_build.yml
  • .gitignore
  • .prettierrc
  • CHANGELOG.md
  • README.md
  • docs/StreamReceiver.md
  • docs/StreamSender.md
  • docs/Tracker.md
  • docs/index.md
  • docs/types.md
  • examples/README.md
  • examples/main/mops.toml
  • examples/main/src/receiver.mo
  • examples/main/src/sender.mo
  • examples/minimal/mops.toml
  • examples/minimal/src/alice.mo
  • examples/minimal/src/bob.mo
  • examples/promtracker/mops.toml
  • examples/promtracker/src/receiver.mo
  • examples/promtracker/src/sender.mo
  • mops.toml
  • src/StreamTracker.mo
  • src/internal/types.mo
  • test/A.mo
  • test/B.mo
  • test/TEST_SUMMARY.md
  • test/async.test.mo
  • test/coderabbit/edge_cases.test.mo
  • test/coderabbit/integration.test.mo
  • test/coderabbit/receiver.advanced.test.mo
  • test/coderabbit/sender.advanced.test.mo
  • test/coderabbit/tracker.test.mo
  • test/coderabbit/types.test.mo
💤 Files with no reviewable changes (6)
  • docs/StreamReceiver.md
  • docs/types.md
  • .github/workflows/pull_request_build.yml
  • docs/index.md
  • docs/StreamSender.md
  • docs/Tracker.md

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread CHANGELOG.md Outdated
Comment thread examples/promtracker/src/sender.mo Outdated
Comment thread README.md
Comment thread test/coderabbit/tracker.test.mo Outdated
@AndyGura AndyGura changed the title [WIP] maintenance; v0.0.7 [WIP] static May 29, 2026
@AndyGura
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AndyGura AndyGura changed the title [WIP] static Maintenance; static tracker May 29, 2026
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