Yes, context is the issue, and conjugation is a tremendous challenge for ESL students. When in doubt, match past-tense thanked with past-tense "did"
However, here's the rundown on the tenses mentioned.
Lucy thanked you for what you did. (while she was on vacation: watered her flowers on Wednesday)
Lucy thanked you for what you had done (during her three-week preparation for exams: provided her reference materials, edited her papers, and coached her with test exams). She passed the exams. (case closed)
Lucy thanked you for what you have done (since her husband died: mowed the lawn weekly, took the kids to movies and sporting events, assisted in the family business) Husband is still dead, you are still helping her, and it is probable you will help her in the future (case still pending)