Skip to content

Simplified conditionals in author serialization - #30363

Merged
EvanHahn merged 1 commit into
mainfrom
simplify-conditionals-in-model-author-relations
Aug 28, 2026
Merged

Simplified conditionals in author serialization#30363
EvanHahn merged 1 commit into
mainfrom
simplify-conditionals-in-model-author-relations

Conversation

@EvanHahn

Copy link
Copy Markdown
Contributor

no ref

We were doing some redundant checks here. Let's remove them.

no ref

We were doing some redundant checks here. Let's remove them.
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: ab18cf13-39df-486b-9c3b-6d0e6c403048

📥 Commits

Reviewing files that changed from the base of the PR and between 21e5c1e and 994d5e3.

📒 Files selected for processing (1)
  • ghost/core/core/server/models/relations/authors.js

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Lint
  • GitHub Check: Stripe fixture checks
  • GitHub Check: Build Docker Images
  • GitHub Check: Build Admin
  • GitHub Check: Unit tests (Node 22.23.1)
  • GitHub Check: Acceptance tests (Node 22.23.1, mysql8)
  • GitHub Check: Check migration integrity
  • GitHub Check: Legacy tests (Node 22.23.1, mysql8)
  • GitHub Check: i18n
  • GitHub Check: Check app version bump
  • GitHub Check: Build E2E Public App Assets
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (4)
New source files must be TypeScript: flag new JS files as a required change

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/models/relations/authors.js
Prioritise concrete correctness, security, data-integrity, compatibility,

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/models/relations/authors.js
New files are TypeScript: Fail if the PR adds a new .js/.jsx/.cjs/.mjs source file, unless it is: a DB

📄 CodeRabbit inference engine (Custom checks)

Files:

  • ghost/core/core/server/models/relations/authors.js
Always use `pnpm`, never npm or Yarn.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • ghost/core/core/server/models/relations/authors.js
🔇 Additional comments (1)
ghost/core/core/server/models/relations/authors.js (1)

152-159: LGTM!


Walkthrough

The author relation serialize method now checks withRelated through the initialized options object. The primary_author column condition no longer performs a redundant truthiness check for options.columns. Other serialization behavior remains unchanged.

Suggested reviewers: 9larsons, acburdine

Merge Risk: ⚪ Minimal · up to 994d5

This is a localized simplification with no actionable merge-blocking risk remaining beyond normal checks and review.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: simplifying conditionals in author serialization.
Description check ✅ Passed The description explains that redundant checks were removed, which matches the changeset.
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.
Type-Safe Boundaries ✅ Passed PASS. The PR changes only two conditional expressions in the pre-existing JavaScript file ghost/core/core/server/models/relations/authors.js. It removes a redundant _originalOptions check after in…
New Files Are Typescript ✅ Passed PASS. The pull request changes only ghost/core/core/server/models/relations/authors.js. Git confirms that this .js file existed in the parent revision, so the pull request modifies a pre-existing …
Full details: Type-Safe Boundaries

Explanation

PASS. The PR changes only two conditional expressions in the pre-existing JavaScript file ghost/core/core/server/models/relations/authors.js. It removes a redundant _originalOptions check after initializing that value and removes a redundant truthiness check for options.columns. The patch adds no boundary read, Zod schema, type declaration, any, unchecked as, @ts-nocheck, or @ts-ignore. The custom check excludes incidental changes to pre-existing JavaScript files.

Full details: New Files Are Typescript

Explanation

PASS. The pull request changes only ghost/core/core/server/models/relations/authors.js. Git confirms that this .js file existed in the parent revision, so the pull request modifies a pre-existing JavaScript file and does not add a new source file.

✨ 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 simplify-conditionals-in-model-author-relations

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

@nx-cloud

nx-cloud Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 994d5e3

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 4m 44s View ↗
nx run ghost:test:legacy ✅ Succeeded 3m 7s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 25s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 36s View ↗
nx run-many -t lint -p ghost,ghost-monorepo ✅ Succeeded 26s View ↗
nx run @tryghost/admin:build ✅ Succeeded 7s View ↗
nx run @tryghost/e2e:test:fixtures ✅ Succeeded <1s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-28 14:34:49 UTC

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.99%. Comparing base (21e5c1e) to head (994d5e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #30363      +/-   ##
==========================================
- Coverage   75.99%   75.99%   -0.01%     
==========================================
  Files        1676     1676              
  Lines      159975   159971       -4     
  Branches    19574    19571       -3     
==========================================
- Hits       121572   121567       -5     
- Misses      37382    37414      +32     
+ Partials     1021      990      -31     
Flag Coverage Δ
e2e-tests 77.65% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EvanHahn
EvanHahn merged commit dfd7173 into main Aug 28, 2026
53 checks passed
@EvanHahn
EvanHahn deleted the simplify-conditionals-in-model-author-relations branch August 28, 2026 14:38
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