LESSONS: a new reader of a live object reads each field the way its writer writes it (983fff23d)

This commit is contained in:
yetone
2026-10-28 22:40:30 +08:00
parent 983fff23d0
commit c4972b36e1
+14
View File
@@ -248,6 +248,20 @@ nor the vendor's limits.**
ban risk, so a prompt change gets the same care as a header change.
- Seen 1× (2026-10-12).
**A new reader of a live object reads each field the way its writer
writes it.**
- 7f827b3b0 (10-27) added /v1/magpie/claude-runs, which lists every
run and calls pid() on each. pid() read cmd.Process without a lock
while a run's launch was still in cmd.Start writing it. It was red
under -race on ubuntu CI at 6104e88aa only (run 40698575099), since
most runs were cancelled by the next push. 983fff23d reads the run's
tree under mu first; it was red with a 50ms sleep injected at launch,
and not in 30 runs without it.
- Before adding a list or status route, find who writes each field it
reads and under which lock. Run its test under -race with a delay
injected into the writer.
- Seen 1× (2026-10-28).
**A bit or enum value has one owner.**
- d4c2512d2 (#1874) gave a usage row's Flags bit 256 to rowOwnCost while
a rebase of #1463 gave it to rowReasoningHidden, so every reported cost