fix: config-editor lint warnings and stale cargo test artifacts - #4
Conversation
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tools/cargo-test-freshness.test.mjs">
<violation number="1" location="tools/cargo-test-freshness.test.mjs:167">
P2: The "unreadable build input fails closed" test relies on chmod 0o000 making src/lib.rs unreadable, which is not guaranteed: when the test runs as root (common in CI containers), on filesystems that do not enforce permission bits (overlayfs/rootless containers), or on Windows, the read still succeeds and the script exits 0. In such environments this test fails and breaks the cargo-test-freshness-check stage of `make test`. Trigger the read failure with a mechanism that does not depend on mode-bit enforcement, or guard/skip the test when the mode is not honored (e.g., detect that the file is still readable after chmod and skip).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| fs.rmSync(crateDir, { recursive: true, force: true }); | ||
| }); | ||
| const stampFile = path.join(crateDir, "target", ".fixture-source.sha256"); | ||
| fs.chmodSync(path.join(crateDir, "src", "lib.rs"), 0o000); |
There was a problem hiding this comment.
P2: The "unreadable build input fails closed" test relies on chmod 0o000 making src/lib.rs unreadable, which is not guaranteed: when the test runs as root (common in CI containers), on filesystems that do not enforce permission bits (overlayfs/rootless containers), or on Windows, the read still succeeds and the script exits 0. In such environments this test fails and breaks the cargo-test-freshness-check stage of make test. Trigger the read failure with a mechanism that does not depend on mode-bit enforcement, or guard/skip the test when the mode is not honored (e.g., detect that the file is still readable after chmod and skip).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tools/cargo-test-freshness.test.mjs, line 167:
<comment>The "unreadable build input fails closed" test relies on chmod 0o000 making src/lib.rs unreadable, which is not guaranteed: when the test runs as root (common in CI containers), on filesystems that do not enforce permission bits (overlayfs/rootless containers), or on Windows, the read still succeeds and the script exits 0. In such environments this test fails and breaks the cargo-test-freshness-check stage of `make test`. Trigger the read failure with a mechanism that does not depend on mode-bit enforcement, or guard/skip the test when the mode is not honored (e.g., detect that the file is still readable after chmod and skip).</comment>
<file context>
@@ -0,0 +1,174 @@
+ fs.rmSync(crateDir, { recursive: true, force: true });
+ });
+ const stampFile = path.join(crateDir, "target", ".fixture-source.sha256");
+ fs.chmodSync(path.join(crateDir, "src", "lib.rs"), 0o000);
+
+ const result = runFreshness(crateDir, stampFile);
</file context>
Summary
Two independent fixes, validated together:
Stale Cargo test artifacts:
make testnow runs a content-digest freshness gate for the backend crate (crates/emuchef-rust-backend). When the digest of build inputs changes, the Makefile performs a package-scopedcargo clean -p emuchef-rust-backendbeforecargo test, so a preserved-mtime checkout cannot silently run an outdated test executable. The pending/stamp protocol is interruption-safe, unchanged sources skip the clean, and no TLS behavior is modified.Config-editor lint warnings: stabilized the functions captured by the two
useEffecthooks inApp.tsxwithuseCallback(declared above the effects, generic contract preserved), and moved the non-component exports out ofResizableEditorLayout.tsxintoresizableEditorLayout.logic.tswith focused node:test coverage registered intest:logic.Validation
make testpasses (fresh run on this exact tree)npm --prefix apps/config-editor run typecheckpassesnpm --prefix apps/config-editor run test:logicpasses (149/149)Summary by cubic
Prevents stale backend Cargo test binaries and resolves config‑editor lint warnings. Previously, preserved mtimes could let
make testrun an outdatedemuchef-rust-backendtest binary; now a content‑digest freshness gate cleans the package beforecargo testwhen inputs change, while unchanged sources skip the clean.make test: runstools/cargo-test-freshness.mjsforemuchef-rust-backend; on digest change or pending marker, runscargo clean -p emuchef-rust-backendbefore tests. Script and itsnode:testare wired viacargo-test-freshness-check.App.tsxeffect dependencies by hoisting handlers touseCallback, eliminating React lint warnings without changing runtime behavior.ResizableEditorLayout.tsxintoresizableEditorLayout.logic.tsand adds focused unit tests; updatestest:logicto include the new logic and tests.Written for commit 3797092. Summary will update on new commits.