[roll] Roll fuchsia [persistence] Fix file corruption and add recovery

Lack of truncation when overwriting persistence files (with smaller
payloads) allows trailing characters from old data to corrupt the JSON.
This leads to deserialization failures (e.g. "trailing characters...").

When deserialization fails:
- On boot (`forget_old_data` reading `previous.json`), the component
  crashed and failed to start.
- At runtime (`scheduler.rs` reading `current.json`), the component
  skipped persisting new data.

This durability issue is fixed by:
- Adding `Flags::FILE_TRUNCATE` when opening files for writing.
- Adding recovery logic in reading paths to start with an empty default
  state on failure instead of propagating errors and crashing.

Additionally, dump the corrupted byte content as lossy UTF-8 in error
contexts to aid post-mortem debugging of deserialization failures.

Original-Bug: 489455707
Original-Bug: 490466395
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1564121
Original-Revision: 7b508bb2083751d864ec4289bd23a883dbf2c13a
GitOrigin-RevId: f380ae0679173afdba8b2047412dc9be40c2c32b
Change-Id: I1a46c7473cca899c8fccaf7d5c1cd79383b29d1b
1 file changed
tree: b00454880fb3e03db0824da0a010dc73315be4b6
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cobalt
  6. flower
  7. jiri.lock
  8. MILESTONE
  9. minimal
  10. prebuilts
  11. README.md
  12. stem
  13. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.