Skip to content

Handle NULL post slugs from the new app - #48

Open
spathon wants to merge 3 commits into
masterfrom
handle-null-post-slugs
Open

Handle NULL post slugs from the new app#48
spathon wants to merge 3 commits into
masterfrom
handle-null-post-slugs

Conversation

@spathon

@spathon spathon commented Aug 3, 2026

Copy link
Copy Markdown
Member

The new app creates drafts with slug NULL until publish (posts.slug is being made nullable). Model allowNull, GraphQL Post.slug nullable, and editPost generates a slug when publishing a slug-less draft.

ALTER TABLE posts MODIFY `slug` varchar(255)
  CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL, ALGORITHM=COPY;

Summary by CodeRabbit

  • Bug Fixes
    • Draft posts now receive a URL slug when they are published, ensuring published content can be accessed through its expected URL.

The new app creates drafts with slug NULL until publish (posts.slug is
being made nullable). Model allowNull, GraphQL Post.slug nullable, and
editPost generates a slug when publishing a slug-less draft.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4196d53b-d8ed-418e-9d0b-40a5f1dabad3

📥 Commits

Reviewing files that changed from the base of the PR and between dac0659 and e8b86e8.

📒 Files selected for processing (2)
  • models/posts.js
  • routes/graphql/mutations/posts.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Post slug lifecycle

Layer / File(s) Summary
Nullable slug and publish-time generation
models/posts.js, routes/graphql/mutations/posts.js
The model documents that draft posts may have null slugs. editPost generates and assigns a slug when a slugless post becomes published.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to e8b86

Draft posts may now omit slugs until publication, when publishing generates one. No concrete merge-blocking risk remains in the supplied current-head evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: handling NULL post slugs introduced by the new app, including draft publication behavior.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch handle-null-post-slugs

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: 1

🤖 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 `@routes/graphql/mutations/posts.js`:
- Around line 45-46: Make publish-time slug assignment in the mutation’s
generateSlug flow collision-safe: reserve suffix space before truncating a
200-character base slug, and ensure concurrent publishes atomically allocate
unique slugs or retry after a unique-constraint save conflict. Preserve the
existing published-only behavior, and add coverage for concurrent same-title
publishes and collisions involving 200-character slugs.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9db16f41-3c5c-423e-9acf-6771f5689bce

📥 Commits

Reviewing files that changed from the base of the PR and between 957c4c4 and dac0659.

📒 Files selected for processing (3)
  • models/posts.js
  • routes/graphql/mutations/posts.js
  • routes/graphql/typeDefs/types.graphql

Comment thread routes/graphql/mutations/posts.js Outdated
spathon added 2 commits August 3, 2026 22:22
# Conflicts:
#	models/posts.js
#	routes/graphql/mutations/posts.js
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