<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby-gems/chef.git/spec/unit/node/attribute_spec.rb, branch php</title>
<subtitle>github.com: opscode/chef.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/'/>
<entry>
<title>Revert "Per-container deep merge caching"</title>
<updated>2018-02-23T19:20:50+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2018-02-23T19:20:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=c60c5009e887e650c747581f90b6c68dfae44234'/>
<id>c60c5009e887e650c747581f90b6c68dfae44234</id>
<content type='text'>
This reverts commit 0c29acc106ca774e230c8ef45694c8bffd166b69.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 0c29acc106ca774e230c8ef45694c8bffd166b69.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "fix node assignment of ImmutableArrays to VividMashes/AttrArrays"</title>
<updated>2018-02-23T19:07:05+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2018-02-23T19:07:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=87079d5014b331da6d55125a2d91c283c395a038'/>
<id>87079d5014b331da6d55125a2d91c283c395a038</id>
<content type='text'>
This reverts commit e56f8d58b80334256085907961aac9ca9f56f125.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit e56f8d58b80334256085907961aac9ca9f56f125.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix node assignment of ImmutableArrays to VividMashes/AttrArrays</title>
<updated>2018-01-25T20:52:13+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2018-01-25T20:52:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=e56f8d58b80334256085907961aac9ca9f56f125'/>
<id>e56f8d58b80334256085907961aac9ca9f56f125</id>
<content type='text'>
node.default['foo'] = node['bar'] need to have node['bar'] have its
cache vivified otherwise we potentially get an empty hash or array.

in the case of hashes, the assignment must have been walking though
the values with #each or something which poked the cache on the target
hash which caused it to vivify, so this bug only affected Arrays
where the AttrArray initializer likely did a quick-n-dirty copy of
the internal structure of the ImmutableArray which was empty.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
node.default['foo'] = node['bar'] need to have node['bar'] have its
cache vivified otherwise we potentially get an empty hash or array.

in the case of hashes, the assignment must have been walking though
the values with #each or something which poked the cache on the target
hash which caused it to vivify, so this bug only affected Arrays
where the AttrArray initializer likely did a quick-n-dirty copy of
the internal structure of the ImmutableArray which was empty.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>prepping for rubocop 0.52.1</title>
<updated>2018-01-17T21:34:18+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2018-01-17T21:34:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=746562d6358c27b838c95ea27b2a2bd82c03cefe'/>
<id>746562d6358c27b838c95ea27b2a2bd82c03cefe</id>
<content type='text'>
Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Per-container deep merge caching</title>
<updated>2017-12-06T20:44:05+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-10-09T16:54:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=0c29acc106ca774e230c8ef45694c8bffd166b69'/>
<id>0c29acc106ca774e230c8ef45694c8bffd166b69</id>
<content type='text'>
Replaces the one-big top level deep merge cache with individual deep
merge caches in every container.  The Immutable container state becomes
the deep merge cache.

- Does not use a pure decorator style approach since that failed before
because of ruby internals breaking things like `===` and `=~` on
decorated objects, so we inherit (ultimately from Hash + Array).
- The state being the container state is useful in ruby since APIs on
Hash and Array poke around in internal state to make things fast.  If
we inherit from Hash/Array but don't have the correct internal state
things go wonky.
- Throwing away the internal state is equivalent to flushing the cache.
- Since we throw away all linked objects when we do that, we flush at
every level below the level being flushed (which is correct semantics).
- If a user has a pointer to an old immutable object from a sub-level,
that isn't mutated so the old object still contains the old view of
the data (which I think is correct, although I have some doubts that
its necessary, but it came along free for the ride).
- When we reset the cache we do mutate the cache being reset, which
might change data in held references.  If this becomes an issue the fix would
be to reset the cache at the level above by creating a new, "empty"
ImmutableHash/ImmutableArray object and inserting it into the
deep_merge_cache datastructure instead of clearing the internal state
of the child object.  I don't know practically how anyone would hit
this, though, so would prefer to wait on doing that work until we see
an actual bug report.
- Because of the way ruby pokes around internally there's some
weirdnesses like the pre-generation of the cache for all the values of
a subarray when #each is called, which is due to the way that ruby
walks through array-serialized hashes when called like:
`Array#each { key, value| ... }` (which is an undocumented(?) thing
in ruby).

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaces the one-big top level deep merge cache with individual deep
merge caches in every container.  The Immutable container state becomes
the deep merge cache.

- Does not use a pure decorator style approach since that failed before
because of ruby internals breaking things like `===` and `=~` on
decorated objects, so we inherit (ultimately from Hash + Array).
- The state being the container state is useful in ruby since APIs on
Hash and Array poke around in internal state to make things fast.  If
we inherit from Hash/Array but don't have the correct internal state
things go wonky.
- Throwing away the internal state is equivalent to flushing the cache.
- Since we throw away all linked objects when we do that, we flush at
every level below the level being flushed (which is correct semantics).
- If a user has a pointer to an old immutable object from a sub-level,
that isn't mutated so the old object still contains the old view of
the data (which I think is correct, although I have some doubts that
its necessary, but it came along free for the ride).
- When we reset the cache we do mutate the cache being reset, which
might change data in held references.  If this becomes an issue the fix would
be to reset the cache at the level above by creating a new, "empty"
ImmutableHash/ImmutableArray object and inserting it into the
deep_merge_cache datastructure instead of clearing the internal state
of the child object.  I don't know practically how anyone would hit
this, though, so would prefer to wait on doing that work until we see
an actual bug report.
- Because of the way ruby pokes around internally there's some
weirdnesses like the pre-generation of the cache for all the values of
a subarray when #each is called, which is due to the way that ruby
walks through array-serialized hashes when called like:
`Array#each { key, value| ... }` (which is an undocumented(?) thing
in ruby).

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix node#debug_value access through arrays</title>
<updated>2017-03-16T21:40:40+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-03-16T21:40:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=619a3d40eb6e0aa1627f5cafbc25245a7eef447f'/>
<id>619a3d40eb6e0aa1627f5cafbc25245a7eef447f</id>
<content type='text'>
nod to @jaymzh for finding this one.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nod to @jaymzh for finding this one.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Chef-13 freeze merged node attribute</title>
<updated>2017-03-15T19:05:43+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-03-15T19:05:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=b37436b080ff3733736e70d1343d5f328ed840e4'/>
<id>b37436b080ff3733736e70d1343d5f328ed840e4</id>
<content type='text'>
Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>additional fix deep-duping as well</title>
<updated>2017-03-14T02:54:38+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-03-14T02:54:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=d28d5c65d0074e6a5e3786555b5f31893447b157'/>
<id>d28d5c65d0074e6a5e3786555b5f31893447b157</id>
<content type='text'>
similarly to fixing to_hash.

kind of feels like we should return a VividMash instead of a Mash
here, to get a writable thing that behaves like an attribute...

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
similarly to fixing to_hash.

kind of feels like we should return a VividMash instead of a Mash
here, to get a writable thing that behaves like an attribute...

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Chef-13:  properly deep dup Node#to_hash</title>
<updated>2017-03-14T02:06:37+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-03-14T02:06:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=8cd2899fa40e21089d832b0a786b8fc4d335d738'/>
<id>8cd2899fa40e21089d832b0a786b8fc4d335d738</id>
<content type='text'>
previously to_hash allowed mutating non-container elements, now
they get properly dup'd.

fixes a 2.5 year old pending spec test.

also fills out the API so that there is to_h/to_hash/to_a/to_array
instead of the weird mix-and-match we had before.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
previously to_hash allowed mutating non-container elements, now
they get properly dup'd.

fixes a 2.5 year old pending spec test.

also fills out the API so that there is to_h/to_hash/to_a/to_array
instead of the weird mix-and-match we had before.

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Chef-13: remove method_missing access to node object.</title>
<updated>2017-03-13T22:56:57+00:00</updated>
<author>
<name>Lamont Granquist</name>
<email>lamont@scriptkiddie.org</email>
</author>
<published>2017-03-13T22:56:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ruby-gems/chef.git/commit/?id=59c6bd77abb071423daea0b62c4d97a54e0aa26a'/>
<id>59c6bd77abb071423daea0b62c4d97a54e0aa26a</id>
<content type='text'>
So again the reasons why we break this:

- node.class vs. node['class'] kinds of problems
- adding node#foo to Chef::Node as an extension to the API and
  breaking node.foo meaning node["foo"] (we can't make exensions
  to that class without possibly breaking someone)
- crazy things like the old CHEF-3799 issue in the old ticketing
  system where IO#puts in ruby blindly calls #to_ary on stuff and
  expects it to raise -- whereas we would potentially autovivify
  a 'to_ary' hash key and return nil which breaks the world.

This also has caused issues with the hashie gem and they've gone to
spamming warnings by default to try to deal with it:

https://github.com/berkshelf/berkshelf/issues/1665

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
So again the reasons why we break this:

- node.class vs. node['class'] kinds of problems
- adding node#foo to Chef::Node as an extension to the API and
  breaking node.foo meaning node["foo"] (we can't make exensions
  to that class without possibly breaking someone)
- crazy things like the old CHEF-3799 issue in the old ticketing
  system where IO#puts in ruby blindly calls #to_ary on stuff and
  expects it to raise -- whereas we would potentially autovivify
  a 'to_ary' hash key and return nil which breaks the world.

This also has caused issues with the hashie gem and they've gone to
spamming warnings by default to try to deal with it:

https://github.com/berkshelf/berkshelf/issues/1665

Signed-off-by: Lamont Granquist &lt;lamont@scriptkiddie.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
