no-mistakes(document): Clarify rebuild updates and check guidance

This commit is contained in:
Lap Tran committed 2026-11-23 17:57:16 -05:00
1 parent 022967e277
commit ad55229df8
4 files changed
+73 -22

No files matched your search

+54
View File
@@ -331,5 +331,59 @@ class ManagedLintTools(unittest.TestCase):
self.assertTrue(command["force"])
class ActivationToolFloor(unittest.TestCase):
"""The generated activation installs the floor without downgrading newer tools."""
@classmethod
def setUpClass(cls):
expression = '''
(builtins.getFlake (toString ./.)).darwinConfigurations."lt-mbp"
.config.home-manager.users.laptran.home.activation.axiTools.data
'''
result = subprocess.run(
["nix", "eval", "--raw", "--impure", "--expr", expression],
cwd=ROOT, text=True, capture_output=True, timeout=120,
)
if result.returncode:
raise AssertionError(result.stderr)
cls.activation = result.stdout
def test_missing_old_current_and_newer_tasks_versions(self):
# Independent oracle: firstmate requires 0.2.6. A rebuild must retain
# a newer installed release instead of restoring that minimum.
boundaries = r'''
function /opt/homebrew/bin/npm { printf '%s\n' "$*" >> "$TEST_CALLS"; }
function [ {
if [[ $1 == -x && $2 == /opt/homebrew/bin/* ]]; then return 0; fi
builtin [ "$@"
}
tasks-axi() {
if [[ -z $TEST_HAVE ]]; then return 127; fi
printf '%s\n' "$TEST_HAVE"
}
'''
with tempfile.TemporaryDirectory(prefix=".activation-test-", dir=ROOT) as scratch:
root = Path(scratch)
script = root / "activation.sh"
script.write_text(boundaries + self.activation)
calls = root / "calls"
for have, installs in (
("", ["install -g tasks-axi@0.2.6"]),
("0.2.5", ["install -g tasks-axi@0.2.6"]),
("0.2.6", []),
("2.0.0", []),
):
with self.subTest(installed=have or "absent"):
calls.write_text("")
env = {"HOME": str(root), "PATH": "/usr/bin:/bin",
"TEST_HAVE": have, "TEST_CALLS": str(calls)}
result = subprocess.run(
[shutil.which("bash"), str(script)], cwd=ROOT, env=env,
text=True, capture_output=True, timeout=30,
)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertEqual(calls.read_text().splitlines(), installs)
if __name__ == "__main__":
unittest.main()