Skip to content

[8053] Remove deprecated getDescriptor API and update APIs in the js-sdk - #163

Open
jvega190 wants to merge 5 commits into
craftercms:developfrom
jvega190:enhancement/8053
Open

[8053] Remove deprecated getDescriptor API and update APIs in the js-sdk#163
jvega190 wants to merge 5 commits into
craftercms:developfrom
jvega190:enhancement/8053

Conversation

@jvega190

@jvega190 jvega190 commented Jun 30, 2026

Copy link
Copy Markdown
Member

craftersoftware/craftercms#8053

Summary by CodeRabbit

  • New Features
    • Added a flatten option for content retrieval and configuration, enabling flattened results from item/tree/children requests.
  • Bug Fixes
    • Updated item-loading and Redux state handling to consistently key loading by the requested item URL.
  • Breaking Changes
    • Removed the “Get Descriptor” API surface from the content store and Redux descriptor actions; use item-based retrieval instead.
    • Updated item fetch action payload to accept { url, config }.
  • Documentation
    • Refreshed content service documentation to reflect item-based APIs and flatten.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jvega190, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c428fb3-6e05-4230-8e5f-b1e25a5c7e8d

📥 Commits

Reviewing files that changed from the base of the PR and between 23bf0bb and a2c989f.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • packages/content/test/index.spec.ts
  • packages/redux/README.md
  • packages/redux/test/index.spec.ts

Walkthrough

Removes the getDescriptor API from content and redux, adds flatten to CrafterConfig and content-store requests, changes redux getItem to accept { url, config? }, updates related tests and docs, and bumps release metadata.

Changes

v5.0.0 API Cleanup

