Skip to content

feat(tokowaka-client): complete async covered-marking migration#1709

Open
khushboo5723 wants to merge 4 commits into
mainfrom
feat/LLMO-5003-async-covered-marking-shared-v2
Open

feat(tokowaka-client): complete async covered-marking migration#1709
khushboo5723 wants to merge 4 commits into
mainfrom
feat/LLMO-5003-async-covered-marking-shared-v2

Conversation

@khushboo5723

@khushboo5723 khushboo5723 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • remove synchronous covered-marking from TokowakaClient.deployToEdge() so pattern/domain-wide deploy no longer marks related suggestions during the API request
  • remove now-dead filterBatchCoveredSuggestions helper from suggestion-utils (and matcher import) after worker ownership moved async
  • keep pattern allowList/metaconfig deployment and per-URL deploy behavior intact

Downstream impact

  • deployToEdge() now returns coveredSuggestions as empty in this sync path
  • downstream callers that read coveredSuggestions/coveredSuggestionsCount should treat covered-marking as async worker-owned state

Test plan

  • npx mocha packages/spacecat-shared-tokowaka-client/test/utils/suggestion-utils.test.js packages/spacecat-shared-tokowaka-client/test/index.test.js --grep "deployToEdge|domain-wide|coveredSuggestions|same-batch|Suggestion Utils|saveSuggestions"
  • pre-commit eslint hook

Complete the async covered-marking migration by removing in-request covered suggestion updates from deployToEdge. Keep pattern and per-URL deployment behavior intact while updating tests to assert covered marking is handled by the worker path.

Co-authored-by: Cursor <cursoragent@cursor.com>
@khushboo5723 khushboo5723 requested a review from MysticatBot June 23, 2026 15:33

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @khushboo5723,

⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.

Verdict: Request changes - dead code left behind breaks CI coverage, and the semantic contract change needs proper semver signaling.
Complexity: MEDIUM - medium diff, single-service refactor.
Changes: Removes synchronous covered-marking logic from deployToEdge(), deferring that responsibility to an async worker (2 files).

Note: CI checks are currently failing - resolve before merge.

Must fix before merge

  1. [Important] Dead filterBatchCoveredSuggestions function in suggestion-utils.js breaks 100% coverage threshold - src/utils/suggestion-utils.js (details inline)
  2. [Important] Semantic contract change (coveredSuggestions now always []) uses refactor: prefix instead of feat: or feat!: - callers won't be signaled - src/index.js (details inline)
Non-blocking (2): minor issues and suggestions
  • nit: Tests still pass allSuggestions to deployToEdge despite parameter removal from signature - misleading for future readers - test/index.test.js (multiple locations)
  • suggestion: JSDoc @returns still documents coveredSuggestions as meaningful output - mark as deprecated or always-empty - src/index.js

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 3m 59s | Cost: $6.10 | Commit: f087e17fa273054673a9909a9b9bc6aabd633273
If this code review was useful, please react with 👍. Otherwise, react with 👎.

groupSuggestionsByUrlPath,
filterEligibleSuggestions,
saveSuggestions,
stripSuggestion,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (blocking): This PR removes all callers of filterBatchCoveredSuggestions (imported here until this change) but leaves the function itself in src/utils/suggestion-utils.js. That dead code drops line coverage below the 100% threshold enforced by .nycrc.json, which is why CI fails.

Why it matters: CI is red and the PR cannot merge.

How to fix: Remove filterBatchCoveredSuggestions from suggestion-utils.js and its buildUrlMatcher import from pattern-utils.js (also now unused in that file). If any external consumer needs filterBatchCoveredSuggestions, the async worker that now owns covered-marking should own the function.

@@ -1611,12 +1539,11 @@ class TokowakaClient {
const { patternSuggestions, validSuggestions: classified } = classifySuggestions(targetSuggestions, this.log);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (blocking): deployToEdge() now always returns coveredSuggestions: [] - a behavioral contract change for callers that read this field (e.g. spacecat-api-service logging coveredSuggestionsCount). The commit prefix refactor() maps to a patch bump under semantic-release, but this is a feature removal that changes observable output.

Why it matters: Downstream callers won't see a minor/major bump and won't know to adapt. Silent behavioral changes that look like patches are the hardest to debug.

How to fix: Use feat(tokowaka-client): (minor bump) or feat!: / BREAKING CHANGE: footer if the team considers this breaking. Add a note in the body about downstream caller impact.

@MysticatBot MysticatBot added ai-reviewed Reviewed by AI complexity:medium AI-assessed PR complexity: MEDIUM labels Jun 23, 2026
…nc migration

Drop the now-unused filterBatchCoveredSuggestions utility and its matcher import after covered marking moved to the worker path. This keeps package coverage green and aligns shared-client behavior with the new async covered-marking contract (coveredSuggestions is no longer populated in deployToEdge).

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

This PR will trigger a minor release when merged.

@khushboo5723 khushboo5723 changed the title refactor(tokowaka-client): remove sync covered-marking from deployToEdge feat(tokowaka-client): complete async covered-marking migration Jun 24, 2026
@khushboo5723 khushboo5723 requested a review from MysticatBot June 24, 2026 10:50

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @khushboo5723,

⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.

Verdict: Approve - clean removal of synchronous covered-marking with no blocking issues; prior findings resolved.
Complexity: MEDIUM - medium diff, single-service refactor.
Changes: Removes synchronous covered-marking logic from deployToEdge() and rollback, deleting helper functions and deferring that responsibility to an async worker (3 files).

Non-blocking (4): minor issues and suggestions
  • nit: Stale JSDoc on coveredSuggestions return field still says "suggestion entities auto-marked via domain-wide patterns" but the array is now always empty - src/index.js:~1505
  • nit: Dead allSuggestions parameter still accepted and logged by rollbackSuggestions after this PR removed its only consumer - src/index.js:~898
  • suggestion: Vestigial const validSuggestions = classified; alias could be collapsed into the destructuring directly since the filtering step was removed - src/index.js:~1523
  • nit: Tests still pass allSuggestions to deployToEdge which no longer destructures it, making tests misleading for future readers - test/index.test.js (multiple locations)

Previously flagged, now resolved

  • Dead filterBatchCoveredSuggestions function removed from suggestion-utils.js
  • Commit prefix updated to feat(tokowaka-client): triggering correct minor bump

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 28s | Cost: $5.66 | Commit: b26d43019375fa2a3cd6933cd829b196d4df3b2c
If this code review was useful, please react with 👍. Otherwise, react with 👎.

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

Labels

ai-reviewed Reviewed by AI complexity:medium AI-assessed PR complexity: MEDIUM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants