Skip to content

docs: add opt-in, participant-targeted recruitment banner to Starlight docs#42595

Merged
pelikhan merged 10 commits into
mainfrom
copilot/add-docs-recruitment-banner
Jul 1, 2026
Merged

docs: add opt-in, participant-targeted recruitment banner to Starlight docs#42595
pelikhan merged 10 commits into
mainfrom
copilot/add-docs-recruitment-banner

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This introduces a dismissible research recruitment banner for the docs site that works in a static GitHub Pages deployment (no server-side current_user). Banner visibility is opt-in via recruitment link parameters and ships disabled by default.

  • Banner architecture (Starlight slot override)

    • Added docs/src/components/RecruitmentBanner.astro and wired it to components.Banner in docs/astro.config.mjs.
    • Preserves existing per-page frontmatter banners by rendering native banner content first.
    • Renders recruitment CTA UI only when config is enabled and CTA URL is set.
  • Targeting + persistence model (static-site safe)

    • Added docs/src/config/recruitmentBanner.ts for operational controls: enabled, slug, copy, ctaUrl, paths, frequency, requireUid.
    • Eligibility is captured from ?recruit=<slug> (optionally &uid=<dotcom_id>) and persisted in localStorage.
    • Dismissal is persisted per slug; optional path scoping is supported.
    • CTA URL is decorated at runtime with utm_source=inproduct_banner, utm_medium=docs, utm_campaign=<slug>, and optional pid=<uid>.
    • Emits banner_research_cta as a best-effort browser event on click.
  • Operator documentation

    • Added docs/RECRUITMENT_BANNER.md with configuration guidance and go-live guardrails (including explicit “ships OFF” behavior and non-commitment of participant IDs).
  • Focused regression coverage

    • Added docs/tests/recruitment-banner.spec.ts to assert no recruitment banner renders while enabled: false, even when recruit query params are present.
// docs/astro.config.mjs
components: {
  Banner: './src/components/RecruitmentBanner.astro',
  Head: './src/components/CustomHead.astro',
  // ...
}

Generated by 👨‍🍳 PR Sous Chef · 151.9 AIC · ⌖ 15.1 AIC · ⊞ 1.7K ·

Copilot AI and others added 3 commits July 1, 2026 01:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add opt-in survey recruitment banner to docs site docs: add opt-in, participant-targeted recruitment banner to Starlight docs Jul 1, 2026
Copilot AI requested a review from pelikhan July 1, 2026 01:22

@pelikhan pelikhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot make fmt

Comment thread docs/RECRUITMENT_BANNER.md Outdated
@@ -0,0 +1,69 @@
# Research recruitment banner

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot convert this file to ADR (in adr folder)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Converted to ADR in ded8f96: docs/adr/46051-recruitment-banner-for-targeted-docs-research.md, and removed docs/RECRUITMENT_BANNER.md.

</style>

<script>
// Client-side eligibility + reveal. Runs on every page load (Starlight is MPA by default).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot format JavaScript, check for security issues

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ded8f96 and follow-up ddf6f08: formatted the client script and added security hardening (UID sanitization, protocol guard for CTA URL rewriting, stricter path-prefix matching, and rationale note).

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §28486872548

Field Value
Category feature
Risk medium
Score 32 / 100
Priority low
Action defer

Score breakdown: Impact 15/50 · Urgency 5/30 · Quality 12/20

