)]}'
{"snix/eval/builtin-macros/rustfmt.toml":[{"author":{"_account_id":1000054,"name":"Axel Karjalainen","email":"axel@axka.fi","username":"axelkar"},"change_message_id":"a2f1a888b86d7d8ffdf2b55e367e14f14c02acf6","unresolved":true,"context_lines":[{"line_number":1,"context_line":"# FUTUREWORK: move to .. once all crates are migrated (#114)"},{"line_number":2,"context_line":"edition \u003d \"2024\""}],"source_content_type":"text/x-toml","patch_set":6,"id":"40c386eb_6741b65e","line":2,"updated":"2025-08-02 18:54:37.000000000","message":"I was wondering why this existed when `cargo fmt` exists, but it\u0027s recommended to add a `rustfmt.toml`: https://doc.rust-lang.org/edition-guide/rust-2024/rustfmt-style-edition.html#migration\n\nMaybe this could be documented?","commit_id":"4a0c8a0a0eca32961702c29a3c0193472e52712c"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"45a55688c047ffd20cc6daef27708645a8ad5d19","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# FUTUREWORK: move to .. once all crates are migrated (#114)"},{"line_number":2,"context_line":"edition \u003d \"2024\""}],"source_content_type":"text/x-toml","patch_set":6,"id":"85b70570_0137e2fb","line":2,"in_reply_to":"0e61341f_8866d7a3","updated":"2025-08-03 09:51:04.000000000","message":"In fact, let\u0027s add this comment to the only remaining rustfmt.toml. I\u0027ll add a review comment in that CL.","commit_id":"4a0c8a0a0eca32961702c29a3c0193472e52712c"},{"author":{"_account_id":1000054,"name":"Axel Karjalainen","email":"axel@axka.fi","username":"axelkar"},"change_message_id":"7b266419006ea203964aceb68e295b20fc466468","unresolved":true,"context_lines":[{"line_number":1,"context_line":"# FUTUREWORK: move to .. once all crates are migrated (#114)"},{"line_number":2,"context_line":"edition \u003d \"2024\""}],"source_content_type":"text/x-toml","patch_set":6,"id":"c247d509_5d234c80","line":2,"in_reply_to":"393860ee_0254ff2b","updated":"2025-08-02 19:09:22.000000000","message":"I saw that when digging into depotfmt after updating Cargo.nix, but for me it wasn\u0027t immediately obvious why `rustfmt.toml` was added when the edition was already specified in `Cargo.toml`.","commit_id":"4a0c8a0a0eca32961702c29a3c0193472e52712c"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"4d1775ff1de3ef19c35250b865c59db23b1cd2c6","unresolved":true,"context_lines":[{"line_number":1,"context_line":"# FUTUREWORK: move to .. once all crates are migrated (#114)"},{"line_number":2,"context_line":"edition \u003d \"2024\""}],"source_content_type":"text/x-toml","patch_set":6,"id":"393860ee_0254ff2b","line":2,"in_reply_to":"40c386eb_6741b65e","updated":"2025-08-02 19:02:22.000000000","message":"CI invokes rustfmt, not` cargo fmt`, cause treefmt / depotfmt takes care of formatting: https://git.snix.dev/snix/snix/src/commit/a1b1348979a47183cd434a9717099ae40cd527e4/tools/depotfmt.nix#L20","commit_id":"4a0c8a0a0eca32961702c29a3c0193472e52712c"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"ef9d170d37b16b00d81bb6ad84060ae66f5429ac","unresolved":true,"context_lines":[{"line_number":1,"context_line":"# FUTUREWORK: move to .. once all crates are migrated (#114)"},{"line_number":2,"context_line":"edition \u003d \"2024\""}],"source_content_type":"text/x-toml","patch_set":6,"id":"0e61341f_8866d7a3","line":2,"in_reply_to":"c247d509_5d234c80","updated":"2025-08-02 20:43:45.000000000","message":"Yes, I\u0027m ok with a comment.","commit_id":"4a0c8a0a0eca32961702c29a3c0193472e52712c"}],"snix/eval/src/tests/nix_tests.rs":[{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"c0d20e2e4ac1c73768b041fdce6b232379e8ffc1","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"754bf260_fbd47934","line":42,"updated":"2025-07-04 18:28:47.000000000","message":"👀\n\nThis needs a SAFETY comment, explaining why it\u0027s ok.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"c44c1c46216ddf89d08805c2be6effeb50ff5c37","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"832e59a5_2097c1b4","line":42,"in_reply_to":"3a21bf5b_f106b126","updated":"2025-07-04 20:44:16.000000000","message":"No, while the code is fine, it is the wrong reasoning:\n\nThis is a test harness, not eval code. Rust tests are run in different threads, so setting this in some places and expecting values elsewhere could be a problem.\n\nAs I understand it, as we set it to the same value everywhere and only test for that one value in one test, we should be fine.\n\nBut this definitely needs a comment explaining precisely that, not a leftover TODO comment from the cargo migration tool.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"e53ebdc442bf60c9e5faee92bf9344a17fdda33c","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"602c3a6b_19d32af3","line":42,"in_reply_to":"4caef458_31bd7014","updated":"2025-07-05 09:01:32.000000000","message":"Reading https://doc.rust-lang.org/std/env/fn.set_var.html again, and their safety comment, I don\u0027t think this is safe, considering the test suite is multi-threaded, so multiple things set and read env vars:\n\n\u003e The exact requirement is: you must ensure that there are no other threads concurrently writing or reading(!) the environment through functions or global variables other than the ones in this module. The problem is that these operating systems do not provide a thread-safe way to read the environment, and most C libraries, including libc itself, do not advertise which functions read from the environment.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"3af80af4e683b0194c5143d2ac9f3486eafe2047","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"5084c075_640e1ace","line":42,"in_reply_to":"4e499399_3438cee4","updated":"2025-07-07 09:14:27.000000000","message":"Yes, that would be preferable. Another option that @edef@edef.eu suggested in DM was to abstract environment access out (maybe into the IO trait), and then just initializing it with a mock for the sake of this test.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000004,"name":"Florian Klink","email":"flokli@flokli.de","username":"flokli"},"change_message_id":"420038606edf461c6c725c69b651131e105fbc3e","unresolved":false,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"7386cf18_e2a6629f","line":42,"in_reply_to":"5026b93d_392202e2","updated":"2025-08-03 09:53:07.000000000","message":"https://cl.snix.dev/c/snix/+/30639 landed, we don\u0027t run setenv anymore. This needs a rebase, but the safety concerns are gone. 🎉","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000054,"name":"Axel Karjalainen","email":"axel@axka.fi","username":"axelkar"},"change_message_id":"a2f1a888b86d7d8ffdf2b55e367e14f14c02acf6","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"5026b93d_392202e2","line":42,"in_reply_to":"5084c075_640e1ace","updated":"2025-08-02 18:54:37.000000000","message":"I\u0027ve used this for tests in a library I recently published:\n```rs\n/// Makes tests that modify environment variables run independently.\nstatic ENVVAR_MUTATION: RwLock\u003c()\u003e \u003d RwLock::new(());\n```\nFor tests that don\u0027t modify environment variables, use `let _guard \u003d ENVVAR_MUTATION.read().unwrap();`. Otherwise use `let _guard \u003d ENVVAR_MUTATION.write().unwrap();`.\n\nYou could probably get by with only using a `Mutex` in `eval_test` because the environment variable not existing doesn\u0027t break tests that don\u0027t use it.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000035,"name":"Bence Nemes","email":"nemes.bence1@gmail.com","username":"starnick4444"},"change_message_id":"e9cd3840499969b18022ece319ca50f83abc1db4","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"4e499399_3438cee4","line":42,"in_reply_to":"602c3a6b_19d32af3","updated":"2025-07-07 09:08:37.000000000","message":"Could we avoid set_var by using an already existing variable, or by setting one in shell.nix?","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000035,"name":"Bence Nemes","email":"nemes.bence1@gmail.com","username":"starnick4444"},"change_message_id":"b209ee63cbb6ac9ff98214b492f69498da0b1833","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"3a21bf5b_f106b126","line":42,"in_reply_to":"754bf260_fbd47934","updated":"2025-07-04 20:22:43.000000000","message":"This is fine because eval is single threaded, but even if that were to change, it would still be fine i think, because it runs before eval.","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"},{"author":{"_account_id":1000035,"name":"Bence Nemes","email":"nemes.bence1@gmail.com","username":"starnick4444"},"change_message_id":"5d5cb70ff0642bc60b0bcc2c9cefdd4b7b75def6","unresolved":true,"context_lines":[{"line_number":39,"context_line":"fn eval_test(code_path: PathBuf, expect_success: bool) {"},{"line_number":40,"context_line":"    use crate::vm::EvalMode;"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    // TODO: Audit that the environment access only happens in single-threaded code."},{"line_number":43,"context_line":"    unsafe { std::env::set_var(\"TEST_VAR\", \"foo\") }; // for eval-okay-getenv.nix"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    eprintln!(\"path: {}\", code_path.display());"}],"source_content_type":"text/x-rustsrc","patch_set":3,"id":"4caef458_31bd7014","line":42,"in_reply_to":"832e59a5_2097c1b4","updated":"2025-07-04 20:52:46.000000000","message":"I changed the todo comment already, this comment window only shows the original version. Is the explanation there precise enough?","commit_id":"5c12ef7820fadc944f9d65892ac2e8580ed383f8"}]}
