Skip to content

Add first-run domain scope onboarding#10

Merged
LukeSteward merged 3 commits into
LukeSteward:mainfrom
TJBK:main
May 15, 2026
Merged

Add first-run domain scope onboarding#10
LukeSteward merged 3 commits into
LukeSteward:mainfrom
TJBK:main

Conversation

@TJBK
Copy link
Copy Markdown
Contributor

@TJBK TJBK commented May 15, 2026

Summary

Add a one-time first-run welcome screen explaining why JayQuery checks the root domain by default.

Changes

  • Let users choose root domain or exact tab hostname when they differ.
  • Hide redundant tab-hostname actions when both scopes are the same.
  • Normalize trailing-dot hostnames before comparing scope targets.

Refs #3

Summary by CodeRabbit

  • New Features

    • First-run welcome screen with guidance and action buttons to start DNS checks (includes UI styling).
  • Improvements

    • DNS scope chip now conditionally shows the exact/tab hostname for clearer results.
    • Hostname normalization now strips trailing dots for more accurate checks.
    • Welcome dismissal is persisted so the screen won't reappear after first use.
  • Tests

    • Added coverage for hostname normalization edge cases.

Review Change Stack

Explain why JayQuery checks the root domain by default before running the first popup check. The welcome screen lets users choose root domain or, when different, the exact tab hostname.

Also keep the scope switch compact by hiding redundant tab-hostname actions and normalising trailing-dot hostnames before comparing targets.

Refs LukeSteward#3
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bdfc58c3-36c4-4f31-af2f-670682fa5a34

📥 Commits

Reviewing files that changed from the base of the PR and between 6b5afc2 and c21665d.

📒 Files selected for processing (3)
  • entrypoints/popup/main.ts
  • entrypoints/popup/style.css
  • lib/checkDomain.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/checkDomain.ts
  • entrypoints/popup/style.css

📝 Walkthrough

Walkthrough

Adds a first-run welcome screen to the popup UI, persists a welcome-seen flag in settings, normalizes trailing dots in hostname resolution, and refactors mode-chip rendering to conditionally display the exact host chip.

Changes

First-run welcome and mode-chip display

Layer / File(s) Summary
Settings persistence for first-run flag
lib/settings.ts
Extends ExtensionSettings type with firstRunWelcomeSeen: boolean, adds it to DEFAULT_SETTINGS as false, and updates loadSettings() to read, type-check, and default this flag.
Hostname trailing-dot normalization
lib/checkDomain.ts, lib/checkDomain.test.ts
resolveCheckTargets now strips trailing dots from the normalized hostname; test verifies both tab and queryHost reflect the dot-stripped value in apex mode.
Mode-chip conditional exact-mode display
entrypoints/popup/main.ts
Updates currentView to include 'welcome'; modeChips now accepts showExact and conditionally renders the "Tab hostname" chip when the query host differs from the apex/root target.
Welcome view rendering and styling
entrypoints/popup/main.ts, entrypoints/popup/style.css
Adds renderWelcome, computes showExact in renderLoading, and introduces CSS for the welcome container, text, action buttons, and interactions.
Welcome dismissal and action wiring
entrypoints/popup/main.ts
Adds dismissWelcomeAndRun(mode) to mark the welcome as seen, persist settings (errors ignored/logged), switch to main view, and run the chosen check; bindWelcomeActions() wires the buttons.
Main flow integration and showExact propagation
entrypoints/popup/main.ts
main() shows the welcome on first run; renderLoading and renderResult compute and pass showExact to modeChips, removing the earlier tabDiffers header hint.

🐰 A welcome greeting, fresh and true,
For first-time visitors, a helpful view,
Trailing dots trimmed with care,
Mode chips now show what's there,
Settings persist as users break through! ✨

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. 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 'Add first-run domain scope onboarding' accurately summarizes the main change—introducing a welcome screen for first-run users to select DNS check scope (root domain vs. exact hostname).
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
entrypoints/popup/style.css (1)

652-655: ⚡ Quick win

Use a CSS variable instead of the hardcoded color.

Line 654 uses the hardcoded color #222936 for the hover background, which is inconsistent with the rest of the stylesheet that primarily uses CSS variables like var(--surface), var(--surface2), etc. Consider using an existing variable or defining a new one if this shade is needed.

♻️ Suggested fix
 .welcome__btn:hover {
   border-color: rgba(91, 140, 255, 0.45);
-  background: `#222936`;
+  background: var(--surface);
 }

Alternatively, if a slightly lighter shade than --surface is required, consider defining it as a CSS variable for maintainability.

🤖 Prompt for 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.

In `@entrypoints/popup/style.css` around lines 652 - 655, Replace the hardcoded
hover background color on .welcome__btn:hover (currently `#222936`) with a CSS
variable; either use an existing variable such as var(--surface) or add a new
variable (e.g., --surface-hover) to the root and reference that in
.welcome__btn:hover to keep styling consistent and maintainable.
lib/checkDomain.ts (2)