Batch: draft-wip (PRs #42595, #42596, #42597)

Rationale: Draft opt-in recruitment banner for docs site (+409/-0, 5 files including tests). Low urgency, no reviews. Defer until marked ready.

Labels applied: pr-type:feature pr-risk:medium pr-priority:low pr-action:defer pr-batch:draft-wip pr-agent:copilot-swe-agent

Generated by 🔧 PR Triage Agent · 77.2 AIC · ⌖ 9.82 AIC · ⊞ 1.6K ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review July 1, 2026 01:46
Copilot AI review requested due to automatic review settings July 1, 2026 01:46
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot make fmt

Done in ded8f96 (and retained in ddf6f08). I ran make fmt and pushed the formatted result.

Copilot AI requested a review from pelikhan July 1, 2026 01:48

Copilot AI 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.

Pull request overview

This PR adds an opt-in, participant-targeted research recruitment banner to the Starlight-based docs site, designed to work in a static GitHub Pages deployment and ship disabled by default.

Changes:

  • Adds a Starlight components.Banner override (RecruitmentBanner.astro) that preserves any native frontmatter banner content and conditionally renders a recruitment CTA.
  • Introduces a typed configuration module (recruitmentBanner.ts) to control enablement, targeting, and CTA details.
  • Adds Playwright coverage to ensure the banner does not render when enabled: false.
Show a summary per file
File Description
docs/src/components/RecruitmentBanner.astro Implements the Banner slot override and client-side eligibility/persistence logic.
docs/src/config/recruitmentBanner.ts Defines the operational configuration for enablement, slug, CTA, paths, and frequency.
docs/astro.config.mjs Wires the Banner slot override into Starlight.
docs/tests/recruitment-banner.spec.ts Adds a regression test asserting the banner is absent while disabled.
docs/adr/46051-recruitment-banner-for-targeted-docs-research.md Adds an ADR documenting decision and requirements for the feature.
.github/workflows/pr-code-quality-reviewer.lock.yml Updates generated workflow lock metadata.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Low

Comment on lines +51 to +54
/**
* Optional path scoping. Each entry is matched as a substring of the current pathname
* (e.g. `/gh-aw/guides/`). Empty array = show on every docs page.
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 83f22f9: updated the comment from "matched as a substring" to "matched as a path prefix" to match the here.startsWith(p) implementation.


---

*ADR created from the original recruitment banner operator doc and pending final review before status changes from Draft.*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in the latest commit: updated the ADR footer to explicitly state it is the operator guidance document replacing docs/RECRUITMENT_BANNER.md. The PR description also needs updating but the API is restricted in this environment — a maintainer can update it to reference docs/adr/46051-recruitment-banner-for-targeted-docs-research.md.

Comment on lines +220 to +222
} catch (e) {
/* leave the configured href as-is */
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 83f22f9: the catch block now returns immediately, keeping the banner hidden rather than revealing it with an unvalidated href.

Comment on lines +190 to +201
if (params.get('recruit') === slug) {
const incomingUid = sanitizeUid(params.get('uid') || '');
set(KEY, incomingUid || '1');
}

// 2) Respect dismissals (unless frequency is "always").
if (el.getAttribute('data-frequency') !== 'always' && get(DISMISS_KEY)) return;

// 3) Eligible only if we captured the recruitment link at some point.
const stored = get(KEY);
const uid = sanitizeUid(stored && stored !== '1' ? stored : '');
const eligible = Boolean(stored) && (!requireUid || Boolean(uid));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 83f22f9: replaced the '1' sentinel with '__present__' (a non-numeric string that can never match the ^[0-9]+$ uid pattern), and updated the corresponding sentinel check on the read path.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Hey @copilot-swe-agent 👋 — great work on the opt-in recruitment banner for the Starlight docs site! This is a well-scoped, thoughtfully implemented feature.

A few things stand out as particularly well done:

  • Ships disabled by defaultenabled: false in the config means there's no accidental launch risk.
  • Static-site safe — the localStorage-based eligibility model is the right call for a GitHub Pages deployment with no server-side user context.
  • ADR includeddocs/adr/46051-recruitment-banner-for-targeted-docs-research.md documents the decision, alternatives considered, and normative spec. That's exactly the right level of rigour for a user-facing feature.
  • Regression coverage — the Playwright test asserting the banner doesn't render while disabled is a solid guard against accidental enablement.

The PR is well-described, focused, adds no new package dependencies, and includes tests. It looks ready for maintainer review. 🚀

Generated by ✅ Contribution Check · 360.2 AIC · ⌖ 15.7 AIC · ⊞ 6.3K ·

@pelikhan

pelikhan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI and others added 2 commits July 1, 2026 02:06
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Branch updated — merged latest from main

@copilot This PR looks ready to finish! Run the pr-finisher skill to merge when checks pass.


pr-sous-chef | 🤖

Generated by 👨‍🍳 PR Sous Chef · 151.9 AIC · ⌖ 15.1 AIC · ⊞ 1.7K ·

…BANNER.md

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Branch updated — merged latest from main

@copilot This PR looks ready to finish! Run the pr-finisher skill to merge when checks pass....

Done. All review threads addressed, local make fmt and make lint pass, and parallel validation (code review + CodeQL) is clean. CI needs a human re-trigger before merge.

Copilot AI requested a review from gh-aw-bot July 1, 2026 02:48
@pelikhan pelikhan merged commit bd126c2 into main Jul 1, 2026
@pelikhan pelikhan deleted the copilot/add-docs-recruitment-banner branch July 1, 2026 03:02
@jayjdub

jayjdub commented Jul 1, 2026

Copy link
Copy Markdown

cc @cmuto09 — the docs survey recruitment banner PR is now open (implements #42528).

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add opt-in survey recruitment banner to the docs site

5 participants