Skip to content

MWPW-199041: bulk-edit find IO action#987

Open
yesil wants to merge 41 commits into
mainfrom
MWPW-199041
Open

MWPW-199041: bulk-edit find IO action#987
yesil wants to merge 41 commits into
mainfrom
MWPW-199041

Conversation

@yesil

@yesil yesil commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the bulk-edit-find Adobe I/O Runtime API — the Find stage of M@S bulk Find & Replace. Studio (MWPW-191300) and operators can start a cross-fragment text search, poll job progress, download match exports (JSON + CSV), upload an edited CSV subset, and remove the upload to restore full results. Replace lands separately in MWPW-199042 / PR #999.

Search targets card and collection fragments only — dictionary entries are excluded.

Two-stage search: Odin CF Search API does recall (path + fullText + optional tags/status, cursor-paged via fetchOdin), then the find worker does precision matching via SCOPE_FIELDS. * scans scoped fields only (not arbitrary CF fields). Fragment title is searchable (fragmentTitle scope or *); fragment name is never matched.

API

Base URL: https://14257-masstudio-yesil.adobeioruntime.net/api/v1/web/MerchAtScaleStudio/bulk-edit-find

Auth: Authorization: Bearer <mas-studio IMS token> (see io/studio/.envMAS_TOKEN)

Method Path / body Purpose
POST JSON { find, surface, … } Start or reuse an async find job → 202 { jobId, reused }
GET ?jobId= Poll progress; when exportReady, body includes presigned exports.json + exports.csv URLs
POST ?jobId= + CSV body (multipart or text/csv) Upload edited CSV; filters exports to uploaded rows
DELETE ?jobId= Remove uploaded CSV; restore full exports

POST find parameters

  • Required: find, surface
  • Optional: searchIn (* default, or prices, ctas, calloutText, productDescription, promoText, subtitle, fragmentDescription, fragmentTitle, tags, or array of scopes), locale (string or array), tags, status, matchCase, forceRefresh, supersedes (cancels a prior RUNNING job)

GET poll response

{
  "jobId": "abc…",
  "type": "find",
  "status": "DONE",
  "done": true,
  "total": 42,
  "report": { "total": 42, "byLocale": { "en_US": 30, "fr_FR": 12 } },
  "filteredByUpload": false,
  "exportReady": true,
  "exports": {
    "json": "https://…presigned…",
    "csv": "https://…presigned…"
  }
}

Result rows are not inline in the poll body — follow the presigned exports URLs (no IMS auth on redirect). .json / .csv suffixes on jobId return 400.

CSV upload rows match by (fragment_id, field, find) with scope/field aliases (e.g. productDescriptioncardTitle). Omitted rows are excluded from exports until upload is removed.

Architecture

  • bulk-edit-find — web action: auth, job lifecycle, poll/upload/delete, export regeneration
  • bulk-edit-find-worker — async worker (60 min timeout): Odin search + findMatches, writes exports on completion
  • export.js — Adobe I/O Files presigned JSON/CSV exports (24 h URLs)
  • Job id — SHA-256 of canonical search params (stable dedup / cache reuse)
  • I/O State — RUNNING jobs TTL 30 min; completed jobs, results, uploads, reports cached 7 days (refreshed on terminal poll)
  • Cooperative cancelsupersedes + forceRefresh cancel an in-flight RUNNING job before re-run; forceRefresh also clears uploads and exports

Local tooling

  • io/studio/requests.http — REST Client examples
  • io/studio/src/bulk-edit/README.md — API reference
  • scripts/content/bulk-edit-find.mjs — run find in-process against I/O State

Out of scope

Resolves https://jira.corp.adobe.com/browse/MWPW-199041

QA Checklist: https://wiki.corp.adobe.com/display/adobedotcom/M@S+Engineering+QA+Use+Cases

  • C1. Cover code with unit tests (150 bulk-edit tests in io/studio; npm test -- --grep bulk-edit)
  • C2. Add a Nala test (N/A — backend IO action, no rendered surface)
  • C3. Verify all Checks are green (unit tests)
  • C4. PR description contains working Test Page link (N/A — backend IO action; manual via endpoint below / requests.http)
  • C5. Ready to demo from Test Page (blocked on Studio UI — API ready for integration)
  • C.6 Re-read Jira to validate all ACs addressed

Test plan

