mirror of
https://github.com/sbt/sbt.git
synced 2026-10-07 18:43:31 +02:00
* [2.x] test: Pin how a server writes its files **Problem** Nothing covers how the server writes the portfile and the token file. The next commit changes both. **Solution** Assert what the server does now. The tests read the token file only. The server rewrites it on every authentication, so a test can read it while the server writes. The server writes the portfile once, as it starts. Co-authored-by: Claude Opus 5 (1M context) <[email protected]> * [2.x] fix: Write the portfile and zip by rename **Problem** A client reads the portfile as soon as it appears. The server wrote it with IO.write, in place, so a client could read part of one and fail to parse it. ActionCache staged and renamed its zip by hand. **Solution** The portfile calls IO.writeFileAtomically, and the cache zip calls IO.copyFile, which stages and renames on its own. The token file needs its staging file kept to the owner, which neither can do yet, so it still writes its own way. Co-authored-by: Claude Opus 5 (1M context) <[email protected]> * [2.x] sbt-io: upgrade to v1.13.1 * [2.x] fix: Write the token file by rename **Problem** writeTokenfile would first remove the existing token file, and then go through a non-atomic sequence of steps to write a new one. If a client attempts to read the file during that process, it is likely to find it either missing or half-written. **Solution** Use newly released IO.writeFileAtomically with ownerOnly flag set. Co-authored-by: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>