Skip to content

feat: flagProfanity for image + video, fix analyze() forwarding - #35

Merged
safenestdev merged 4 commits into
mainfrom
feat/image-flag-profanity
Aug 26, 2026
Merged

feat: flagProfanity for image + video, fix analyze() forwarding#35
safenestdev merged 4 commits into
mainfrom
feat/image-flag-profanity

Conversation

@safenestdev

@safenestdev safenestdev commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Three changes stacked on this branch, all part of the same flagProfanity feature line:

  1. flagProfanity on analyzeImage, profanity on ImageAnalysisResult (2.28.0, already published to npm) — matches Tuteliq/api#123 (merged, deployed).

  2. flagProfanity now forwarded through analyze() (2.29.0, client-reported) — same class of gap verdictOnly had in 2.19, fixed in 2.20: AnalyzeInput accepted flagProfanity but analyze() never passed it to the detectBullying/detectUnsafe calls it fans out to.

  3. categories + flagProfanity on analyzeVideo (2.30.0) — matches Tuteliq/api#125. categories was computed server-side but never exposed as its own field. flagProfanity extends the same word-list check already shipped on images to video.

All three versions bumped, CHANGELOG updated. Not published to npm from here — 2.28.0/2.29.0 were already published directly from local builds; 2.30.0 is a manual step afterward.

Test plan

  • tsc --noEmit clean
  • npm run build clean
  • tests/flagProfanity.test.ts: image + video flag_profanity forwarding (multipart FormData assertions) and profanity field passthrough; analyze() forwarding to both detectors + result.bullying/unsafe.profanity passthrough
  • Full suite: 7 files, 127 tests passing

…on_capped

The API added options.flag_profanity (free, deterministic, additive word-list
flag -- never affects is_bullying/unsafe/severity/risk_score/recommended_action)
and an account-level default_flag_profanity setting, plus escalation_capped on
the coded-term corroboration cap, but neither reached this SDK's types or
request body. A customer testing default_flag_profanity through the SDK had
no typed way to override it per-request and no `profanity` field on the
result, even though the API already supported both.

- DetectBullyingInput.flagProfanity / DetectUnsafeInput.flagProfanity: new
  input properties, wired to options.flag_profanity in the request body.
  Explicit true AND false both reach the API (not just truthy true) -- an
  explicit false has to override the account default, same precedence the
  API itself uses.
- BullyingResult.profanity / UnsafeResult.profanity: new response field,
  { detected, matches } | null.
- BullyingResult.escalation_capped / escalation_capped_reason and the same
  on UnsafeResult: existed on the API since PR #117, never added here.

Not yet forwarded through the combined analyze() method (client-side fan-out
to detectBullying/detectUnsafe) -- only the two direct detection methods.

8 new tests asserting on the actual request body sent to fetch (mirrors
verdictOnlyIncludeEvidence.test.ts's pattern), not just the TS types.
115/115 tests passing, clean build. Version bump: 2.26.0 -> 2.27.0.
Extends the flagProfanity/profanity pair from 2.27.0 (detectBullying/
detectUnsafe) to analyzeImage, matching the API's new options.flag_profanity
support on the image OCR text. Video was evaluated and left out -- the API
has no OCR/text-extraction path on video to attach it to.
Same gap verdictOnly had in 2.19, fixed in 2.20 -- AnalyzeInput accepted
flagProfanity but analyze() never passed it to the detectBullying/
detectUnsafe calls it fans out to. Didn't block anyone since the account
default still applied, but per-request override wasn't reachable through
the combined method.
categories was already computed server-side but only folded into the
free-text rationale string -- no field existed to read it from.

flagProfanity closes the evasion path left open by shipping profanity on
analyzeImage alone: burning the same text into a video frame instead of a
still previously never reached the word-list check. The API already OCRs
text per frame for video (same vision call as image), it just wasn't
aggregated or checked.
@safenestdev safenestdev changed the title feat: add flagProfanity to analyzeImage; fix analyze() forwarding, bump to 2.29.0 feat: flagProfanity for image + video, fix analyze() forwarding Aug 26, 2026
@safenestdev
safenestdev merged commit 2186850 into main Aug 26, 2026
6 checks passed
@safenestdev
safenestdev deleted the feat/image-flag-profanity branch August 26, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant