Unify new behavior based functions and dialyzer fixes

This PR cleans up the dialyzer specs, unifies the signatures for the new behavior based functions to always put the ObjectRec first, and does a bit of code cleanup.

With these changes, the newly pushed sf/behaviour-refactor branch of chef_wm builds and dialyzes cleanly.

This PR also includes the start of fixes to restore (once more) the itests for chef_db. It seems we need to switch these to actually test chef_db:* functions now -- or at least do that for the chef_sql functions that have been removed. The nodes test is now working and similar changes to should be applied to fix up the other failing itests.

/cc @hosh @sdelano @oferrigni 

@manderson26 @marcparadise