Commit Graph

3899 Commits

Author SHA1 Message Date
Émile Ré
9dedeeaa42 Skip draft version for uncategorised-only merges
Pattern merges and adoptions that stay entirely within the
uncategorised category never change the visitor-facing snapshot.
Only trigger ensureDraftVersionForBanner when a merge group
belongs to a consent category.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 19:31:53 +04:00
Émile Ré
9d4af4d73e Validate cookie policy link in banner description
Translations are no longer part of the version snapshot, so the
banner_description text must be validated at write time to ensure
the {{cookie_policy_link}} placeholder is present. Without it
the cookie policy URL silently disappears from the rendered banner.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 19:09:16 +04:00
Émile Ré
33940d63ca Run cookie detection regardless of banner state
Decouple detection from the banner's active state so admins
can discover cookies before making the banner visible. The
client now starts the detector even when the config endpoint
returns 404, and the detector stops itself if the report
endpoint returns 404 (wrong or deleted banner ID).

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 19:01:13 +04:00
Émile Ré
478ccf6785 Exclude uncategorised category from consent contract
The uncategorised category is an admin-side inbox for detected
cookies and should not be part of the visitor-facing consent
contract. Filter it out of snapshots so changes to uncategorised
patterns no longer trigger version bumps.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 18:33:07 +04:00
Émile Ré
887453fee2 Exclude translations from cookie banner version snapshots
Translation changes are cosmetic, not consent-contract changes,
so they should not trigger a version bump. Translations are now
loaded live from the database at serve time instead of being
frozen in the snapshot.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 18:10:18 +04:00
Émile Ré
685ff91d74 Extract snapshot functions into snapshot.go
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 17:49:19 +04:00
Émile Ré
e21388fa0c Stop bumping cookie banner version on no-op updates
A central snapshot-equality guard in ensureDraftVersion now returns
the latest version unchanged when the candidate snapshot matches it,
so no-op admin saves no longer force visitors to re-consent. Per-
operation short-circuits in UpdateCookieBanner, UpdateCookieCategory,
UpdateCookiePattern, DeleteCookiePattern, MoveCookiePatternToCategory,
ReorderCookieCategory, and UpsertCookieBannerTranslation skip the row
update and version bump when nothing visitor-facing changes (excluded
patterns, identical values, identical translation JSON).

Rank is now treated as admin-only metadata: buildSnapshot sorts
categories by (Kind weight, ID byte order) instead of relying on the
implicit rank-driven slice order, and ReorderCookieCategory no longer
calls ensureDraftVersionForBanner. Default banners keep their
visitor-facing order (insertion order matches Kind+ID); banners with
admin-customised ranks see a one-time order shift to insertion order
on the next snapshot rebuild.

Reusable equality helpers (Ptr generic + JSON canonicalisation) move
to a new pkg/equal package; snapshotsEqual stays in service.go as the
documented chokepoint for visitor-identical snapshot comparison.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 17:42:06 +04:00
Émile Ré
71cad5f15e Allow clearing optional fields in n8n cookie updates
The previous fix prevented unintentional clearing of
`privacyPolicyUrl` and `maxAgeSeconds` by skipping the field
when its value was falsy, but this also removed the user's
ability to explicitly clear an existing value.

