Skip to content

Commit 7f75d09

Browse files
TBarregrenclaude
andcommitted
v1.8.1: Update documentation to reflect v1.8.0 changes
Update CLAUDE.md, README.md, and docs/* to document Settings, Logger, Settings_Page, Queue_List_Table, structured enqueue payloads, configurable per-job retry, queue management UI, default date filter, and log directory lifecycle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4902ef1 commit 7f75d09

9 files changed

Lines changed: 136 additions & 71 deletions

CLAUDE.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All machine-readable names use `kntnt-ad-attr` (hyphens) / `kntnt_ad_attr` (unde
1717
| Custom tables | `{prefix}kntnt_ad_attr_clicks`, `{prefix}kntnt_ad_attr_conversions`, `{prefix}kntnt_ad_attr_click_ids`, `{prefix}kntnt_ad_attr_queue` |
1818
| Capability | `kntnt_ad_attr` |
1919
| DB version option | `kntnt_ad_attr_version` |
20+
| Settings option | `kntnt_ad_attr_settings` |
2021
| Cron hooks | `kntnt_ad_attr_daily_cleanup`, `kntnt_ad_attr_process_queue` |
2122
| REST namespace | `kntnt-ad-attribution/v1` |
2223
| REST CPT base | `kntnt-ad-attr-urls` |
@@ -32,23 +33,26 @@ All machine-readable names use `kntnt-ad-attr` (hyphens) / `kntnt_ad_attr` (unde
3233

3334
1. `Updater` — GitHub-based update checker
3435
2. `Migrator` — database migration runner
35-
3. `Post_Type` — CPT registration
36-
4. `Cookie_Manager` — cookie read/write operations (stateless)
37-
5. `Consent` — three-state consent resolution
38-
6. `Bot_Detector` — User-Agent filtering
39-
7. `Click_ID_Store` — platform-specific click ID storage (v1.2.0)
40-
8. `Queue` — async job queue (v1.2.0)
41-
9. `Queue_Processor(Queue)` — queue job dispatcher (v1.2.0)
42-
10. `Click_Handler(Cookie_Manager, Consent, Bot_Detector, Click_ID_Store)` — click processing & redirect
43-
11. `Conversion_Handler(Cookie_Manager, Consent, Bot_Detector, Click_ID_Store, Queue, Queue_Processor)` — conversion attribution
44-
12. `Cron(Click_ID_Store, Queue)` — scheduled cleanup tasks
45-
13. `Admin_Page(Queue)` — admin UI orchestration
46-
14. `Rest_Endpoint(Cookie_Manager, Consent)` — REST API routes
36+
3. `Settings` — centralized settings manager
37+
4. `Logger(Settings)` — shared diagnostic logger
38+
5. `Post_Type` — CPT registration
39+
6. `Cookie_Manager` — cookie read/write operations (stateless)
40+
7. `Consent` — three-state consent resolution
41+
8. `Bot_Detector` — User-Agent filtering
42+
9. `Click_ID_Store` — platform-specific click ID storage (v1.2.0)
43+
10. `Queue(Settings)` — async job queue with configurable retry (v1.2.0)
44+
11. `Queue_Processor(Queue, Logger)` — queue job dispatcher (v1.2.0)
45+
12. `Click_Handler(Cookie_Manager, Consent, Bot_Detector, Click_ID_Store)` — click processing & redirect
46+
13. `Conversion_Handler(Cookie_Manager, Consent, Bot_Detector, Click_ID_Store, Queue, Queue_Processor)` — conversion attribution
47+
14. `Cron(Click_ID_Store, Queue, Logger)` — scheduled cleanup tasks
48+
15. `Admin_Page(Queue, Queue_Processor)` — admin UI orchestration
49+
16. `Rest_Endpoint(Cookie_Manager, Consent)` — REST API routes
50+
17. `Settings_Page(Settings, Logger)` — settings page under Settings > Ad Attribution
4751

4852
**Lifecycle files (not autoloaded):**
4953

50-
- `install.php` — activation: grants `kntnt_ad_attr` capability to admin/editor, runs Migrator, registers CPT, flushes rewrite rules, schedules daily cron.
51-
- `uninstall.php` — complete data removal. Runs outside the plugin's namespace (no autoloader available), uses raw `$wpdb` queries. Drops all four custom tables, deletes CPT posts, removes capability from all roles, clears options/transients/cron.
54+
- `install.php` — activation: grants `kntnt_ad_attr` capability to admin/editor, runs Migrator, registers CPT, flushes rewrite rules, schedules daily cron, creates log directory (`wp-content/uploads/kntnt-ad-attribution/`) with `.htaccess` protection.
55+
- `uninstall.php` — complete data removal. Runs outside the plugin's namespace (no autoloader available), uses raw `$wpdb` queries. Drops all four custom tables, deletes CPT posts, removes capability from all roles, clears options (including `kntnt_ad_attr_settings`)/transients/cron, removes log directory.
5256
- `Plugin::deactivate()` — clears cron (`kntnt_ad_attr_daily_cleanup` and `kntnt_ad_attr_process_queue`), transients, and rewrite rules. Preserves data.
5357

5458
**Migrator pattern:** Version-based migrations in `migrations/X.Y.Z.php`. Each file returns `function(\wpdb $wpdb): void`. Migrator compares `kntnt_ad_attr_version` option with the plugin header version on `plugins_loaded` and runs pending files in order.
@@ -57,7 +61,13 @@ All machine-readable names use `kntnt-ad-attr` (hyphens) / `kntnt_ad_attr` (unde
5761

5862
**Shared utility methods (v1.5.1):** `Post_Type::get_valid_hashes(array $hashes)` returns hashes with published tracking URL posts (used by both `Conversion_Handler` and `Rest_Endpoint`). `Post_Type::get_distinct_meta_values(string $meta_key)` returns sorted distinct meta values for filter dropdowns (used by `Campaign_List_Table`).
5963

60-
**Adapter infrastructure (v1.2.0):** Click_ID_Store, Queue, and Queue_Processor are instantiated in Plugin constructor and injected into Click_Handler (Click_ID_Store), Conversion_Handler (Consent, Bot_Detector, Click_ID_Store, Queue, Queue_Processor), Cron (Click_ID_Store, Queue), and Admin_Page (Queue). Two new filters: `kntnt_ad_attr_click_id_capturers` and `kntnt_ad_attr_conversion_reporters`. Queue processing via `kntnt_ad_attr_process_queue` cron hook. If no adapters are registered, zero overhead.
64+
**Adapter infrastructure (v1.2.0):** Click_ID_Store, Queue, and Queue_Processor are instantiated in Plugin constructor and injected into Click_Handler (Click_ID_Store), Conversion_Handler (Consent, Bot_Detector, Click_ID_Store, Queue, Queue_Processor), Cron (Click_ID_Store, Queue, Logger), and Admin_Page (Queue, Queue_Processor). Two new filters: `kntnt_ad_attr_click_id_capturers` and `kntnt_ad_attr_conversion_reporters`. Queue processing via `kntnt_ad_attr_process_queue` cron hook. If no adapters are registered, zero overhead.
65+
66+
**Settings and Logger (v1.8.0):** `Settings` manages plugin-wide configuration in a single `kntnt_ad_attr_settings` option with filter-based defaults: cookie_lifetime, dedup_seconds, enable_logging, log file sizes, and queue retry parameters. `Logger` writes timestamped diagnostic entries to `wp-content/uploads/kntnt-ad-attribution/kntnt-ad-attribution.log`, shared by core and add-on plugins. Log methods: `info(string $prefix, string $message)` and `error(string $prefix, string $message)`. File auto-rotation between configurable max/min KB limits. `Settings_Page` under Settings > Ad Attribution provides UI for all settings across three sections: Cookies, Logging, Queue (Retry).
67+
68+
**Queue management UI (v1.8.0):** `Queue_List_Table` (WP_List_Table subclass) displays pending/failed queue jobs with columns: Reporter, Description (label), Created, Next Retry, Attempts, Error. Row actions: "Run Now" (via `Queue_Processor::process_single()`) and "Delete" (via `Queue::delete()`). The `Queue::enqueue()` method accepts optional `label` and per-job `retry_params` (attempts_per_round, retry_delay, max_rounds, round_delay). Conversion reporters return structured items with `payload`, optional `label`, and optional `retry_params` keys.
69+
70+
**Default date filter (v1.8.0):** `Campaign_List_Table::get_default_date_range()` computes the two most recent complete calendar weeks based on the WordPress "Week Starts On" setting. Used as the default when no date filter is provided.
6171

6272
**Merged admin view (v1.6.0):** The admin page is a single merged view (no tabs). Add-on plugins can still register custom views via `kntnt_ad_attr_admin_tabs` filter; when `?tab=<slug>` is passed, the `kntnt_ad_attr_admin_tab_{$tab}` action fires for rendering.
6373

@@ -87,7 +97,7 @@ The test suite has three levels. See `docs/testing-strategy.md` for full details
8797

8898
| Level | Framework | Tests | What it covers |
8999
|-------|-----------|-------|----------------|
90-
| PHP unit | Pest + Brain Monkey + Mockery | 225 | Individual class methods in isolation |
100+
| PHP unit | Pest + Brain Monkey + Mockery | 252 | Individual class methods in isolation |
91101
| JS unit | Vitest + happy-dom | 28 | `pending-consent.js` and `admin.js` |
92102
| Integration | Bash + curl + WordPress Playground | 14 suites | End-to-end flows: click, conversion, admin, REST, cron |
93103

0 commit comments

Comments
 (0)