Layer / File(s) Summary
CrafterConfig flatten field
packages/models/src/CrafterConfig.ts, packages/classes/src/config.ts
Adds flatten: boolean to CrafterConfig and sets flatten: false in DEFAULTS.
ContentStoreService and model fetching
packages/content/src/ContentStoreService.ts, packages/content/src/utils.ts, packages/content/test/index.spec.ts, packages/content/README.md
Passes flatten through content-store requests, removes getDescriptor from the exported service, switches model fetching to getItem, and removes descriptor docs and tests.
Redux content flow and search action
packages/redux/src/actions/content.ts, packages/redux/src/epics/content.ts, packages/redux/src/reducers/content.ts, packages/redux/src/reducers/reducers.ts, packages/redux/src/actions/search.ts
Changes getItem payload shape, removes descriptor actions and wiring, updates reducer keys, and changes the search action type string.
Tests, changelog, and package releases
packages/redux/test/index.spec.ts, CHANGELOG.md, packages/*/package.json
Removes descriptor-related redux tests, adds the 5.0.0 changelog entry, and updates package versions and dependency versions for the release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

  • craftercms/js-sdk#158: Introduces the flatten plumbing and deprecated descriptor-flow cleanup that this PR completes.
  • craftercms/js-sdk#159: Overlaps on ContentStoreService, utils.ts, and CrafterConfig changes for flatten and getDescriptor migration.
  • craftercms/js-sdk#160: Touches the same packages/content/README.md descriptor documentation.

Suggested reviewers: sumerjabri, rart

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only links the issue and omits the required heading and any summary of the PR contents. Add the template heading and a brief summary of the ticket, affected packages/APIs, and key behavior changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: removing the deprecated getDescriptor API and updating related JS SDK APIs.
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 unit tests (beta)
  • Create PR with unit tests

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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/content/README.md (1)

148-220: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider documenting the flatten option in service signatures.

getItem and getChildren now pass flatten as a query parameter derived from CrafterConfig. The README currently documents these as getItem(path: string, config?: CrafterConfig) without mentioning that config.flatten affects the response shape. Consider adding a note that flatten controls whether linked content items are recursively included.

Add to the `getItem` and `getChildren` parameter tables or description:
- `config.flatten` — boolean, controls whether to recursively include linked content items in the response.
🤖 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/content/README.md` around lines 148 - 220, The `getItem` and
`getChildren` docs do not mention the new `config.flatten` behavior, so update
the README entries for these service signatures to document that
`CrafterConfig.flatten` controls whether linked content items are recursively
included in the response. Add this note near the parameter tables or example
descriptions for `getItem(path, config?)` and `getChildren(path, config?)` so
readers can find it alongside the existing `CrafterConfig` reference.
packages/content/src/ContentStoreService.ts (1)

35-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the stale GetDescriptorConfig export.

getDescriptor is gone and CrafterConfig already owns flatten, so keeping this public type leaves deprecated descriptor API surface behind.

Proposed cleanup
-export interface GetDescriptorConfig extends CrafterConfig {
-  flatten: boolean;
-}
-
🤖 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/content/src/ContentStoreService.ts` around lines 35 - 37, Remove the
stale public GetDescriptorConfig export from ContentStoreService since
getDescriptor is no longer used and CrafterConfig already provides flatten.
Update any references in the ContentStoreService module and related exports so
the deprecated descriptor-specific API surface is eliminated while keeping the
remaining CrafterConfig-based types intact.
🤖 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 `@packages/content/src/utils.ts`:
- Around line 219-220: The `getItem` calls in `parseDescriptor` (and the
matching path also used around the later `getItem`/`map` flow) are allowing
`options.flatten === false` to override the required flattening behavior. Update
the option merge so `options` are spread first and `flatten: true` is enforced
last, keeping the new `getItem`-based parsing path working consistently.

In `@packages/redux/src/actions/search.ts`:
- Line 22: The search action type string in search should be corrected from the
misspelled constant to the properly spelled CRAFTERCMS_SEARCH, matching the
existing SEARCH_COMPLETE naming and avoiding consumer mismatches; update the
createAction<Query> call in search to use the corrected string while keeping the
surrounding action definitions unchanged.

---

Nitpick comments:
In `@packages/content/README.md`:
- Around line 148-220: The `getItem` and `getChildren` docs do not mention the
new `config.flatten` behavior, so update the README entries for these service
signatures to document that `CrafterConfig.flatten` controls whether linked
content items are recursively included in the response. Add this note near the
parameter tables or example descriptions for `getItem(path, config?)` and
`getChildren(path, config?)` so readers can find it alongside the existing
`CrafterConfig` reference.

In `@packages/content/src/ContentStoreService.ts`:
- Around line 35-37: Remove the stale public GetDescriptorConfig export from
ContentStoreService since getDescriptor is no longer used and CrafterConfig
already provides flatten. Update any references in the ContentStoreService
module and related exports so the deprecated descriptor-specific API surface is
eliminated while keeping the remaining CrafterConfig-based types intact.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e4632dff-929e-4865-8c9e-41f34d72dc7c

📥 Commits

Reviewing files that changed from the base of the PR and between 6527bd4 and 373a2f6.

📒 Files selected for processing (13)
  • CHANGELOG.md
  • packages/classes/src/config.ts
  • packages/content/README.md
  • packages/content/src/ContentStoreService.ts
  • packages/content/src/utils.ts
  • packages/content/test/index.spec.ts
  • packages/models/src/CrafterConfig.ts
  • packages/redux/src/actions/content.ts
  • packages/redux/src/actions/search.ts
  • packages/redux/src/epics/content.ts
  • packages/redux/src/reducers/content.ts
  • packages/redux/src/reducers/reducers.ts
  • packages/redux/test/index.spec.ts
💤 Files with no reviewable changes (3)
  • packages/redux/src/reducers/reducers.ts
  • packages/content/test/index.spec.ts
  • packages/redux/test/index.spec.ts

Comment thread packages/content/src/utils.ts
Comment thread packages/redux/src/actions/search.ts Outdated

@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.

Actionable comments posted: 2

🤖 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 `@packages/classes/package.json`:
- Line 3: The package version is out of sync with the changelog release header.
Update the version in package.json for the classes package, or adjust the
CHANGELOG.md header for `@craftercms/classes` so both reflect the same release
version; use the package metadata and changelog entry together to keep the
published package and release notes aligned.

In `@packages/redux/package.json`:
- Line 3: Remove the outdated getDescriptor documentation from the Redux README
so the published docs match the 5.0.0 API. Update packages/redux/README.md to
delete the action creator section, signature, and example that reference
getDescriptor, and make sure any surrounding navigation or headings still read
correctly after the removal.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 48e1f6b3-b4bb-442a-b8dd-79d2f79bbc2e

📥 Commits

Reviewing files that changed from the base of the PR and between 373a2f6 and 23bf0bb.

📒 Files selected for processing (8)
  • packages/classes/package.json
  • packages/content/package.json
  • packages/ice/package.json
  • packages/models/package.json
  • packages/redux/package.json
  • packages/redux/src/actions/search.ts
  • packages/search/package.json
  • packages/utils/package.json
✅ Files skipped from review due to trivial changes (3)
  • packages/models/package.json
  • packages/ice/package.json
  • packages/utils/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/redux/src/actions/search.ts

Comment thread packages/classes/package.json
Comment thread packages/redux/package.json
…ated getDescriptor API from README, and clean up related test imports.
@jvega190

jvega190 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="craftercms/js-sdk"
pr="163"

echo "== PR summary =="
gh pr view "$pr" --repo "$repo" --json number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,author,url \
  --jq '{number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,author: .author.login,url}'

echo
echo "== Reviews =="
gh pr view "$pr" --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state, submittedAt}'

echo
echo "== Review threads (unresolved first) =="
gh api graphql \
  -F owner="craftercms" \
  -F name="js-sdk" \
  -F number="$pr" \
  -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
          comments(first: 20) {
            nodes {
              author { login }
              body
              createdAt
            }
          }
        }
      }
    }
  }
}' --jq '
.data.repository.pullRequest.reviewThreads.nodes
| sort_by(.isResolved, .path, .line)
| .[]
| {
    isResolved,
    isOutdated,
    path,
    line,
    comments: [.comments.nodes[] | {author: .author.login, body: (.body | gsub("\n"; " ") | .[0:220]), createdAt}]
  }'

echo
echo "== Changed files =="
gh pr view "$pr" --repo "$repo" --json files --jq '.files[] | {path, additions, deletions}'

Length of output: 5952


@jvega190 I took a final pass over #163 and it looks good from my side.

What I checked:

  • all CodeRabbit review threads are resolved
  • the earlier flatten concern in packages/content/src/utils.ts was withdrawn based on your clarification
  • the action-type typo comment is now outdated/resolved
  • I don’t see any remaining blockers in the current diff relative to the PR goal of removing the deprecated getDescriptor API and updating the related docs/redux flow

One note: GitHub still shows REVIEW_REQUIRED / BLOCKED, but that’s because the PR is still in Draft and hasn’t gone through final human approval yet, not because I see an unresolved CodeRabbit issue.

So yes — this looks ready to hand over for human review.

✅ Action performed

Review finished.

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.

@jvega190

jvega190 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="craftercms/js-sdk"
pr="163"

echo "== PR summary =="
gh pr view "$pr" --repo "$repo" --json number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,author,url,updatedAt \
  --jq '{number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,author: .author.login,url,updatedAt}'

echo
echo "== Latest commits =="
gh pr view "$pr" --repo "$repo" --json commits --jq '.commits[-5:] | .[] | {oid: .oid[0:7], messageHeadline}'

echo
echo "== Review threads (unresolved first) =="
gh api graphql \
  -F owner="craftercms" \
  -F name="js-sdk" \
  -F number="$pr" \
  -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
          comments(first: 20) {
            nodes {
              author { login }
              body
              createdAt
            }
          }
        }
      }
    }
  }
}' --jq '
.data.repository.pullRequest.reviewThreads.nodes
| sort_by(.isResolved, .path, .line)
| .[]
| {
    isResolved,
    isOutdated,
    path,
    line,
    comments: [.comments.nodes[] | {author: .author.login, body: (.body | gsub("\n"; " ") | .[0:220]), createdAt}]
  }'

echo
echo "== Changed files =="
gh pr view "$pr" --repo "$repo" --json files --jq '.files[] | {path, additions, deletions}'

Length of output: 6096


@jvega190 Checked again — all existing CodeRabbit review threads remain resolved (the version bump questions, the flatten intent clarification, and the typo fix are all closed out).

One thing worth flagging: since the last review, a new commit (373a2f6 – "[8053] Remove deprecated getDescriptor API and update APIs in the js-sdk") was pushed that touches additional files not covered by my earlier pass, notably:

  • packages/redux/README.md (-21 lines)
  • packages/content/test/index.spec.ts (+6/-25)
  • packages/redux/test/index.spec.ts (+10/-108)

These weren't part of the diff I last reviewed, so I haven't verified them yet. I'd recommend triggering a fresh full review to make sure this latest commit is covered before you hand off to human review. I'll kick that off now.

The PR still shows REVIEW_REQUIRED/BLOCKED on GitHub, but that's just due to Draft status and pending human approval — not an outstanding CodeRabbit issue.

✅ Action performed

Full review finished.

@jvega190

jvega190 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@CodeRabbit can you do a fresh full review?

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

@jvega190 Sure — kicking off a fresh full review of #163 now to cover the latest commit, including the changes to packages/redux/README.md, packages/content/test/index.spec.ts, and packages/redux/test/index.spec.ts.

✅ Action performed

Full review finished.

@jvega190

jvega190 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="craftercms/js-sdk"
pr="163"

echo "== PR summary =="
gh pr view "$pr" --repo "$repo" --json number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,updatedAt \
  --jq '{number,title,state,isDraft,reviewDecision,mergeStateStatus,headRefName,baseRefName,updatedAt}'

echo
echo "== Latest commits =="
gh pr view "$pr" --repo "$repo" --json commits --jq '.commits[-5:] | .[] | {oid: .oid[0:7], messageHeadline}'

echo
echo "== Review threads (unresolved first) =="
gh api graphql \
  -F owner="craftercms" \
  -F name="js-sdk" \
  -F number="$pr" \
  -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
          comments(first: 20) {
            nodes {
              author { login }
              body
              createdAt
            }
          }
        }
      }
    }
  }
}' --jq '
.data.repository.pullRequest.reviewThreads.nodes
| sort_by(.isResolved, .path, .line)
| .[]
| {
    isResolved,
    isOutdated,
    path,
    line,
    comments: [.comments.nodes[] | {author: .author.login, body: (.body | gsub("\n"; " ") | .[0:220]), createdAt}]
  }'

echo
echo "== Changed files =="
gh pr view "$pr" --repo "$repo" --json files --jq '.files[] | {path, additions, deletions}'

Length of output: 5985


@jvega190 Re-checked #163 — everything still looks good on my end.

  • All 4 CodeRabbit review threads are resolved, including the flatten intent clarification and the action-type typo fix (now outdated/resolved, confirming the fix landed).
  • The latest commit (373a2f6) was already covered by the full review you triggered earlier, and no new threads have appeared since.
  • No outstanding blockers from my side.

The PR still shows REVIEW_REQUIRED/BLOCKED on GitHub, but that's solely due to Draft status and pending human approval — not an unresolved CodeRabbit concern.

This is ready to hand over for human review. 🐇✅

@jvega190
jvega190 marked this pull request as ready for review July 6, 2026 16:50
@jvega190
jvega190 requested review from rart and sumerjabri as code owners July 6, 2026 16:50
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