Skip to content

fix(school): preserve lesson discussions across course renames - #356

Merged
olliethedev merged 4 commits into
mainfrom
fix/school-discussions-course-rename
Nov 6, 2026
Merged

olliethedev merged 4 commits into
mainfrom
fix/school-discussions-course-rename

Conversation

@olliethedev

@olliethedev olliethedev commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Course address edits currently split generated lesson discussions and leave My comments links pointing at the old address. This focused follow-up to #354 keeps discussion identity stable:

- <courseSlug>/lessons/<lessonId>
+ <encodedCourseId>/lessons/<encodedLessonId>

Generated return links use /learn/~<courseId>/lessons/<lessonId> to distinguish IDs from colliding course slugs. Published course lookup accepts an explicit ~<id> and a bare stable ID as a fallback to current-slug lookup, under the existing permission and publication checks. Draft, archived and missing courses return 404. Pathname hooks are generated only for Kanban, which still needs its board context.

Evidence

  • Before: saved regression evidence reproduces a missing question after a course rename, and public course-ID lookup returns 404.
    After: recovered regression coverage posts a question, renames the course, reloads its new address and follows My comments back to the same discussion. API tests cover published IDs, current/obsolete slugs and unpublished denial; scaffold tests cover encoded stable IDs across all frameworks and standalone helper generation.
  • Recovered on current main; retained the newly merged CMS history test when resolving the cherry-pick conflict. Static security and standards reviews passed. Fresh checks passed: 19 School API/slot tests, 174 scaffold tests, School/CLI/generated Next.js typechecks, School-plus-Comments helper compilation with noUnusedLocals for all three frameworks, generated Next.js and docs production builds, changed-file Biome and registry regeneration (no generated diff). An additional collision regression failed before the explicit-ID fix and passed afterward. 2 Chromium regressions passed against the production build (School rename/return and Kanban task return), with fresh trace/video artifacts. The first browser attempt had a stale local API origin; correcting the owned server environment made both pass without source changes. The three committed E2E overlays now match the generated links; their contract check failed before alignment and passes afterward. Full local suite and React Router/TanStack browser runs are left to CI.
  • Existing screenshots and captioned demos and rename regression recording are retained from the saved correction. These retained recordings precede the explicit ~ return-link marker; fresh browser traces/video verify that final link. They require the owner's archive login and LAN or private Tailscale access.

Merge Danger

Door: two-way

No schema or dependency changes. This correction does not migrate stored slug-based comment resource IDs. Adopters with existing generated discussions need an application-owned resource-ID migration before switching conventions; manually configured plain IDs remain application-owned. That limit is acceptable for this focused follow-up because it corrects new scaffolds without silently rewriting stored comments. Header-free raw SSG prefetch remains current-slug based; authorized runtime/HTTP course lookup supports stable IDs.

Existing shared School page routing requires course/lesson IDs that fit a single decoded URL segment (no /). URI encoding keeps stored resource identity unambiguous, but slash-containing IDs still require custom return routing. This pre-existing framework routing limit is now explicit in both documentation pages; this focused correction does not change shared routing.

Blast Radius: integrations

Generated School discussion helpers and public published-course lookup. School, Comments and other optional integrations remain independently usable.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
better-stack-docs Ready Ready Preview Nov 6, 2026 11:00am UTC
better-stack-playground Ready Ready Preview Nov 6, 2026 11:00am UTC

Request Review

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T11:02:39.189007Z b776a7e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 6fe81fcdf7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: b776a7e605

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Bundle size

3 of 194 bundles changed.

Module Gzip base → PR Gzip change Minified change
@btst/plugin-school/api 106747 → 106779 B +32 B (+0.0%) +96 B (+0.0%)
@btst/codegen 1637191 → 1637194 B +3 B (+0.0%) +1 B (+0.0%)
@btst/codegen/lib 51058 → 51061 B +3 B (+0.0%) +1 B (+0.0%)

ad53b4c → b776a7e. Standalone costs; rows overlap. Moved paths appear as new/removed entries, not application savings.

Measured 22 packed archives separately; full report includes their compressed bytes without installed dependencies.

Full report and measurements

@olliethedev
olliethedev merged commit bbe250a into main Nov 6, 2026
111 of 112 checks passed

This branch was successfully deployed

2 active deployments
Preview – better-stack-docs — b776a7e6 Deployed Nov 6, 2026 by vercel[bot]
Preview – better-stack-playground — b776a7e6 Deployed Nov 6, 2026 by vercel[bot]
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