102-102: 💤 Low value

Optional: The g flag in the regex is redundant.

Since the $ anchor ensures the pattern only matches at the end of the string, the global g flag has no effect. The regex can be simplified to /\.+$/ for clarity.

♻️ Simplified regex
-  const tab = tabHostname.trim().toLowerCase().replace(/\.+$/g, '');
+  const tab = tabHostname.trim().toLowerCase().replace(/\.+$/, '');
🤖 Prompt for 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.

In `@lib/checkDomain.ts` at line 102, The replacement regex uses an unnecessary
global flag; update the call that trims trailing dots from tabHostname (the line
assigning const tab) to use replace(/\.+$/, '') instead of replace(/\.+$/g, '')
so the pattern remains anchored to the end without the redundant 'g' flag; keep
the surrounding trim().toLowerCase() chain intact and ensure the variable name
'tab' and its assignment (const tab = ...) are unchanged except for the regex.

102-102: Remove redundant trailing-dot preprocessing; tldts already handles this internally.

The .replace(/\.+$/g, '') is unnecessary. tldts's getDomain function is designed to handle trailing dots automatically—it returns the expected domain regardless of whether the input has a trailing dot. The preprocessing can be safely removed:

const tab = tabHostname.trim().toLowerCase();
const orgDomain = getDomain(tab, { detectIp: false }) ?? tab;
🤖 Prompt for 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.

In `@lib/checkDomain.ts` at line 102, The trailing-dot stripping on tabHostname is
redundant; remove the .replace(/\.+$/g, '') call and normalize with
trim().toLowerCase(), then pass the resulting tab into getDomain (use
getDomain(tab, { detectIp: false }) ?? tab) so tldts handles trailing dots and
you still fall back to the original host when getDomain returns null; update the
code that sets the tab variable and any subsequent use of orgDomain to use this
cleaned tab value.
🤖 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 `@entrypoints/popup/main.ts`:
- Around line 720-725: The code in dismissWelcomeAndRun currently awaits
saveSettings(settings) so a failure aborts the function and prevents
runCheck(mode) from running; wrap the persistence call in a try/catch (or
otherwise avoid awaiting it) so failures don't block progress: inside
dismissWelcomeAndRun, set settings.firstRunWelcomeSeen, then try { await
saveSettings(settings); } catch (err) { /* log or ignore */ } and afterwards set
currentView = 'main' and await runCheck(mode) so the DNS check always runs even
if saveSettings throws. Ensure you reference the dismissWelcomeAndRun function,
the saveSettings(settings) call, and the runCheck(mode) invocation when making
the change.

---

Nitpick comments:
In `@entrypoints/popup/style.css`:
- Around line 652-655: Replace the hardcoded hover background color on
.welcome__btn:hover (currently `#222936`) with a CSS variable; either use an
existing variable such as var(--surface) or add a new variable (e.g.,
--surface-hover) to the root and reference that in .welcome__btn:hover to keep
styling consistent and maintainable.

In `@lib/checkDomain.ts`:
- Line 102: The replacement regex uses an unnecessary global flag; update the
call that trims trailing dots from tabHostname (the line assigning const tab) to
use replace(/\.+$/, '') instead of replace(/\.+$/g, '') so the pattern remains
anchored to the end without the redundant 'g' flag; keep the surrounding
trim().toLowerCase() chain intact and ensure the variable name 'tab' and its
assignment (const tab = ...) are unchanged except for the regex.
- Line 102: The trailing-dot stripping on tabHostname is redundant; remove the
.replace(/\.+$/g, '') call and normalize with trim().toLowerCase(), then pass
the resulting tab into getDomain (use getDomain(tab, { detectIp: false }) ??
tab) so tldts handles trailing dots and you still fall back to the original host
when getDomain returns null; update the code that sets the tab variable and any
subsequent use of orgDomain to use this cleaned tab value.
🪄 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: 1b9cc542-a672-4044-b574-38044f1fa051

📥 Commits

Reviewing files that changed from the base of the PR and between 646ecba and d509098.

📒 Files selected for processing (5)
  • entrypoints/popup/main.ts
  • entrypoints/popup/style.css
  • lib/checkDomain.test.ts
  • lib/checkDomain.ts
  • lib/settings.ts

Comment thread entrypoints/popup/main.ts
TJBK and others added 2 commits May 15, 2026 18:48
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Keep first-run persistence failures from blocking the DNS check, use an existing surface variable for welcome button hover state, and remove the redundant global flag from trailing-dot normalization.

Refs LukeSteward#3
@LukeSteward
Copy link
Copy Markdown
Owner

Absolute Hero, thanks for this, i'll trigger a version change after this, so it will publish these changes!

@LukeSteward LukeSteward merged commit 22e9caa into LukeSteward:main May 15, 2026
3 checks passed
@LukeSteward LukeSteward linked an issue May 15, 2026 that may be closed by this pull request
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.

First run welcome page

2 participants