Skip to content

feat(audit-url): add URL store data model and data access#1211

Merged
HollywoodTonight merged 21 commits intomainfrom
urlStore_Tud_v2
Dec 8, 2025
Merged

feat(audit-url): add URL store data model and data access#1211
HollywoodTonight merged 21 commits intomainfrom
urlStore_Tud_v2

Conversation

@HollywoodTonight
Copy link
Contributor

Add AuditUrl entity to provide URL store functionality for tracking and managing URLs to be audited.

Features:

  • Composite primary key: siteId + url (unique per site)
  • byCustomer boolean flag to distinguish customer-added vs system-added URLs
  • audits field as set type for efficient querying
  • GSI for filtering by siteId and byCustomer

Data Access Methods:

  • allBySiteId: Get all URLs for a site (with pagination/sorting)
  • allBySiteIdByCustomer: Filter by byCustomer flag
  • allBySiteIdAndAuditType: Get URLs with specific audit enabled
  • findBySiteIdAndUrl: Get specific URL by composite key
  • removeForSiteIdByCustomer: Bulk delete by customer flag

Model Methods:

  • isAuditEnabled/enableAudit/disableAudit: Manage audit types
  • isCustomerUrl: Check if URL was customer-provided

Includes:

  • Full TypeScript definitions
  • Unit tests for model and collection
  • Integration tests

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Related Issues

Thanks for contributing!

Add AuditUrl entity to provide URL store functionality for tracking and
managing URLs to be audited.

Features:
- Composite primary key: siteId + url (unique per site)
- byCustomer boolean flag to distinguish customer-added vs system-added URLs
- audits field as set type for efficient querying
- GSI for filtering by siteId and byCustomer

Data Access Methods:
- allBySiteId: Get all URLs for a site (with pagination/sorting)
- allBySiteIdByCustomer: Filter by byCustomer flag
- allBySiteIdAndAuditType: Get URLs with specific audit enabled
- findBySiteIdAndUrl: Get specific URL by composite key
- removeForSiteIdByCustomer: Bulk delete by customer flag

Model Methods:
- isAuditEnabled/enableAudit/disableAudit: Manage audit types
- isCustomerUrl: Check if URL was customer-provided

Includes:
- Full TypeScript definitions
- Unit tests for model and collection
- Integration tests
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

This PR will trigger a minor release when merged.

- Remove composite primary key (siteId + url) in favor of standard auditUrlId
- Use GSI for siteId + url lookups via findBySiteIdAndUrl
- Revert removeForSiteId and removeForSiteIdByCustomer to use removeByIds
- Add getAuditUrlId() to TypeScript definitions
- Update tests for allBySiteIdAndByCustomer method name
- allBySiteIdByCustomerSorted now uses allBySiteId + filter
- removeForSiteIdByCustomer now uses allBySiteId + filter
- The accessor utility's hasText validation fails for boolean false
- Update test expectations for audit type count
- Update tests to stub allBySiteId instead of allBySiteIdAndByCustomer
- Add comprehensive tests for removeForSiteIdByCustomer filtering
- Add c8 ignore for defensive numeric comparison code in sortAuditUrls
HollywoodTonight and others added 9 commits December 4, 2025 08:24
- Use siteId + url as unique composite key for AuditUrl entities
- Update schema to use auditUrlId derived from siteId and url
- Update collection methods for composite key lookups
- Update integration and unit tests
- Add generateCompositeKeys() override in AuditUrl model
- Update Patcher to use schema's primary index keys for patch operations
- Add unit tests for generateCompositeKeys method
Please ensure your pull request adheres to the following guidelines:
- [ ] make sure to link the related issues in this description
- [ ] when merging / squashing, make sure the fixed issue references are
visible in the commits, for easy compilation of release notes

## Related Issues


Thanks for contributing!
Following patch was created with the test data:

```
{
  "url": "https://www.adobe.com/products/firefly.html",
  "version": "1.0",
  "forceFail": false,
  "prerender": true,
  "patches": [
    {
      "opportunityId": "7a663e47-e132-4bba-954a-26419e0541b8",
      "suggestionId": "ee8fc5e8-29c1-4894-9391-efc10b8a5f5c",
      "prerenderRequired": true,
      "lastUpdated": 1764683693803,
      "op": "insertAfter",
      "selector": "#create-with-multiple-top-ai-models-all-in-one-place",
      "value": "Blah Blah some text",
      "valueFormat": "text",
      "target": "ai-bots"
    }
  ]
}
```
Please ensure your pull request adheres to the following guidelines:
- [ ] make sure to link the related issues in this description
- [ ] when merging / squashing, make sure the fixed issue references are
visible in the commits, for easy compilation of release notes

## Related Issues


Thanks for contributing!
Copy link
Contributor

@iuliag iuliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending in a partial review with the most pressing points.

…d consistent pagination

- Add GSI bySiteIdAndByCustomer for efficient querying by customer flag
- Add boolean type support in accessor.utils.js validation
- Add FilterExpression (where clause) support in base collection
- Use FilterExpression for auditType filtering (reduces network transfer)
- Return consistent { data, cursor } format matching base collection
- Remove deprecated tag from findBySiteIdAndUrl (new feature)
- Update tests for new implementations
…2sk)

SchemaBuilder auto-generates GSI names, not custom names.
Also add test coverage for where clause (FilterExpression) in base collection.
@HollywoodTonight HollywoodTonight merged commit a7e458e into main Dec 8, 2025
7 checks passed
@HollywoodTonight HollywoodTonight deleted the urlStore_Tud_v2 branch December 8, 2025 06:47
solaris007 pushed a commit that referenced this pull request Dec 8, 2025
# [@adobe/spacecat-shared-athena-client-v1.9.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-athena-client-v1.8.4...@adobe/spacecat-shared-athena-client-v1.9.0) (2025-12-08)

### Features

* **audit-url:** add URL store data model and data access ([#1211](#1211)) ([a7e458e](a7e458e))
@solaris007
Copy link
Member

🎉 This PR is included in version @adobe/spacecat-shared-athena-client-v1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

solaris007 pushed a commit that referenced this pull request Dec 8, 2025
# [@adobe/spacecat-shared-data-access-v2.89.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.88.9...@adobe/spacecat-shared-data-access-v2.89.0) (2025-12-08)

### Features

* **audit-url:** add URL store data model and data access ([#1211](#1211)) ([a7e458e](a7e458e))
@solaris007
Copy link
Member

🎉 This PR is included in version @adobe/spacecat-shared-data-access-v2.89.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants