Either works. "A" looks more logical and would likely be easier for other stakeholders to consume but "B" is fine, too. In "B", your dev task is acting like a hammock activity.
What is most important here is that YOU understand the logic and can manage the work. The whole idea behind a WBS is to break your work down into manageable pieces, the key word being manageable. So use the structure that you can understand, analyze, defend, predict, etc.
I think you had trouble because a work package has the same name. Consider the work being done to overhaul a house. It is likely you would have two different accounts for the kitchen and a bathroom. Both rooms have walls and those walls need to be painted. I will guarantee you in that WBS you would have "paint walls" under both accounts. You'd have others, too: "install fixtures." One might be a dishwasher and the other might be a toilet. Duplicate activities under different accounts is a non issue.