Move both fields into an `Additional Fields` collection so we
can distinguish between "not provided" (skip) and "provided
empty" (clear), matching the existing pattern in
`vendor/update.operation.ts`.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-02 15:35:20 +04:00
Émile Ré
1650b26fa9 Fix destructive update behavior in n8n cookie operations
Avoid clearing existing values when optional fields are left at their
defaults: only send privacyPolicyUrl/maxAgeSeconds when truthy, filter
empty entries from gcmConsentTypes, and constrain consentExpiryDays to
positive integers on create.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 20:11:37 +04:00
Émile Ré
1996545125 Add excluded field to cookie pattern operations
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 17:59:11 +04:00
Émile Ré
6f849b36a1 Add cookie banner operations to n8n node
Adds four new resources (cookieBanner, cookieCategory,
cookiePattern, cookieConsentRecord) covering all mutations
and queries from the cookie banner GraphQL resolvers.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 17:56:23 +04:00
Émile Ré
1d08760d3b Display cookie pattern source badge in category table
Show the origin of each cookie pattern (Script vs Pre-existing)
as a badge with a tooltip in the cookies configuration table.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 17:41:50 +04:00
Émile Ré
bb7bc7c716 Add e2e tests for cookie pattern excluded field
Test that excluded defaults to false on create, can be set
to true via update, and can be toggled back to false.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:49:46 +04:00
Émile Ré
dd1d0ebffb Sync excluded field to MCP and CLI
Add excluded boolean to the MCP CookiePattern schema and
UpdateCookiePatternInput. Expose it in CLI cookie-pattern
view, list, and update commands.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:48:55 +04:00
Émile Ré
3ed61c6084 Add excluded field to cookie pattern GraphQL schema
Expose excluded on the CookiePattern type and accept it as
an optional input on UpdateCookiePatternInput so the console
can toggle pattern exclusion inline.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:39:33 +04:00
Émile Ré
bfc0ded464 Exclude excluded patterns from merge and adoption
Filter excluded and non-exact patterns in SQL when loading
patterns for the pattern analysis worker. Both merge group
building and uncategorised adoption only see non-excluded
exact patterns, so excluded patterns are preserved as
punch-out overrides.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:39:33 +04:00
Émile Ré
dc3c2701ac Skip excluded patterns in detection and snapshots
In ReportDetectedCookies, silently skip cookies that match an
excluded pattern instead of recording them. Filter excluded
patterns in SQL when building version snapshots so they never
appear in the published banner config. Add Excluded field to
UpdateCookiePatternRequest.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:39:33 +04:00
Émile Ré
2192c854a0 Add excluded flag to cookie pattern model
Adds an `excluded` boolean column to the cookie_patterns table
so operators can mark patterns to be omitted from the consent
banner without deleting them. Includes the migration, struct
field, updated SQL queries, and filter support.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:39:32 +04:00
Émile Ré
8e5c586c95 Release v0.178.0 2026-05-01 16:34:57 +04:00
Émile Ré
e7c2118b7b Run gofmt on cookie-banner CLI commands
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 16:07:22 +04:00
Émile Ré
6d22d68acf Fix maxAgeSeconds type handling in cookie pattern factory
The inline int type assertion silently dropped int64 and float64
values already supported by Attrs.getInt.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:59:56 +04:00
Émile Ré
d133d5ba1d Fix PR review comments and rename versions to latest-version
- Validate __typename in all list command pagination callbacks
- Serialize PostHogConsent=false as explicit false (not nil)
- Fix maxAgeSeconds factory to only include when value is an int
- Rename cookie-banner versions to latest-version subcommand

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:38:43 +04:00
Émile Ré
08aaab1393 Add CLI commands for cookie banner, category, pattern, and consent records
Expose prb cookie-banner (10 subcommands), prb cookie-category (6),
prb cookie-pattern (6), and prb consent-record (2) with full CRUD,
lifecycle operations, pagination, and interactive prompts.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:19:21 +04:00
Émile Ré
7bc8343c18 Add MCP tools for cookie banner, category, pattern, version, and consent
Wire cookiebanner.Service into the MCP resolver and expose 24 tools
covering full CRUD, activation, versioning, translations, and consent
record queries with pagination and filtering support.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:19:21 +04:00
Émile Ré
c43f61d109 Fix e2e test assertions: uppercase state enums, non-default slug
The version state field returns uppercase enum values (DRAFT, PUBLISHED)
and "analytics" is a default category slug created with every banner.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:19:21 +04:00
Émile Ré
6532f16efc Add e2e tests for cookie banner console GraphQL API
Cover CRUD, activation, versioning, translations, categories, patterns,
RBAC, and tenant isolation with factory helpers for test data creation.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-05-01 15:19:21 +04:00
Cursor Agent
8c74a7bc93 Fix auditor processing activity access
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Émile Ré <nemile.re@gmail.com>
2026-05-01 15:18:23 +04:00
Cursor Agent
17b75f2017 Fix contract end date calendar cut off in dialog
The Add Person dialog wrapped its form content in a plain <div>
instead of DialogContent. When the form is tall enough, the
dialog extends beyond the viewport with no way to scroll,
cutting off the contract end date field.

Replace the raw <div> with DialogContent which provides
overflow-y-auto and a maxHeight constraint, matching the
pattern used by all other dialogs in the codebase.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Émile Ré <nemile.re@gmail.com>
2026-05-01 10:50:55 +00:00
Émile Ré
7648edd770 Release v0.177.1 2026-04-30 17:31:04 +04:00
Bryan Frimin
febf4a930e Treat OIDC and magic link sessions as password-equivalent when assuming an org
Users authenticated via Google/Microsoft OIDC or magic link previously
relied on a fall-through in the password-only org check. Make the rule
explicit so SSO-only users can access password-only organizations
without being bounced to the password login form they cannot satisfy.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-30 17:24:04 +04:00
Émile Ré
5f087b47b8 Reveal cookie banner in sidebar
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 17:21:37 +04:00
Émile Ré
54494fc9b1 Bump version to 0.1.1
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 17:11:39 +04:00
Émile Ré
42a6a2f8bd Show placeholders when no prior consent exists
The activate() method was only called when consent existed (from
cookie or API). When there was no prior consent, observeAndActivate()
never ran, so visual elements with data-cookie-consent were left
without placeholders. Build default consent data from the config's
consent_mode and always call activate() at the end of load().

