Detect the signature by Mailsuite's own markers, fix a partial-deletion bug - #6
Merged
Merged
Conversation
Read gmail.end.bundle.js out of the installed extension (12.87.0). Mailsuite
labels its signature, so all the inference was unnecessary. Every one of the
seven templates renders:
<div id="mt-signature" contenteditable="false" g_editable="false">
<table data-signature-template="senderNotified" data-signature-version="N">
Detection is now that selector, plus the mt-signature / mt-old-signature class
variants, taking only the outermost match since mt-signature-logo sits inside
the wrapper and matches the same selector. The promo-link heuristic stays as a
fallback for markup carrying no marker.
This fixes a bug that made the extension worse than useless on real mail. The
signature contains a 24x20 logo served from s3.amazonaws.com, and the image
guard added in #4 treats a non-beacon image as a sign the block belongs to the
user. Against the real markup the climb stopped at the row holding the logo, so
the inner cell was deleted and the wrapper, the table and the logo were left
sitting in the message. Measured before the fix:
logo img present: false -> removed: 1 | signature gone: true
logo img present: true -> removed: 1 | signature gone: false
The guard was right for the fallback path and wrong for the marked path. Marked
blocks are Mailsuite's by their own admission, so the image inside is theirs
too. The guard now only applies to the heuristic.
Six new tests built from transcribed real markup, covering every live signature
version, the logo going while a user's inline image beside it stays, a beacon
inside the block surviving, and outermost-only selection.
15 tests, all passing.
Closes #1
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013rTepGiDUe15iPn6XqmKjy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
Read
gmail.end.bundle.jsout of the installed extension, 12.87.0. The answerto #1 turns out to be that there was never anything to infer: Mailsuite labels
its own signature.
What it actually renders
All seven templates in the bundle share a wrapper:
data-signature-templateappears 8 times, alwayssenderNotified. The id comesfrom a single constant,
tC = "mt-signature", used by all 7 builders. Sodetection is now a selector:
Outermost match only, since
mt-signature-logois a child and matches the sameselector. The promo-link heuristic stays as a fallback for markup with no
marker.
The bug this fixes
The extension was worse than useless against real mail, and the tests said it
was fine because every fixture was written from the same guesses as the code.
The real signature contains a 24x20 logo from
s3.amazonaws.com/mailtrack-signature/logo-grey.png. The image guard added in#4 treats any non-beacon image as evidence the block belongs to the user. So the
climb stopped at the row holding the logo, deleted the inner cell, and left the
wrapper, the table and the logo sitting in the message.
Measured against real markup before the fix:
A returned count of 1 with the signature still on screen. Partial deletion is a
worse outcome than doing nothing, and the counter in the popup would have
cheerfully claimed success.
The guard was right for the fallback and wrong for the marked path. A marked
block is Mailsuite's by their own admission, so the image inside it is theirs
too. The guard now applies only to the heuristic, where the over-matching risk
actually lives.
Also confirmed from the bundle
https://(sub.)?(mailtrack|mailsuite).<tld>/trace/mail/<40 hex>.png,matching what
looksLikeBeacon()already rescued.s3.amazonaws.com/mailtrack-signature/, a differenthost, so they are correctly not mistaken for beacons and go with the block.
mt-old-signatureexists as a legacy variant, now covered.mt-remove-signaturecontrol rendered inside the signatureitself, which is more evidence for Prefer Mailsuite's own opt-out over deleting DOM #3.
Tests
15, up from 11. Six new, from transcribed real markup:
cid:image beside it staysmarkedBlocks()returns outermost onlyStill not verified
Nobody has loaded this into Chrome against live Gmail. The compose-body and
Send-button selectors remain inference. The signature itself is now settled.