Skip to content

Fix legacy forum links after .uk migration - #71

Merged
boomzero merged 2 commits into
masterfrom
fix/forum-legacy-domains
Aug 22, 2026
Merged

Fix legacy forum links after .uk migration#71
boomzero merged 2 commits into
masterfrom
fix/forum-legacy-domains

Conversation

@boomzero

@boomzero boomzero commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • rewrite both historical xmoj-bbs.tech and xmoj-bbs.me domains to xmoj-script.uk when forum posts are read
  • preserve existing subdomains such as www and assets
  • extend the existing GetPost regression test to cover both legacy domains and subdomains

Verification

  • git diff --check
  • node --check test/process.test.js
  • direct replacement assertion for root and subdomain URLs

The full npm suite could not be run locally because this checkout did not have dependencies installed; repository CI should run it.

Summary by Sourcery

Update forum reply link rewriting for the .uk domain migration while preserving legacy subdomains.

Bug Fixes:

  • Rewrite legacy xmoj-bbs.tech and xmoj-bbs.me links to xmoj-script.uk when forum replies are read.

Tests:

  • Expand GetPost regression coverage to verify both legacy domains and existing subdomains are rewritten correctly.

Summary by cubic

Rewrite legacy forum links in reply content from xmoj-bbs.tech and xmoj-bbs.me to xmoj-script.uk, preserving subdomains like www and assets. This aligns replies with the .uk migration and prevents broken links.

Review notes

  • Scope: one regex change in GetPost processing replaces xmoj-bbs.(tech|me) with xmoj-script.uk; subdomain prefixes remain intact.
  • Tests: extended GetPost test to assert rewrites for root and subdomain URLs across both legacy domains.

Written for commit b36c15f. Summary will update on new commits.

Review in cubic

@sourcery-ai

sourcery-ai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates legacy forum link rewriting so both historical xmoj-bbs.tech and xmoj-bbs.me domains are rewritten to xmoj-script.uk (including subdomains), and extends the GetPost test to cover the new behavior and multiple domains/subdomains.

Flow diagram for legacy forum link rewriting

flowchart LR
    A[GetPost reads forum replies] --> B[Process reply content]
    B --> C{Contains xmoj-bbs.tech or xmoj-bbs.me}
    C -->|yes| D[Replace domain with xmoj-script.uk]
    C -->|no| E[Keep content unchanged]
    D --> F[Return replies with preserved subdomains]
    E --> F
Loading

File-Level Changes

Change Details Files
Update reply content domain-rewrite logic to handle both legacy domains and target the new .uk domain while preserving subdomains.
  • Change the replacement regex to match both xmoj-bbs.tech and xmoj-bbs.me, including any subdomain prefix, in reply content.
  • Update the replacement target so all matched legacy domains are rewritten to xmoj-script.uk instead of xmoj-bbs.me.
Source/Process.ts
Strengthen the GetPost regression test to validate rewriting from multiple legacy domains and subdomains to the new domain.
  • Rename the GetPost domain rewrite test to reflect coverage of all legacy domains.
  • Update the test fixture reply content to include URLs for root and subdomain legacy domains (xmoj-bbs.tech, www.xmoj-bbs.me, assets.xmoj-bbs.me).
  • Adjust the expected assertion to check that all legacy URLs are rewritten to the corresponding xmoj-script.uk hostnames, preserving subdomains.
test/process.test.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="Source/Process.ts" line_range="885" />
<code_context>
         }
         let processedContent: string = ReplyItem["content"];
