Skip to content

fix(resource): serialize subject as array to prevent incomplete class on cache hit - #279

Merged
trtajim merged 1 commit into
mainfrom
fix/resource-cache-serialization
Sep 2, 2026
Merged

fix(resource): serialize subject as array to prevent incomplete class on cache hit#279
trtajim merged 1 commit into
mainfrom
fix/resource-cache-serialization

Conversation

@trtajim

@trtajim trtajim commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Resource subjects are now serialized consistently when loading resource pages.
    • Resource pages correctly preserve completion status and completion counts when served from cache.
  • Tests

    • Added coverage for cached page requests.
    • Added coverage verifying completed resources display the correct completion state and count.

@trtajim
trtajim merged commit afa1c35 into main Sep 2, 2026
5 of 6 checks passed
@trtajim
trtajim deleted the fix/resource-cache-serialization branch September 2, 2026 09:03
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 208d163b-0a10-4159-bd49-ac05361f8ee6

📥 Commits

Reviewing files that changed from the base of the PR and between 01ee578 and d8e396d.

📒 Files selected for processing (2)
  • app/Http/Controllers/ResourceController.php
  • tests/Feature/PublicPagesTest.php

📝 Walkthrough

Walkthrough

The resource controller now serializes cached subjects as arrays. Feature tests cover repeated resource requests and completion state from cached data.

Changes

Resource cache behavior

Layer / File(s) Summary
Cached subject serialization
app/Http/Controllers/ResourceController.php
The cached subject value now uses toArray() before it is returned.
Cache-hit and completion validation
tests/Feature/PublicPagesTest.php
Tests now cover repeated page requests and verify isCompleted and completionsCount after resource completion.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/resource-cache-serialization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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