Repository navigation
Conversation
|
Claude finished @intelpljanot's task in 29s —— View job Verdict: needs changes
|
cepera
left a comment
There was a problem hiding this comment.
thanks for the fix!
it looks like the commit is missing Signed-off-by. Since the change is based on the patch from #99, I think it'd fair to add it's author to Co-authored-by:.
I also agree with the @sys-aibot review. I verified points 1–5 on a live cluster.
nothing currently checks the stored etag. The e2e upload tests pass with or without this fix, because ingestion succeeds either way. Please add an e2e check in src/tests/e2e/validation/test_edp.py
| # For simplicity, we use available md5 provided by seaweedfs as a tag | ||
| new_entry = event.message.new_entry | ||
| attributes = new_entry.get('attributes', {}) | ||
| extended = new_entry.get('extended', {}) |
There was a problem hiding this comment.
The {} default only covers a missing key. If the payload has "extended": null, then .get() returns None which will lead to an AttributeError. new_entry.get('extended') or {} covers both cases, as in the fix.patch attached to #99.
| except Exception: | ||
| etag = attributes.get('md5', '') |
There was a problem hiding this comment.
please log a warning with the raw header value instead of as silent re-ingestions
| except Exception: | ||
| etag = attributes.get('md5', '') | ||
| else: | ||
| etag = attributes.get('md5', '') |
There was a problem hiding this comment.
in general we have 2 fallbacks now. Maybe it'd be simpler to move etag logic into a helper func similr to
def _seaweedfs_etag(entry: dict) -> str:
header = (entry.get('extended') or {}).get('Seaweed-X-Amz-ETag')
if header:
try:
return base64.b64decode(header).decode('ascii').strip('"')
except (binascii.Error, UnicodeDecodeError) as e:
logger.warning(f"Cannot decode Seaweed-X-Amz-ETag {header!r}: {e}")
md5 = (entry.get('attributes') or {}).get('md5')
if md5:
try:
return base64.b64decode(md5).hex()
except binascii.Error as e:
logger.warning(f"Cannot decode md5 {md5!r}: {e}")
return ''a7f0b95 to
98fbd00
Compare
|
Thanks for verifying this on a live cluster, @cepera. I addressed the review in 98fbd00. The ETag helper handles null metadata, logs malformed header and MD5 values, and converts the fallback MD5 digest from base64 to hex. It preserves multipart ETag suffixes. The upload e2e test now compares the stored ETag returned by the file API with the ETag returned by the S3 PUT. I replaced the unsigned commit with a signed-off commit and added a co-author trailer for @alexatosatos's patch in #99. Six local ETag behavior checks, Python syntax checks, and |
|
@cepera I've addressed the review feedback and added the requested tests. Could you take another look when you have a moment? Thanks. |
Decode the S3-compatible ETag from SeaweedFS webhook metadata and fall back to hex-encoding the raw MD5 digest. Handle null metadata and log malformed values before falling back. Check that the ETag stored by EDP matches the one returned by S3 after a presigned upload. Fixes intel#99 Co-authored-by: alexatosatos <221882055+alexatosatos@users.noreply.github.com> Signed-off-by: 0x5t4l1n <stalin78830@gmail.com>
Add unit tests for _seaweedfs_etag: base64 header decoded to the S3 ETag, multipart "hex-N" suffix preserved, quoted value stripped, invalid base64 header falling back to the md5 digest as hex, missing and null extended and attributes blocks, an undecodable md5, and an empty entry. Assisted-by: Claude Code <https://claude.com/claude-code> Signed-off-by: 0x5t4l1n <stalin78830@gmail.com>
|
@cepera thanks for the careful review (and for verifying on a live cluster). Everything you and the bot asked for is in the branch, now rebased on current
Could you take another look? |
f02ae9c to
460a65f
Compare
Summary
Fixes #99.
Every file uploaded through the SeaweedFS webhook was permanently flagged "update" and re-ingested (delete + re-embed) on every Synchronize, even when the file had not changed.
Root cause
process_seaweedfs_event()set the stored ETag toattributes.md5, which SeaweedFS populates with a base64 of the raw 16-byte MD5 digest (e.g.sRLjVZozmrH9kzZ5Ke8HGg==). The sync diff compares this against the ETag returned by the S3 API, which is a plain hex string (e.g.b112e3559a339bb1fd93367929ef071a). These two representations never match, so every file is treated as changed on every sync.Fix
SeaweedFS stores the actual S3-compatible ETag string base64-encoded in
new_entry.extended['Seaweed-X-Amz-ETag']. The fix prefers that field (decoded from base64) so the stored value is identical to what the S3 API reports. The oldattributes.md5path is kept as a fallback for older SeaweedFS versions that do not populate theextendedblock.Before
After
Validation
Tested on a live E-RAG 2.3.0 deployment (SeaweedFS 4.22, k3s) as described in the issue:
createevent → file registered with ETagbb12e3559a339bb1fd93367929ef071a, identical to the S3HEADvalueGET /api/files/sync→"no action"with no manual Synchronize required-Nsuffix, exactly as the S3 API reports it