Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Give talkback tapes more descriptive names #1050

Closed
1 task
sarayourfriend opened this issue Mar 3, 2022 · 0 comments · Fixed by #1193
Closed
1 task

Give talkback tapes more descriptive names #1050

sarayourfriend opened this issue Mar 3, 2022 · 0 comments · Fixed by #1193
Assignees
Labels
🤖 aspect: dx Concerns developers' experience with the codebase ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed

Comments

@sarayourfriend
Copy link
Contributor

Problem

The talkback tapes are currently all named "response-${number}.json" which makes it difficult and annoying to figure out whether a particular request is being recorded without having to search the files. It also just makes the directory structure mostly meaningless.

Description

Luckily talkback supports custom tape name generation functions: https://github.com/ijpiantanida/talkback#file-name

We could do something similar to the example maybe:

function nameGenerator(tapeNumber: number, tape: Tape) {
  // organize in folders by request method
  // e.g. tapes/GET/v1--images/q=Galah&extension=jpg.json5
  //      tapes/GET/v1--audio/q=Birds&license=cc0.json5
  //      tapes/GET/v1--images/stats.json5
  const parts = [tape.req.method, tape.req.path.replace(/\\/g, '--')]

  if (tape.req.search) parts.push(tape.req.search)

  return path.join(...parts)
}

The method isn't as useful for us (almost all the API requests we make are just GETs) but it would distinguish against the analytics requests pretty well.

Alternatives

We could use any number of alternative naming schemes, we don't have to use the one described above. Experiment a bit and find one that makes sense for the requests we're recording.

Implementation

  • 🙋 I would be interested in implementing this feature.
@sarayourfriend sarayourfriend added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 🤖 aspect: dx Concerns developers' experience with the codebase labels Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants