From 3e350d1a03d9db03034089da4a83919e222989e4 Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Mon, 16 Nov 2026 01:09:23 +0530 Subject: [PATCH 1/2] chore: modernize the issue templates as GitHub forms Signed-off-by: Priyanshubhartistm --- .changeset/issue-templates-forms.md | 2 + .github/ISSUE_TEMPLATE/bug_report.md | 33 ---- .github/ISSUE_TEMPLATE/bug_report.yml | 69 ++++++++ .github/ISSUE_TEMPLATE/config.yml | 14 ++ .github/ISSUE_TEMPLATE/documentation.yml | 22 +++ .github/ISSUE_TEMPLATE/feature_request.md | 23 --- .github/ISSUE_TEMPLATE/feature_request.yml | 37 ++++ .github/ISSUE_TEMPLATE/security_report.md | 14 ++ test/unit/ci/issue-templates.spec.ts | 190 +++++++++++++++++++++ 9 files changed, 348 insertions(+), 56 deletions(-) create mode 100644 .changeset/issue-templates-forms.md delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/security_report.md create mode 100644 test/unit/ci/issue-templates.spec.ts diff --git a/.changeset/issue-templates-forms.md b/.changeset/issue-templates-forms.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/issue-templates-forms.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 53e068d98..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG] " -labels: bug -assignees: Cameri - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Run command '...' -2. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**System (please complete the following information):** - - OS: [e.g. Ubuntu] - - Platform: [e.g. docker, standalone] - - Version: [e.g. 1.9.11] - -**Logs** -If applicable, attach log messages showing the bug and context when the bug happened. - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..595882062 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,69 @@ +name: Bug report +description: Report something that does not work as expected +labels: ["bug"] +body: + - type: textarea + id: what-happened + attributes: + label: What happened + description: What you did, what you expected, and what happened instead. + validations: + required: true + - type: input + id: version + attributes: + label: Relay version + description: Shown in the start-up banner. + placeholder: v3.15.3 + validations: + required: true + - type: dropdown + id: deployment + attributes: + label: Deployment + options: + - docker compose + - standalone + - railway + - other + validations: + required: true + - type: dropdown + id: os + attributes: + label: OS + options: + - Linux + - macOS + - Windows + - other + validations: + required: true + - type: input + id: nips + attributes: + label: NIPs involved + description: If you know which. + placeholder: NIP-42, NIP-77 + - type: textarea + id: logs + attributes: + label: Logs + description: The part of the log around the problem. + render: shell + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction steps + placeholder: | + 1. Run command '...' + 2. See error + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional context + description: Screenshots, settings, anything else that helps. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..d69652294 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: Report a security vulnerability + url: https://github.com/cameri/nostream/security/advisories/new + about: Please do not open a public issue for a vulnerability. Report it privately; SECURITY.md lists the supported versions. + - name: Ask in the development chat + url: https://t.me/nostream_dev + about: Questions about running or deploying nostream, and talk with other operators and contributors. + - name: Discuss the Nostr protocol + url: https://t.me/nostr_protocol + about: Questions about the protocol and the NIPs themselves, rather than about nostream. + - name: Visit the website + url: https://ema.tnsor.network + about: The nostream website, with an overview of the project. diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml new file mode 100644 index 000000000..af76841d2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -0,0 +1,22 @@ +name: Documentation +description: Something in the docs, README or website is missing, wrong or unclear +labels: ["documentation"] +body: + - type: input + id: location + attributes: + label: Where + description: The file or page, for example CONFIGURATION.md or a link to the website. + validations: + required: true + - type: textarea + id: problem + attributes: + label: What is missing, wrong or unclear + validations: + required: true + - type: textarea + id: suggestion + attributes: + label: Suggested wording + description: Optional, if you already know what it should say. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index a1cf78cc2..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "[REQUEST]" -labels: enhancement -assignees: Cameri - ---- - -**Pledge** -If the feature or idea is implemented or resolved to your satisfaction, please consider making a small monetary donation to support the continued development and independence of this project. To help the maintainers gauge on where to focus their effort, please include the amount of your pledge. A wallet address or Lightning invoice will be provided once the feature is complete. - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..17735860d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,37 @@ +name: Feature request +description: Suggest an idea for this project +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + **Pledge** + If the feature or idea is implemented or resolved to your satisfaction, please consider making a small monetary donation to support the continued development and independence of this project. To help the maintainers gauge on where to focus their effort, please include the amount of your pledge. A wallet address or Lightning invoice will be provided once the feature is complete. + - type: textarea + id: problem + attributes: + label: Problem + description: What are you trying to do, and what is in the way? + validations: + required: true + - type: textarea + id: solution + attributes: + label: Proposed solution + description: What you would like to happen. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + - type: input + id: pledge + attributes: + label: Pledge amount + description: Optional. The amount you would pledge, with its unit. + placeholder: 50000 sats + - type: textarea + id: context + attributes: + label: Additional context diff --git a/.github/ISSUE_TEMPLATE/security_report.md b/.github/ISSUE_TEMPLATE/security_report.md new file mode 100644 index 000000000..d2c38daaa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/security_report.md @@ -0,0 +1,14 @@ +--- +name: Security report +about: Read this before reporting a security problem +labels: security +--- + +**Do not describe a vulnerability in this issue.** Issues are public. + +Report vulnerabilities privately through GitHub's private vulnerability reporting instead: +https://github.com/cameri/nostream/security/advisories/new + +`SECURITY.md` lists the versions that receive security fixes and what to include in a report. + +Use this template only for a security question or a hardening suggestion that exposes nothing an attacker could use. diff --git a/test/unit/ci/issue-templates.spec.ts b/test/unit/ci/issue-templates.spec.ts new file mode 100644 index 000000000..08fabf16d --- /dev/null +++ b/test/unit/ci/issue-templates.spec.ts @@ -0,0 +1,190 @@ +import chai from 'chai' +import { existsSync, readdirSync, readFileSync } from 'fs' +import { load } from 'js-yaml' +import { join } from 'path' + +const { expect } = chai + +const templateDir = join(process.cwd(), '.github', 'ISSUE_TEMPLATE') +const read = (file: string): string => readFileSync(join(templateDir, file), 'utf-8') + +type FormElement = { + type?: string + id?: string + attributes?: { label?: string; value?: string; options?: unknown[]; render?: string } + validations?: { required?: boolean } +} + +type Form = { + name?: string + description?: string + labels?: string[] + assignees?: string[] + title?: string + body?: FormElement[] +} + +const formFiles = readdirSync(templateDir).filter((file) => file.endsWith('.yml') && file !== 'config.yml') + +// The labels the repository has, which GitHub silently drops from a form when they do not exist. +const REPOSITORY_LABELS = ['bug', 'enhancement', 'documentation', 'security'] +const ELEMENT_TYPES = ['markdown', 'textarea', 'input', 'dropdown', 'checkboxes'] + +describe('issue templates', () => { + describe('config.yml', () => { + const config = load(read('config.yml')) as { + blank_issues_enabled?: boolean + contact_links?: Array<{ name?: string; url?: string; about?: string }> + } + + it('turns off blank issues, so every issue starts from a template', () => { + expect(config.blank_issues_enabled).to.equal(false) + }) + + it('sends security reports to private vulnerability reporting', () => { + const link = config.contact_links?.find((entry) => entry.url?.includes('/security/advisories/new')) + + expect(link?.url).to.equal('https://github.com/cameri/nostream/security/advisories/new') + }) + + it('links the development chat, the protocol chat and the website that #857 asks for', () => { + const urls = config.contact_links?.map((entry) => entry.url) + + expect(urls).to.include('https://t.me/nostream_dev') + expect(urls).to.include('https://t.me/nostr_protocol') + expect(urls).to.include('https://ema.tnsor.network') + }) + + it('gives every contact link a name, a https url and a description', () => { + expect(config.contact_links).to.have.length.greaterThan(0) + for (const link of config.contact_links ?? []) { + expect(link.name, 'name').to.be.a('string').that.is.not.empty + expect(link.about, 'about').to.be.a('string').that.is.not.empty + expect(link.url, 'url').to.match(/^https:\/\//) + } + }) + }) + + describe('forms', () => { + it('has the bug report, feature request and documentation forms', () => { + expect(formFiles.sort()).to.deep.equal(['bug_report.yml', 'documentation.yml', 'feature_request.yml']) + }) + + for (const file of formFiles) { + describe(file, () => { + const form = load(read(file)) as Form + const fields = (form.body ?? []).filter((element) => element.type !== 'markdown') + + it('has a name and a description', () => { + expect(form.name, 'name').to.be.a('string').that.is.not.empty + expect(form.description, 'description').to.be.a('string').that.is.not.empty + }) + + it('is labelled with labels the repository has, and assigns nobody', () => { + expect(form.labels).to.be.an('array').that.is.not.empty + for (const label of form.labels ?? []) { + expect(REPOSITORY_LABELS).to.include(label) + } + expect(form.assignees).to.equal(undefined) + }) + + it('has no title prefix to delete before writing a title', () => { + expect(form.title).to.equal(undefined) + }) + + it('only uses element types GitHub knows', () => { + expect(form.body).to.be.an('array').that.is.not.empty + for (const element of form.body ?? []) { + expect(ELEMENT_TYPES).to.include(element.type) + } + }) + + it('gives every field a label and a unique id', () => { + const ids = fields.map((field) => field.id) + + for (const field of fields) { + expect(field.id, 'id').to.be.a('string').that.is.not.empty + expect(field.attributes?.label, `label of ${field.id}`).to.be.a('string').that.is.not.empty + } + expect(new Set(ids).size).to.equal(ids.length) + }) + + it('gives every dropdown at least one option', () => { + for (const dropdown of fields.filter((field) => field.type === 'dropdown')) { + expect(dropdown.attributes?.options, `options of ${dropdown.id}`).to.be.an('array').that.is.not.empty + } + }) + + it('requires at least one field, so an empty issue cannot be filed', () => { + expect(fields.some((field) => field.validations?.required === true)).to.equal(true) + }) + }) + } + + describe('bug_report.yml', () => { + const form = load(read('bug_report.yml')) as Form + const byId = (id: string) => form.body?.find((element) => element.id === id) + + it('asks for what the maintainers need to reproduce a bug', () => { + for (const id of ['what-happened', 'version', 'deployment', 'os', 'logs', 'reproduction']) { + expect(byId(id)?.validations?.required, `${id} is required`).to.equal(true) + } + }) + + it('leaves the NIPs and the extra context optional', () => { + expect(byId('nips')?.validations?.required).to.not.equal(true) + expect(byId('context')?.validations?.required).to.not.equal(true) + }) + + it('shows the logs as code', () => { + expect(byId('logs')?.attributes?.render).to.be.a('string').that.is.not.empty + }) + }) + + describe('feature_request.yml', () => { + const form = load(read('feature_request.yml')) as Form + + it('keeps the pledge paragraph of the old template word for word', () => { + const pledge = form.body?.find((element) => element.type === 'markdown')?.attributes?.value + + expect(pledge).to.contain( + 'If the feature or idea is implemented or resolved to your satisfaction, please consider making a small monetary donation to support the continued development and independence of this project. To help the maintainers gauge on where to focus their effort, please include the amount of your pledge. A wallet address or Lightning invoice will be provided once the feature is complete.', + ) + }) + + it('asks for the pledge amount, and does not insist on it', () => { + const pledge = form.body?.find((element) => element.id === 'pledge') + + expect(pledge?.type).to.equal('input') + expect(pledge?.validations?.required).to.not.equal(true) + }) + + it('requires the problem and the proposed solution', () => { + for (const id of ['problem', 'solution']) { + expect(form.body?.find((element) => element.id === id)?.validations?.required).to.equal(true) + } + }) + }) + }) + + describe('security_report.md', () => { + const template = read('security_report.md') + const frontMatter = load(template.split('---')[1]) as { name?: string; labels?: string; assignees?: string } + + it('is a markdown template labelled security, with nobody assigned', () => { + expect(frontMatter.name).to.be.a('string').that.is.not.empty + expect(frontMatter.labels).to.equal('security') + expect(frontMatter.assignees).to.equal(undefined) + }) + + it('tells the reporter to use private vulnerability reporting, not this public issue', () => { + expect(template).to.contain('https://github.com/cameri/nostream/security/advisories/new') + expect(template).to.contain('Do not describe a vulnerability in this issue') + }) + }) + + it('no longer has the legacy markdown templates, which carried Cameri as the default assignee', () => { + expect(existsSync(join(templateDir, 'bug_report.md'))).to.equal(false) + expect(existsSync(join(templateDir, 'feature_request.md'))).to.equal(false) + }) +}) From 822ebec405e35cd62d9dbcf5f875666d37d1a6ac Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Mon, 16 Nov 2026 15:08:47 +0530 Subject: [PATCH 2/2] ci: run the checks when only an issue template changes Signed-off-by: Priyanshubhartistm --- .github/workflows/checks.yml | 3 +++ test/unit/ci/issue-templates.spec.ts | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ad7223772..ba6c836e5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -46,6 +46,9 @@ jobs: # test/unit/scripts/deploy-with-retry.spec.ts runs the deploy # script, so a change to it must run the suite that asserts on it. - '.github/scripts/**' + # test/unit/ci/issue-templates.spec.ts reads these templates, so a + # template-only change must run the suite that asserts on them. + - '.github/ISSUE_TEMPLATE/**' commit-lint: name: Lint commits diff --git a/test/unit/ci/issue-templates.spec.ts b/test/unit/ci/issue-templates.spec.ts index 08fabf16d..ff104bedf 100644 --- a/test/unit/ci/issue-templates.spec.ts +++ b/test/unit/ci/issue-templates.spec.ts @@ -187,4 +187,14 @@ describe('issue templates', () => { expect(existsSync(join(templateDir, 'bug_report.md'))).to.equal(false) expect(existsSync(join(templateDir, 'feature_request.md'))).to.equal(false) }) + + it('is run by CI when only a template changes, so these tests protect the files they read', () => { + const workflow = load(readFileSync(join(process.cwd(), '.github', 'workflows', 'checks.yml'), 'utf-8')) as { + jobs?: { changes?: { steps?: Array<{ id?: string; with?: { filters?: string } }> } } + } + const filterStep = workflow.jobs?.changes?.steps?.find((step) => step.id === 'filter') + const filters = load(filterStep?.with?.filters ?? '') as { src?: string[] } + + expect(filters.src).to.include('.github/ISSUE_TEMPLATE/**') + }) })