Repository navigation
Conversation
…mktemp lib-memory-dir.sh's no-jq Python-fallback merge signalled an untrusted project config drop only via a marker file, whose own mktemp call could itself fail (a full or read-only $TMPDIR), leaving the drop unreported whenever both that mktemp and the project config load failed in the same run -- the compound case #748 left open. The merge subprocess's own exit code (3, distinct from 0 and from a genuine merge failure) now carries the same disclosure independently of the marker file succeeding at all. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…inding Self-review (Explore) found the #748 comment directly above the marker's mktemp call still claimed "a real subprocess exit ... cannot be told apart from success", which #804 itself falsifies a few lines below -- updated to describe both signals. Self-review (oss:auditor) found the trusted-config json.load() path can still raise uncaught and fall back to the bundled config with no disclosure; pre-existing, non-blocking, logged to trap.d/ per its own "ship behind a trap.d fragment" verdict. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
scripts/lib-memory-dir.sh's no-jq Python-fallback config merge signalled a dropped untrusted project-config layer via a marker file alone. If the marker file's ownmktempcall also failed (full/read-only$TMPDIR), the drop happened with nothing logged -- a compound gap #748 left open and #804 asked for a maintainer call on.Fix
_dropped_project_layer = Truein the sameexcept (OSError, ValueError)branch that already attempts the marker-file write, and callssys.exit(3)after the merged config is written if that flag is set. Exit 3 is distinct from 0 (clean) and any other nonzero (a genuine merge failure)._py_merge_rc=0; ... <<'PYMERGE' || _py_merge_rc=$?so it survives aset -ecaller (this file is sourced by callers that set-e).cp "$_bundled_cfg" "$_merged_cfg") now only fires when rc is neither 0 nor 3 (previously: any nonzero).tests/test_case_divergence_298.pyfor this site, per this repo's own case-divergence pin-fold-don't-stack convention, rather than stacking new pairs.Tests
Added to
tests/test_untrusted_project_haiku_config_726.py: a PATH-shim helper that forcesmktempto fail only for the drop-marker template (delegating to the realmktempfor every other template) plus:test_mktemp_failing_for_the_drop_marker_itself_still_logs_the_drop-- project config unreadable AND the drop-marker's own mktemp forced to fail -- asserts the WARNING still appears. This is the exact compound case release-audit: sanitize failure on the project config layer drops settings silently, with nothing logged (misreports, non-blocking) #748/lib-memory-dir.sh's no-jq Python-fallback drop marker can itself fail silently if mktemp fails #804 is about.test_mktemp_failing_for_the_drop_marker_does_not_warn_when_nothing_dropped-- positive control: same broken-mktemp shim, readable config with no haiku block -- asserts no warning and that the merge value still carries through.Confirmed red before the fix (temporarily restoring the pre-#804 file):
AssertionError: assert 'lib-memory-dir' in '', positive control unaffected. Green after:2 passed. Full related suites (test_untrusted_project_haiku_config_726.py,test_case_divergence_298.py,test_jq_free_config.py,test_layered_config.py) all green:83 passed.Did not run the full repo
pytestsuite -- this repo's own convention is that CI across three OSes and four interpreters is the actual merge gate, not a local full run.Self-review
Two reviewers (Explore, oss:auditor), before/after tree snapshot taken and compared (post-review diff was entirely this lane's own subsequent commit, not a reviewer mutation). Both findings addressed:
mktempcall claimed a real subprocess exit code and the marker file 'cannot be told apart from success' -- falsified by this very fix. Corrected in this PR.trap.d/804.trusted-config-json-load-uncaught-misreports.mdfor a future maintainer call, not fixed here.Also logged (not blocking):
trap.d/804.edit-op-defaulted-to-main-clone-not-worktree.md, a worktree-discipline near-miss caught and fully recovered before any commit.Closes #804
🤖 Generated with Claude Code
[AI-generated]