Skip to content

test(branding): replace regression-style FORBIDDEN_TOKENS with broad allowlist-based scan #67

Closed

Description

@thehoff

Problem

tests/branding_lint.rs::FORBIDDEN_TOKENS is a regression-style catch list — each row a known leak pattern. Over the v0.1.8 → v0.1.9 cycle this missed 3 leak classes (init message, error prefixes, clap help docs) that only surfaced via user reports, requiring 3 separate hotfix rounds. The list is now broad but still WHITELIST-blind.

Goal

Switch branding_lint to allowlist-style: scan every .rs file under src/ for ANY case-insensitive \brtk\b reference; allow only those that match an explicit allowlist rule. Future leaks fail the lint at test time, not user-report time.

Allowlist categories (from current session)

  • Filesystem paths: .rtk/filters.toml, ~/.rtk/, /Library/Application Support/rtk/ (intentional — cross-fork file layout)
  • Env vars: RTK_* (programmatic interface; renaming breaks user configs). E.g. RTK_TELEMETRY_DISABLED, RTK_HOOK_AUDIT, RTK_DB_PATH, RTK_TELEMETRY_URL, RTK_TELEMETRY_TOKEN
  • Upstream attribution: rtk-ai/rtk, RTK AI Labs, [email protected], links to github.com/rtk-ai/rtk
  • SQLite schema column: rtk_cmd (the column name in history.db)
  • Tracking labels: format!("rtk X") inside src/discover/registry.rs (consumed by the hook caller; see scope: standardise rewrite_command output prefix ( vs ) #62)
  • Test fixture argv[0]: vec!["rtk", ...] in CLI parsing tests (clap ignores argv[0])
  • Per-line allow marker: existing // branding-lint: allow legacy mechanism
  • Function-name allowlist: existing ALLOWED_FUNCTION_PREFIXES for legacy-handling helpers

Definition of done

  • A new branding_lint_no_unrecognised_rtk_references_in_src test that does the broad scan
  • Runs in <1s on the full src/
  • ALL allowlist categories above are implemented (preferably as named rules so adding a new category is one entry, not a regex rewrite)
  • Failure messages name the file:line + the offending substring + which allowlist rule it failed to match
  • Existing branding_lint_no_forbidden_upstream_literals_in_src retained as a regression-style backstop
  • cargo test --test branding_lint passes on develop tip

Scope

This test file only. No production source changes.

Activity

  1. added
    enhancement
    on May 18, 2026
  2. added a commit that references this issue on May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions