Page MenuHomeSoftware Heritage

Prevent 'version' field (and others) from being dynamically infered as double
ClosedPublic

Authored by vlorentz on Mon, Jul 18, 4:06 PM.

Details

Reviewers
anlambert
Group Reviewers
Reviewers
Maniphest Tasks
Restricted Maniphest Task
Commits
rDSEA132b3b12385e: Prevent 'version' field (and others) from being dynamically infered as double
Summary

This causes crashes in future document when the first document with
a 'version' field has a value that Elasticsearch understands as a double.

Depends on D8128.

Resolves T4396.

Diff Detail

Repository
rDSEA Archive search
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8129 (id=29361)

Could not rebase; Attempt merge onto c847e9bbb0...

Updating c847e9b..b6d1043
Fast-forward
 swh/search/elasticsearch.py     | 24 +++++++++++++++++++++---
 swh/search/tests/test_search.py |  6 +++++-
 2 files changed, 26 insertions(+), 4 deletions(-)
Changes applied before test
commit b6d1043be386811abbbd4e2147b06c8782814fbb
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jul 18 16:01:40 2022 +0200

    Prevent 'version' field (and others) from being dynamically infered as double
    
    This causes crashes in future document when the first document with
    a 'version' field has a value that Elasticsearch understands as a double.

commit 12530b63898252cafa732e6b537b763a0173eeb8
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jul 18 16:05:42 2022 +0200

    Fix mypy false positive
    
    'document' is a typed dict, which mypy does not seem to allow here

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/334/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me !

swh/search/elasticsearch.py
63

even the longs

This revision is now accepted and ready to land.Mon, Jul 18, 4:54 PM
This revision was landed with ongoing or failed builds.Mon, Jul 18, 5:14 PM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D8129 (id=29366)

Rebasing onto 132b3b1238...

First, rewinding head to replay your work on top of it...
Fast-forwarded diff-target to base-revision-335-D8129.
Changes applied before test

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/335/ for more details.