Skip to content

Redirect Next adapter to portable core runtime#59

Merged
cobraprojects merged 1 commit into
mainfrom
plugins-system
Jul 9, 2026
Merged

Redirect Next adapter to portable core runtime#59
cobraprojects merged 1 commit into
mainfrom
plugins-system

Conversation

@cobraprojects

@cobraprojects cobraprojects commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Improved storage handling so plain text and structured data round-trip more consistently when saving and reading items.
    • Fixed remote content retrieval to return the expected stored payload during reads.
  • Tests

    • Updated storage and adapter test coverage to match the revised read/write behavior and remote fetch handling.

@netlify

netlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy Preview for holo-docs canceled.

Name Link
🔨 Latest commit e549013
🔍 Latest deploy log https://app.netlify.com/projects/holo-docs/deploys/6a4eeab78dee4a00081ac7e1

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adapter-next's runtime import switched from @holo-js/core to @holo-js/core/runtime, with matching tsconfig and vitest alias entries added pointing to the core portable module. Storage-related tests were updated with stateful fetch mocks and adjusted assertions for string/object round-tripping.

Changes

Runtime Import and Alias Updates

Layer / File(s) Summary
Portable runtime import path
packages/adapter-next/src/runtime.ts
initializeHolo and CreateHoloOptions are now imported from @holo-js/core/runtime instead of @holo-js/core.
Path alias wiring
packages/adapter-next/tsconfig.json, packages/adapter-next/vitest.config.ts
Both configs add an alias mapping @holo-js/core/runtime to ../core/src/portable/index.ts so the new import resolves.

Storage Test Fixes

Layer / File(s) Summary
Stateful remote storage mock
packages/core/tests/adapter.test.ts
The fetch mock now stores PUT body text in a Map and returns it on GET, defaulting to a JSON payload when unset; the mediaStorage.getItem assertion is narrowed to { ok: true }.
S3 driver round-trip assertions
packages/storage/tests/s3Driver.test.ts
Tests now expect getItem to return plain strings and objects as originally written (not JSON-stringified), and raw JSON payloads are asserted as exact string values, using a shared in-memory map for PUT/GET behavior.

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

Possibly related PRs

  • cobraprojects/holo-js#20: Updates adapter-next to import initializeHolo from @holo-js/core/runtime, matching the relocated core API this PR depends on.

Poem

A rabbit hops through import trails,
From core to runtime, new paths it sails 🐇
Mocks now remember what they store,
Strings stay strings, objects as before,
Round-trip safe, forevermore!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: the Next adapter now points to the portable core runtime.
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.
✨ 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 plugins-system

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/storage/tests/s3Driver.test.ts (1)

289-302: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the shared fetch mock into a helper.

The PUT/GET round-trip mock implementation is duplicated verbatim between the two test cases (lines 290–302 and 335–345). Extracting a helper would keep them in sync if the mock behavior needs to evolve.

♻️ Optional helper extraction
function createStatefulFetchMock() {
  const objects = new Map<string, string>()
  const mock = async (input: string | URL | Request) => {
    const request = input instanceof Request ? input : new Request(input)
    if (request.method === 'PUT') {
      objects.set(request.url, await request.text())
      return new Response(null, { status: 200 })
    }
    return new Response(objects.get(request.url) ?? '', { status: 200 })
  }
  return { mock, objects }
}

Then in each test:

const { mock, objects } = createStatefulFetchMock()
fetchMock.mockImplementation(mock)

Also applies to: 335-345

🤖 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 `@packages/storage/tests/s3Driver.test.ts` around lines 289 - 302, The PUT/GET
stateful fetch mock is duplicated in the two S3 driver tests, so extract it into
a shared helper to keep behavior consistent. Create a reusable helper (for
example, alongside the tests) that encapsulates the Request handling and
in-memory object map, then update both test cases in s3Driver.test.ts to use
that helper instead of inlining the same mock logic. Keep the helper aligned
with the existing round-trip behavior used in the relevant test blocks.
🤖 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.

Nitpick comments:
In `@packages/storage/tests/s3Driver.test.ts`:
- Around line 289-302: The PUT/GET stateful fetch mock is duplicated in the two
S3 driver tests, so extract it into a shared helper to keep behavior consistent.
Create a reusable helper (for example, alongside the tests) that encapsulates
the Request handling and in-memory object map, then update both test cases in
s3Driver.test.ts to use that helper instead of inlining the same mock logic.
Keep the helper aligned with the existing round-trip behavior used in the
relevant test blocks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ec04c52-92b8-474e-bca6-3471e409f450

📥 Commits

Reviewing files that changed from the base of the PR and between cfcf73b and e549013.

📒 Files selected for processing (5)
  • packages/adapter-next/src/runtime.ts
  • packages/adapter-next/tsconfig.json
  • packages/adapter-next/vitest.config.ts
  • packages/core/tests/adapter.test.ts
  • packages/storage/tests/s3Driver.test.ts

@cobraprojects cobraprojects merged commit 6fa8b83 into main Jul 9, 2026
5 checks passed
@cobraprojects cobraprojects deleted the plugins-system branch July 9, 2026 01:28
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