feat(tokowaka-client): complete async covered-marking migration#1709
feat(tokowaka-client): complete async covered-marking migration#1709khushboo5723 wants to merge 4 commits into
Conversation
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>
There was a problem hiding this comment.
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
- [Important] Dead
filterBatchCoveredSuggestionsfunction in suggestion-utils.js breaks 100% coverage threshold -src/utils/suggestion-utils.js(details inline) - [Important] Semantic contract change (
coveredSuggestionsnow always[]) usesrefactor:prefix instead offeat:orfeat!:- callers won't be signaled -src/index.js(details inline)
Non-blocking (2): minor issues and suggestions
- nit: Tests still pass
allSuggestionstodeployToEdgedespite parameter removal from signature - misleading for future readers -test/index.test.js(multiple locations) - suggestion: JSDoc
@returnsstill documentscoveredSuggestionsas 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, |
There was a problem hiding this comment.
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); | |||
There was a problem hiding this comment.
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.
…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>
|
This PR will trigger a minor release when merged. |
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
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
coveredSuggestionsreturn field still says "suggestion entities auto-marked via domain-wide patterns" but the array is now always empty -src/index.js:~1505 - nit: Dead
allSuggestionsparameter still accepted and logged byrollbackSuggestionsafter 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
allSuggestionstodeployToEdgewhich no longer destructures it, making tests misleading for future readers -test/index.test.js(multiple locations)
Previously flagged, now resolved
- Dead
filterBatchCoveredSuggestionsfunction 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 👎.
Summary
TokowakaClient.deployToEdge()so pattern/domain-wide deploy no longer marks related suggestions during the API requestfilterBatchCoveredSuggestionshelper fromsuggestion-utils(and matcher import) after worker ownership moved asyncDownstream impact
deployToEdge()now returnscoveredSuggestionsas empty in this sync pathcoveredSuggestions/coveredSuggestionsCountshould treat covered-marking as async worker-owned stateTest 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"eslinthook