Also consolidate activateElements/addPlaceholders into
observeAndActivate to avoid duplicate DOM traversals.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 17:10:35 +04:00
Émile Ré
15ff6131e1 Fix placeholder sizing for cookie-consent elements
Expand the dimensional property allowlist with padding, box-sizing,
and positioning properties (position, top, right, bottom, left,
inset) so placeholders match the size of absolutely or sticky
positioned elements. Fall back to getComputedStyle for height when
no explicit value is found from inline styles or HTML attributes.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 16:59:13 +04:00
Émile Ré
bd6abccb2d Upgrade esbuild to remove vulnerability
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 15:52:43 +04:00
Émile Ré
f0e6538943 Release v0.177.0
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 15:24:17 +04:00
Émile Ré
336ec986d5 Update @probo/cookie-banner public exports and bump to 0.1.0
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 15:14:19 +04:00
Émile Ré
22cf3a7643 Fix create dialog mutation relay store update
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 15:03:47 +04:00
Émile Ré
0d257977a1 Refactor cookie banner forms to react-hook-form
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 14:05:45 +04:00
Émile Ré
edcb5ba9c7 Add CookiePatternFilter to push adoption filtering to SQL
The adoptUncategorisedPatterns method loaded all patterns for a
banner then filtered in Go. This adds a CookiePatternFilter
(match_type + cookie_category_id) and wires it into
LoadAllByCookieBannerID so the two targeted loads only fetch
the rows they need.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 12:28:31 +04:00
Émile Ré
33abbfbb8f Link detected cookies to existing patterns on conflict
When a cookie pattern already exists for a banner, the insert
conflict caused a continue that silently dropped the detected
cookie instead of linking it to the existing pattern. Load the
existing pattern to obtain its ID and proceed with cookie
insertion.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:13 +04:00
Émile Ré
426066e078 Use CookieBanner entity directly in pattern analysis worker
Replace the ad-hoc patternAnalysisTask struct with coredata.CookieBanner
as the worker type parameter, matching the pattern used by other workers
(esign, accessreview). SQL methods move back to coredata on *CookieBanner.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:12 +04:00
Émile Ré
e5e1119883 Remove dead code from cookiebanner and coredata packages
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:12 +04:00
Émile Ré
6482361352 Fix aborted transaction on duplicate cookie pattern insert
Use InsertIfNotExists instead of Insert with error check, since
a unique-violation aborts the PostgreSQL transaction even when caught.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:12 +04:00
Émile Ré
427bbbaf5c Move DurationInput to @probo/ui and scope pattern merge by category
Move the DurationInput component from the console app into @probo/ui
for reuse, add duration formatting helpers to @probo/helpers, and
update pattern merge to group by both category ID and prefix.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:12 +04:00
Émile Ré
2fe77d9ddc Fix review issues in cookie pattern handling
- Fix DurationInput fallback unit from "minutes" to "seconds" and add
  seconds as a selectable unit to prevent silent duration inflation
- Use parseFloat instead of parseInt for duration input to preserve
  fractional values
- Scope prefix merge groups by category ID to prevent cross-category
  merging
- Relink cookies and delete exact patterns even when prefix pattern
  already exists
- Prefer exact matches and longest prefix in pattern selection query
- Fix wrong error type in GetCookiePattern (ErrCookiePatternNotFound)
- Handle singular/plural in humanizeSeconds fallback branch

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:11 +04:00
Émile Ré
5cdaddf8b1 Store cookie durations as max_age_seconds
Replace the free-form duration TEXT column with a nullable
max_age_seconds INTEGER on both cookies and cookie_patterns
tables. The SDK detector now sends raw seconds instead of
humanized strings, eliminating locale-dependent comparisons
in the pattern merge worker. Humanization happens at display
time in the widget and console UI.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:11 +04:00
Émile Ré
b8ff3c66e1 Improve cookie pattern merge with longest prefix
The previous algorithm split on the first separator only, producing
overly broad prefixes (e.g. ph_ for ph_phc_abc123). Replace with a
greedy longest-shared-prefix approach that finds the longest
separator-boundary prefix shared by 3+ exact patterns, avoiding
false merges across unrelated cookie families.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:11 +04:00
Émile Ré
94ccc71357 Switch console cookies page to cookie patterns
The console now manages CookiePattern entities instead of raw
Cookie rows. The frontend queries cookiePatterns on each category
and uses createCookiePattern, updateCookiePattern,
deleteCookiePattern, and moveCookiePatternToCategory mutations.

The entire Cookie GraphQL surface (type, connection, mutations,
inputs, payloads, resolvers, Go types) is removed since the
backing struct already lost description and cookieCategoryID.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:11 +04:00
Émile Ré
22fd103795 Backfill pattern analysis flag on existing banners
Set pattern_analysis_requested_at on all existing banners so the worker
runs once per banner on release and merges any existing prefix groups.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-30 11:46:11 +04:00