Skip to content

fix: restore CI after address refactor follow-ups#28

Merged
tomcasaburi merged 1 commit intomasterfrom
codex/fix-ci-20260311
Mar 11, 2026
Merged

fix: restore CI after address refactor follow-ups#28
tomcasaburi merged 1 commit intomasterfrom
codex/fix-ci-20260311

Conversation

@tomcasaburi
Copy link
Member

@tomcasaburi tomcasaburi commented Mar 11, 2026

Summary

  • restore legacy subplebbitAddress exclusion in useEditedComment
  • make the edited comment test wait for the fetched comment before asserting edit state
  • fix the communities store retry test to override the communities getter safely and restore mocks reliably
  • switch the test server comment creation back to subplebbitAddress for compatibility with the current plebbit schema

Verification

  • yarn prettier
  • yarn test
  • yarn build
  • yarn vitest run --config config/vitest.config.js --coverage.enabled --coverage.provider=istanbul --coverage.reporter=text --coverage.reporter=json-summary --coverage.reportsDirectory=./coverage (passes)
  • node scripts/verify-hooks-stores-coverage.mjs (fails on broader pre-existing repo coverage gaps outside this diff)
  • yarn test:server (blocked locally: missing kubo binary in this environment)

Note

Medium Risk
Small but behavior-affecting change in useEditedComment’s edit-diffing plus updates to async/mocking patterns in tests; low production impact expected, but regressions would show up as incorrect edit-state UI.

Overview
Restores subplebbitAddress to the set of non-edit properties filtered out by useEditedComment, preventing address-schema fields from being treated as user edits.

Stabilizes several CI-flaky tests: useEditedComment now waits for the base comment fetch before asserting edit state; useAccountCommunities tests mock Plebbit.prototype.createCommunity (with proper this binding) and assert propagated state/error/errors; and the communities-store retry test safely overrides the plebbit.communities getter with reliable cleanup.

Updates the test server to publish comments using subplebbitAddress again for current plebbit schema compatibility.

Written by Cursor Bugbot for commit 68e0289. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error state management for account operations with better visibility into operation status and error details.
    • Enhanced consistency in comment property handling and editing workflows.
  • Chores

    • Internal test infrastructure refinements and mock handling improvements for greater reliability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63c73c8d-a3db-47a5-b2ef-5a1cf3d52f32

📥 Commits

Reviewing files that changed from the base of the PR and between 13a079b and 68e0289.

📒 Files selected for processing (4)
  • src/hooks/accounts/accounts.test.ts
  • src/hooks/accounts/accounts.ts
  • src/stores/communities/communities-store.test.ts
  • test/test-server/index.js

📝 Walkthrough

Walkthrough

This PR updates test consumption patterns for React hooks (useEditedComment, useAccountCommunities), refactors mock setup to use prototype-based method mocking, adds "subplebbitAddress" to non-editable properties in useEditedComment, and updates test infrastructure to use property descriptors for cleaner teardown.

Changes

Cohort / File(s) Summary
Account Hooks
src/hooks/accounts/accounts.ts, src/hooks/accounts/accounts.test.ts
Added "subplebbitAddress" to non-editable properties; refactored test hook consumption to merge useEditedComment and useAccountCommunities results with additional fields (state, error, errors); switched mocking from instance methods to Plebbit.prototype.createCommunity with this-bound contexts and explicit wait-for logic.
Communities Store Tests
src/stores/communities/communities-store.test.ts
Replaced direct mutation of mockAccount.plebbit.communities with a property descriptor getter pattern; added try/finally cleanup to restore original descriptors and mocks, ensuring reversible test setup.
Test Server Configuration
test/test-server/index.js
Updated plebbit2.createComment parameter from communityAddress to subplebbitAddress.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • bitsocialnet/bitsocial-react-hooks#24: Introduces related prototype-based createCommunity mocking and updates hook consumption patterns for useEditedComment and useAccountCommunities that align with changes in this PR.

Poem

🐰 With subplebbitAddress in tow,
And prototypes all wrapped just so,
The hooks now merge with graceful care,
While tests cleanup without a glare!
This rabbit hops with joy today,
The mocks are mended—hooray, hooray! 🎉

✨ 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 codex/fix-ci-20260311

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

@tomcasaburi tomcasaburi merged commit c67797d into master Mar 11, 2026
4 of 7 checks passed
@tomcasaburi tomcasaburi deleted the codex/fix-ci-20260311 branch March 11, 2026 12:36
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