You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: keep live card counts and follow suggestions in sync - #1477
Fix live card counts becoming stale after hovering a star, and Who to follow controls staying stale after a follow or dismissal in another tab. Tooltips retain their lazy mounting.
Changes
Re-register a card when its star button is replaced. The shared card read keeps stars, pastéis and reply counts current.
Reconcile the loaded suggestions on private updates, reconnect and tab return. Follow buttons change in place; dismissed suggestions use the existing spare-slot replacement without reshuffling the other rows.
Add a private dismissal announcement and a bounded, authenticated state read. No regular polling interval, dependencies or migrations are added.
Protect local optimistic follows and discard reads belonging to an old account or unmounted sidebar.
Validation
composer test:lint, composer test:types, composer test:type-coverage: passed; type coverage 100%.
bun run test:unit: 269 passed.
bunx vp test run tests/Unit/*.test.tsx: 1,033 passed in 103 files.
bun run build: passed.
PHP CI suite with --ci --coverage --exactly=100.0: 5,781 passed, 31,271 assertions, exactly 100% coverage (isolated local PostgreSQL). PHP files are unchanged by the final frontend recovery correction.
Regression tests cover replaced/detached buttons, shared pastéis counts, follow/dismissal events, cached suggestions, hidden tabs, reconnect, read failure and stale-account responses. The button and sidebar tests failed before the fixes.
No post-fix browser or device session was performed. This changes synchronization and element registration; tooltip rendering, UI markup/styles, touch controls and keyboard layouts are unchanged.
Independent review
Independent read-only Codex review: CODE PASS / scoped VISUAL PASS. All 16 changed files and all three commits reviewed; 73 focused tests and 10 independent reproduction tests passed. Visual scope is unchanged presentation and device mechanics; no post-fix GUI/device validation was claimed. Reviewed at 03a95b7b → c0960d48.
Limitations
A failed suggestion-state read retries on the next relevant event, rejoin or tab return. Existing call and inbox safety polling is unchanged. This does not refresh suggestion recommendation reasons or follow-back badges when another person follows you.
Summary by CodeRabbit
New Features
Follow changes and dismissed suggestions now synchronize across open tabs. The “Who to follow” list updates to reflect those changes while preserving other suggestions.
Suggestion state refreshes when you return to a tab, helping keep the list current after missed updates.
Bug Fixes
Follow actions are protected from stale updates, so a delayed refresh won’t undo a recent follow change.
No actionable comments were generated in the recent review.
Walkthrough
The change adds an authenticated endpoint for suggested-user follow and dismissal state, emits suggestion updates after new dismissals, and reconciles suggestions in the browser. It also changes how the commit-star button tracks its subscribed element.
Changes: Suggestion state synchronization
Layer / File(s)
Summary
Suggestion state API and dismissal events app/Enums/UserUpdate.php, app/Actions/CreateSuggestionDismissal.php, app/Http/Requests/ListSuggestedUserStatesRequest.php, app/Queries/SuggestedUserStatesQuery.php, app/Http/Controllers/SuggestedUserStateController.php, routes/web.php, tests/Feature/Controllers/SuggestedUserStateControllerTest.php, tests/Feature/Controllers/SuggestionDismissalControllerTest.php
Adds a validated endpoint that returns follow and dismissal flags for requested IDs. A new dismissal dispatches a UsersUpdated event with the Suggestions update type. Feature tests cover response data, authorization, input validation, caching, and event dispatch.
The client requests state on relevant events and when a hidden tab becomes visible. It applies follow updates without overriding newer local follows, removes remotely dismissed suggestions, and tops up the list. Tests cover these paths and the knowledge-base description records cross-tab synchronization.
Commit-star element subscriptions
Layer / File(s)
Summary
Track the current commit-star element resources/js/components/commit-star-button.tsx, tests/Unit/CommitStarElement.test.tsx, tests/Unit/CommitStarSubscriptions.test.tsx
The polling effect uses state to track the attached element and reruns when that element changes. Tests cover replacement, detachment, and updates to the replacement card subscription.
sequenceDiagram
participant WhoToFollow
participant UserChannel
participant SuggestedUserStateController
participant SuggestedUserStatesQuery
UserChannel-->>WhoToFollow: UsersUpdated event
WhoToFollow->>SuggestedUserStateController: GET suggested-user-states with suggestion IDs
SuggestedUserStateController->>SuggestedUserStatesQuery: get(viewer, ids)
SuggestedUserStatesQuery-->>SuggestedUserStateController: follow and dismissal flags
SuggestedUserStateController-->>WhoToFollow: users JSON
WhoToFollow->>WhoToFollow: update follow state and remove dismissed suggestions
Loading
Possibly related PRs
dev-null-sh/dev-null.sh#1458: Introduces the UsersUpdated event and private user channels used here to broadcast suggestion updates.
dev-null-sh/dev-null.sh#1148: Changes follow-suggestion behavior in the same components; this PR adds cross-tab follow-state reconciliation.
Suggested reviewers:mnapoli
Merge Risk: Minimal · up to c0960
No merge-blocking issue was identified; the suggestion-state and commit-star changes are ready for normal checks.
Security architecture risk: Low · up to c0960
The new read is authenticated, bounded and scoped to the signed-in user. Dismissal notifications carry no relationship details. No introduced authorization bypass or cross-account disclosure was established. Remaining uncertainty concerns shared browser-state cleanup during account transitions.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — An authenticated caller can choose up to 100 target UUIDs per read, but the returned relationship flags are computed only from that caller's relationships. The live-reads limiter allows 60 requests per minute keyed by authenticated user, with an IP fallback.
Trust Boundaries and Controls
observed — Caller-controlled IDs cross list and UUID validation before reaching database relationship reads. The viewer identity instead comes from CurrentUser under route authentication. Responses are private and no-store; inspected tests assert unauthenticated rejection and separation between two viewers' state.
Resilience and Maintainability Implications
observed — The reconciliation effect owns an abort controller, subscription and visibility listener. Viewer or loaded-ID changes and unmount clean them up; aborted responses are rejected before applying state. The stale-account test covers a delayed read after the viewer prop changes, but not every pending dismissal or top-up transition across accounts.
observed — The new notification reuses an event implementing after-commit dispatch and broadcast-failure rescue. Sequential repeated dismissals do not announce another update unless a relationship was newly attached. Lost notifications are recoverable through the client's subsequent authoritative reads rather than a durable event log.
Hardening Proposals
proposed — If account changes can reuse the same browser application context, namespace or reset viewer-relative shared state and bind delayed top-up callbacks to viewer identity. Target-keyed state and module-scoped dismissal tracking already existed before this PR; this is defense in depth, not an established new disclosure.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely summarizes the two main changes: synchronizing live card counts and follow suggestions.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 15 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: c20f9030-4fdd-4b1d-897f-99934b871f70
Commits
Reviewing files that changed from the base of the PR and between 03a95b7 and c0960d4.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix live card counts becoming stale after hovering a star, and Who to follow controls staying stale after a follow or dismissal in another tab. Tooltips retain their lazy mounting.
Changes
Validation
composer test:lint,composer test:types,composer test:type-coverage: passed; type coverage 100%.bun run test:unit: 269 passed.bunx vp test run tests/Unit/*.test.tsx: 1,033 passed in 103 files.bun run build: passed.--ci --coverage --exactly=100.0: 5,781 passed, 31,271 assertions, exactly 100% coverage (isolated local PostgreSQL). PHP files are unchanged by the final frontend recovery correction.Independent review
Independent read-only Codex review: CODE PASS / scoped VISUAL PASS. All 16 changed files and all three commits reviewed; 73 focused tests and 10 independent reproduction tests passed. Visual scope is unchanged presentation and device mechanics; no post-fix GUI/device validation was claimed. Reviewed at
03a95b7b→c0960d48.Limitations
A failed suggestion-state read retries on the next relevant event, rejoin or tab return. Existing call and inbox safety polling is unchanged. This does not refresh suggestion recommendation reasons or follow-back badges when another person follows you.
Summary by CodeRabbit