-        processedContent = processedContent.replace(/xmoj-bbs\.tech/g, "xmoj-bbs.me");
+        processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");
         ResponseData.Reply.push({
           ReplyID: ReplyItem["reply_id"],
</code_context>
<issue_to_address>
**issue (bug_risk):** The unbounded, case-sensitive replacement rewrites any text containing `xmoj-bbs.tech` or `xmoj-bbs.me`, including unrelated hostnames such as `xmoj-bbs.me.example.com` and uppercase forms of the domain, producing incorrect or still-invalid links.

**Triggers:** When a reply contains a hostname that merely contains a legacy domain string or uses uppercase characters.

**Suggested fix:** Match the domain as a case-insensitive hostname with URL boundary checks, so only the exact legacy host and its subdomains are rewritten.

```suggestion
        processedContent = processedContent.replace(/(^|[^\w-])xmoj-bbs\.(?:tech|me)(?![\w.-])/gi, "$1xmoj-script.uk");
```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: Source/Process.ts:885


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread Source/Process.ts
}
let processedContent: string = ReplyItem["content"];
processedContent = processedContent.replace(/xmoj-bbs\.tech/g, "xmoj-bbs.me");
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The unbounded, case-sensitive replacement rewrites any text containing xmoj-bbs.tech or xmoj-bbs.me, including unrelated hostnames such as xmoj-bbs.me.example.com and uppercase forms of the domain, producing incorrect or still-invalid links.

Triggers: When a reply contains a hostname that merely contains a legacy domain string or uses uppercase characters.

Suggested fix: Match the domain as a case-insensitive hostname with URL boundary checks, so only the exact legacy host and its subdomains are rewritten.

Suggested change
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");
processedContent = processedContent.replace(/(^|[^\w-])xmoj-bbs\.(?:tech|me)(?![\w.-])/gi, "$1xmoj-script.uk");

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b36c15f2a9

ℹ️ 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".

Comment thread Source/Process.ts
}
let processedContent: string = ReplyItem["content"];
processedContent = processedContent.replace(/xmoj-bbs\.tech/g, "xmoj-bbs.me");
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add a boundary after the legacy TLD

Because the new me alternative has no trailing domain boundary, reading a post now corrupts any content whose hostname merely starts with that text. For example, https://xmoj-bbs.media/post becomes https://xmoj-script.ukdia/post, and https://xmoj-bbs.me.evil.test/ is rewritten despite not being on the legacy domain. Restrict the match to a complete hostname suffix before replacing it.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Source/Process.ts">

<violation number="1" location="Source/Process.ts:885">
P3: The rewrite regex /xmoj-bbs\.(?:tech|me)/g has no trailing word boundary, so it matches the prefix of any token that merely begins with the legacy host text. 'xmoj-bbs.member' becomes 'xmoj-script.ukmber' and 'xmoj-bbs.meeting' becomes 'xmoj-script.uketing'. Add \b after the TLD alternation so only the full hostname is rewritten; subdomain preservation (www./assets.) is unaffected because the boundary sits after the replaced TLD.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread Source/Process.ts
}
let processedContent: string = ReplyItem["content"];
processedContent = processedContent.replace(/xmoj-bbs\.tech/g, "xmoj-bbs.me");
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The rewrite regex /xmoj-bbs.(?:tech|me)/g has no trailing word boundary, so it matches the prefix of any token that merely begins with the legacy host text. 'xmoj-bbs.member' becomes 'xmoj-script.ukmber' and 'xmoj-bbs.meeting' becomes 'xmoj-script.uketing'. Add \b after the TLD alternation so only the full hostname is rewritten; subdomain preservation (www./assets.) is unaffected because the boundary sits after the replaced TLD.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Source/Process.ts, line 885:

<comment>The rewrite regex /xmoj-bbs\.(?:tech|me)/g has no trailing word boundary, so it matches the prefix of any token that merely begins with the legacy host text. 'xmoj-bbs.member' becomes 'xmoj-script.ukmber' and 'xmoj-bbs.meeting' becomes 'xmoj-script.uketing'. Add \b after the TLD alternation so only the full hostname is rewritten; subdomain preservation (www./assets.) is unaffected because the boundary sits after the replaced TLD.</comment>

<file context>
@@ -882,7 +882,7 @@ export class Process {
         }
         let processedContent: string = ReplyItem["content"];
-        processedContent = processedContent.replace(/xmoj-bbs\.tech/g, "xmoj-bbs.me");
+        processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");
         ResponseData.Reply.push({
           ReplyID: ReplyItem["reply_id"],
</file context>
Suggested change
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)/g, "xmoj-script.uk");
processedContent = processedContent.replace(/xmoj-bbs\.(?:tech|me)\b/g, "xmoj-script.uk");

@boomzero
boomzero merged commit 5b20460 into master Aug 22, 2026
7 checks passed
@boomzero
boomzero deleted the fix/forum-legacy-domains branch August 22, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant