The factory code used YAML a lot because it was considered as "easy to read and edit".
As time goes by, we've learned that (1) YAML is not supported well in python (2) YAML spec is not strict, and many implementations have their own hacks (3) The 'easy' of YAML also leads to error, for example we often see people writing 0719 as PID/VID in HWID file, and can't realize it is actually 1317 (base=8 due to leading 0).
Here's the new policy for factory code:
Everything stored as config should be either Python AST or JSON.
YAML is allowed for human editing, but should be converted to AST or JSON for internal storage. For example, "umpire edit" may still open an editor to edit configs in YAML, but the internal (after saved) format stored should be AST or JSON.
This applies to all newer code in future. For legacy code, we'll track the migration by this issue.
Note "HWID Database file" won't be changed soon because there are other services, maintained by other team, reading it. But the ultimate goal is the same - we should output a more strict formatted data, for example JSON, for them.
Comment 1 by hungte@chromium.org
, Sep 7Owner: fshao@chromium.org
Status: Assigned (was: Untriaged)