Endpoint: https://14257-masstudio-yesil.adobeioruntime.net/api/v1/web/MerchAtScaleStudio/bulk-edit-find

Use io/studio/requests.http or curl with MAS_TOKEN from io/studio/.env.

  • Start findPOST with { "surface": "sandbox", "find": "firefly", "searchIn": "*", "matchCase": false }202 { jobId, reused }
  • PollGET ?jobId=<jobId> until done: true and exportReady: true; confirm exports.json / exports.csv presigned URLs and per-locale report
  • Download exports — follow presigned URLs (no Bearer token); confirm JSON fragments + CSV rows; title hits use Odin field names (e.g. cardTitle, fragmentTitle)
  • CSV upload — edit CSV, POST ?jobId=<jobId> (multipart) → poll shows filteredByUpload: true and reduced total
  • CSV deleteDELETE ?jobId=<jobId>filteredByUpload: false, full total restored
  • Cache reuse — repeat same POST find params → reused: true; add "forceRefresh": true → worker re-runs, uploads/exports cleared
  • Filters — locale, searchIn, tags, status, matchCase (see requests.http)

Test URLs

Bulk-edit find API (yesil workspace): https://14257-masstudio-yesil.adobeioruntime.net/api/v1/web/MerchAtScaleStudio/bulk-edit-find

Requires Authorization: Bearer <mas-studio IMS token>. No rendered test page — exercise via REST Client (io/studio/requests.http) or curl.

@yesil yesil added the run nala label Jun 18, 2026
@aem-code-sync

aem-code-sync Bot commented Jun 18, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@github-actions

Copy link
Copy Markdown

SNOW Change Request Transaction ID [IO]: 0000019c1eec85a3-13f8a5e2

@yesil yesil changed the title MWPW-199041: Add find-replace-search IO action DO NOT REVIEW: MWPW-199041: Add find-replace-search IO action Jun 18, 2026
@yesil yesil marked this pull request as draft June 18, 2026 09:37
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.28713% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.95%. Comparing base (6261ea6) to head (dda4e3e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
io/studio/src/bulk-edit/bulk-edit.js 95.52% 23 Missing ⚠️
io/studio/src/bulk-edit/state.js 90.84% 14 Missing ⚠️
io/studio/src/bulk-edit/csv.js 97.17% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #987      +/-   ##
==========================================
+ Coverage   89.59%   89.95%   +0.36%     
==========================================
  Files         273      282       +9     
  Lines       84441    88978    +4537     
==========================================
+ Hits        75653    80042    +4389     
- Misses       8788     8936     +148     
Files with missing lines Coverage Δ
io/studio/src/bulk-edit/find-worker.js 100.00% <100.00%> (ø)
io/studio/src/bulk-edit/search.js 100.00% <100.00%> (ø)
io/studio/src/bulk-edit/csv.js 97.17% <97.17%> (ø)
io/studio/src/bulk-edit/state.js 90.84% <90.84%> (ø)
io/studio/src/bulk-edit/bulk-edit.js 95.52% <95.52%> (ø)

... and 25 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6261ea6...dda4e3e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yesil yesil changed the title DO NOT REVIEW: MWPW-199041: Add find-replace-search IO action DO NOT REVIEW: MWPW-199041: Add find-replace IO action Jun 18, 2026
@yesil yesil changed the title DO NOT REVIEW: MWPW-199041: Add find-replace IO action MWPW-199041: Add find-replace IO action Jun 19, 2026
@yesil yesil changed the title MWPW-199041: Add find-replace IO action MWPW-199041: bulk-edit find IO action Jun 19, 2026
@yesil yesil marked this pull request as ready for review June 19, 2026 15:57

@Axelcureno Axelcureno left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice! runId cancel and CSV formula escaping are clean.

two things:

  • search.js has fragmentTitle in SCOPE_FIELDS and matchEverywhere returns title hits — but PR description says title is excluded. stale or accidental?
  • patchJob is non-atomic but fine since workers are sequential. tiny race on force-refresh self-heals via runId mismatch. nbd.

Cards/collections-only search, scoped field matching, CSV upload alias
matching, presigned exports, 7-day cache, and find-worker finalization.
Replace stays on MWPW-199042.

Co-authored-by: Cursor <cursoragent@cursor.com>
Require replace on find POST, drop replace from CSV export/upload, and
align export pipeline, docs, and tests. Replace execution stays on 199042.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants