Skip to content

Add only allowlist for connectors and requests - #15

Merged
craigpotter merged 1 commit into
mainfrom
feature/only-allowlist
Jul 17, 2026
Merged

Add only allowlist for connectors and requests#15
craigpotter merged 1 commit into
mainfrom
feature/only-allowlist

Conversation

@craigpotter

Copy link
Copy Markdown
Collaborator

Overview of change

Adds an allowlist so users with many connectors/requests can record just a subset instead of maintaining an ever-growing ignore list:

// config/barstool.php
'only' => [
    'connectors' => [
        StripeConnector::class,
    ],
    'requests' => [],
],

Semantics

  • If both only lists are empty (the default), everything is recorded — fully backward compatible, no config or migration changes needed for existing installs.
  • If either list is non-empty, a request is recorded only when its connector class or request class is listed (exact class match, consistent with ignore).
  • The ignore list is applied afterwards and always takes precedence, so you can allow a whole connector and still ignore individual noisy requests on it.

All three recording hooks (request, response, fatal) flow through shouldRecord(), so filtering behaves consistently everywhere.

Tidy-up

shouldRecord() was getting busy, so the checks are now extracted into named private methods — resolveClasses(), passesOnlyList(), passesIgnoreList() — keeping the method a short, readable conjunction. No public API changes.

Related

Closes #8

Testing

Six new Pest tests: only-connectors filtering, only-requests filtering, OR semantics across the two lists, ignore-beats-only (including the allow-connector/ignore-one-request case), conflict resolution when a class is in both lists, and the empty-lists backward-compatibility guard.

composer test (31 passed, 154 assertions), composer analyse (PHPStan level 8, clean), composer format (clean).

Adds an `only` config block mirroring the existing `ignore` structure.
When either list is non-empty, a request is recorded only if its
connector class or request class is listed. The ignore list is applied
afterwards and always takes precedence, so a whole connector can be
allowed while individual requests on it are still ignored. Empty lists
keep the current record-everything behaviour.

Also tidies shouldRecord() by extracting the checks into named private
methods (resolveClasses, passesOnlyList, passesIgnoreList).

Closes #8
@craigpotter
craigpotter merged commit a7a1425 into main Jul 17, 2026
10 checks passed
@craigpotter
craigpotter deleted the feature/only-allowlist branch July 17, 2026 23:34
craigpotter added a commit that referenced this pull request Jul 17, 2026
# Overview of change

Documentation follow-up from #13/#15: the README previously documented
queue support and the newer features but almost none of the config
options. This PR:

- Groups all configuration docs under a single **Configuration** section
with subsections: enabling & disabling, choosing what gets recorded
(`only`/`ignore`), keeping only failed responses, redacting sensitive
request headers, excluding response bodies, response body limits,
database connection, pruning, and queue support
- Adds a short **Requirements** section (PHP 8.3+, Laravel 12+, Saloon
v4)
- Documents the placeholder values users see in the `barstools` table
(`REDACTED`, `<Streamed Body>`, `<Multipart Body>`, `<Unsupported
Barstool Response Content>`) and when each appears
- Links the pruning setup from Installation instead of duplicating it
there
- Minor copy fixes, keeping the existing tone

One non-README change: the `enabled` config comment mentioned a UI that
doesn't exist, so that mention is removed.

# Testing

Docs only (plus a config comment) — full suite still green locally (31
passed, 154 assertions), Pint clean.
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.

Feature Request: Allowlist support for connectors and requests

1 participant