Skip to content

refactor: add reusable extensions core plumbing#101

Open
JSRRosenbaum wants to merge 4 commits into
afar1:mainfrom
JSRRosenbaum:feat/extensions-core
Open

refactor: add reusable extensions core plumbing#101
JSRRosenbaum wants to merge 4 commits into
afar1:mainfrom
JSRRosenbaum:feat/extensions-core

Conversation

@JSRRosenbaum
Copy link
Copy Markdown

@JSRRosenbaum JSRRosenbaum commented Apr 16, 2026

Summary

  • add the source-agnostic plumbing needed for extension branches to layer HN / GitHub Stars / Reddit / Web on top of current FT
  • keep this branch limited to reusable core pieces only

What changed

  • add reusable Firefox profile and cookie discovery improvements
  • add reusable status rendering helpers
  • add reusable namespace/path helpers
  • add classify --limit support and portable Firefox config test coverage

Key commits

  • 9e0b3f5 feat: add classify limit and portable firefox config test
  • f809793 refactor: improve shared firefox profile discovery
  • e8f60b6 refactor: add reusable core status and path helpers

Verification

  • npx tsx --test tests/config.test.ts tests/engine.test.ts tests/firefox-cookies.test.ts tests/firefox-profile-detection.test.ts tests/namespace-helpers.test.ts
  • npm run build

Notes

  • this is the base branch for the multi-source extension stack
  • no HN / stars / reddit / web feature code lives here directly

@JSRRosenbaum
Copy link
Copy Markdown
Author

JSRRosenbaum commented Apr 16, 2026

Posting context for reviewers:

This PR is the base of a larger stacked multi-source FT extension series.

Please review this PR as source-agnostic core plumbing only:

  • shared Firefox profile/cookie discovery improvements
  • shared status rendering helpers
  • shared namespace/path helpers
  • classify --limit support and portable Firefox config coverage

The dependent feature layers currently live as stacked PRs in my fork because I don’t have push rights to create the intermediate base branches on upstream:

So for upstream review, this PR should be treated as the base branch for that stack.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e8f60b6. Configure here.

Comment thread src/status-render.ts
}
}

return `\n${chunks.join('\n')}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Leading newline and padding break formatBookmarkStatus output

High Severity

renderStatusSections unconditionally prepends \n to its output, and formatStatusLine pads labels to 14 characters. This changes the output of formatBookmarkStatus from starting with "Bookmarks" to starting with "\nBookmarks", and from "bookmarks: 99" to "bookmarks: 99" (extra padding). The existing test in bookmarks-service.test.ts asserts assert.match(text, /^Bookmarks/) and assert.match(text, /bookmarks: 99/), both of which will now fail. The ft status CLI output also gets an unexpected leading blank line.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e8f60b6. Configure here.

Comment thread src/firefox-cookies.ts
return {
cookieHeader: `ct0=${ct0}; auth_token=${authToken}`,
csrfToken: ct0,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cookie validation and trimming removed from Firefox path

Medium Severity

The refactored extractFirefoxXCookies no longer trims or validates cookie values against the printable-ASCII range (/^[\x21-\x7E]+$/). The Chrome path still calls sanitizeCookieValue for this purpose. Cookie values with leading/trailing whitespace or non-printable characters will now be embedded directly into the cookieHeader, potentially causing malformed HTTP headers or silent auth failures.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e8f60b6. Configure here.

@afar1
Copy link
Copy Markdown
Owner

afar1 commented Apr 20, 2026

Was dropping the ct0 validation intentional?

The old code had a validateCookie() helper that enforced printable-ASCII (/^[\x21-\x7E]+$/) and trimmed whitespace on ct0, throwing a user-facing error on garbage cookies. The new code path returns ct0 raw — no replacement. If intentional, can you note why in the PR description? If accidental, please restore before merge.

Separately: auth_token is now required (previously optional). That looks intentional given the error message, but worth calling out in the description since it's a user-facing behavior change.

Accidentally dropped validateCookie() during the auth_token required-check
refactor. Restore printable-ASCII validation and whitespace trimming for
both ct0 and auth_token before building the cookie header.

Addresses review feedback on PR afar1#101.
@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@JSRRosenbaum
Copy link
Copy Markdown
Author

Good catch on both — sorry for the delay getting back to you.

ct0 validation: Accidental drop. When I rewrote the return block to add the explicit auth_token required-check with better error messaging, I switched from cleanCt0 to raw ct0 in the return and didn't notice the validation step got lost in the process. Just pushed a fix that restores validateCookie() for both ct0 and auth_token before building the cookie header.

auth_token → required: Intentional. A partial/expired X session (ct0 present, auth_token missing) produces a confusing downstream failure if we silently skip it — the explicit error with actionable fix steps felt strictly better than the old optional behavior. I can add a note to the PR description calling this out if that helps reviewers.

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.

3 participants