{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef/issues/3485","labels_url":"https://api.github.com/repos/chef/chef/issues/3485/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef/issues/3485/comments","events_url":"https://api.github.com/repos/chef/chef/issues/3485/events","html_url":"https://github.com/chef/chef/issues/3485","id":84810809,"number":3485,"title":"Silent corruption of node.run_context","user":{"login":"coderanger","id":128243,"avatar_url":"https://avatars.githubusercontent.com/u/128243?v=3","gravatar_id":"","url":"https://api.github.com/users/coderanger","html_url":"https://github.com/coderanger","followers_url":"https://api.github.com/users/coderanger/followers","following_url":"https://api.github.com/users/coderanger/following{/other_user}","gists_url":"https://api.github.com/users/coderanger/gists{/gist_id}","starred_url":"https://api.github.com/users/coderanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderanger/subscriptions","organizations_url":"https://api.github.com/users/coderanger/orgs","repos_url":"https://api.github.com/users/coderanger/repos","events_url":"https://api.github.com/users/coderanger/events{/privacy}","received_events_url":"https://api.github.com/users/coderanger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-03T23:09:00Z","updated_at":"2015-06-03T23:10:34Z","closed_at":null,"body":"The new guard_interpreter system silently corrupts `node.run_context` and no one has noticed for a year.\r\n\r\nThe problematic line is in [`ResourceGuardInterpreter#get_interpreter_resource`](https://github.com/chef/chef/blob/master/lib/chef/guard_interpreter/resource_guard_interpreter.rb#L96):\r\n\r\n```ruby\r\nanonymous_run_context = Chef::RunContext.new(parent_resource.node, {}, empty_events)\r\n```\r\n\r\nThis would be fine except that in [`RunContext#initialize`](https://github.com/chef/chef/blob/master/lib/chef/run_context.rb#L88) we do this:\r\n\r\n```ruby\r\n@node.run_context = self\r\n```\r\nThis means that after any resource runs a guard where `guard_interpreter` is not `:default`, `node.run_context` is set to that fake run context. This then breaks some code in Poise that tries to use `node.run_context.cookbook_collection` and finds it has been set to `{}`."},"comment":{"url":"https://api.github.com/repos/chef/chef/issues/comments/108641182","html_url":"https://github.com/chef/chef/issues/3485#issuecomment-108641182","issue_url":"https://api.github.com/repos/chef/chef/issues/3485","id":108641182,"user":{"login":"coderanger","id":128243,"avatar_url":"https://avatars.githubusercontent.com/u/128243?v=3","gravatar_id":"","url":"https://api.github.com/users/coderanger","html_url":"https://github.com/coderanger","followers_url":"https://api.github.com/users/coderanger/followers","following_url":"https://api.github.com/users/coderanger/following{/other_user}","gists_url":"https://api.github.com/users/coderanger/gists{/gist_id}","starred_url":"https://api.github.com/users/coderanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderanger/subscriptions","organizations_url":"https://api.github.com/users/coderanger/orgs","repos_url":"https://api.github.com/users/coderanger/repos","events_url":"https://api.github.com/users/coderanger/events{/privacy}","received_events_url":"https://api.github.com/users/coderanger/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T23:10:34Z","updated_at":"2015-06-03T23:10:34Z","body":"Ping @adamedx @danielsdeleo @lamont-granquist."}}