Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-262) Merge 1.0 into master #264

Merged
merged 46 commits into from
Jun 18, 2020

Conversation

glennsarti
Copy link
Contributor

Fixes #262

Merges 1.0 into master

glennsarti and others added 30 commits January 29, 2020 13:34
(maint) Allow travis to build 1.0 branch
(maint) mergeback master into 1.0
(maint) Mergeback master into 1.0
This commit creates a session_state namespace.  This will hold the document
store, language client and the object cache. This just moves the files to
preserve git history.
This commit:

* Creates a ClientSessionState object which holds all of the state information
  for a single client.
* Changes all of the object references to the new SessionState namespace.
* Adds a ducktype of the old PuppetLanguageServer::DocumentStore module and
  uses the ClientSessionState behind the scenes.  Later commits will remove
  this module.
Previously the TCP Server would return a hash instead of nil if the connection
ID did not exist. This commit forces the output to nil if the connectino does
not exist.
Previously the NodeGraph protocol object was changed to PuppetNodeGraph
however the original object was never deleted.  This commit deletes this unused
object.
This commit:

* Creates a new base queue called SingleInstanceQueue.  This queue process jobs
  in one or more threads.  But only allows one job key to exist in the queue
  at once. When you add an additional job, it gets added to the end of the
  queue and any other jobs are removed.
* Creates a ValidationQueue which inherits from the SingleInstanceQueue but only
  has the extra things it needs to do validation.
* Creats a global module called GlobalQueues, which holds an instance of the
  validation queue.  Validation is a global queue (for any connection).
* Updates the spec tests for the new queue name
* Cleans up some of the logic in the queue.  It was pre-optimising but made it
  harder to follow through.
* The Validation Queue now uses the session_state for a given connection to make
  decisions instead of the global DocumentStore modulre.
This commit updates the Crash Dump to use the session_state instead of the
global DocumentStore module.
This commit:
* Uses the single_instance_queue for sidecar queue
* The Sidecar queue gets session_state via the connection_id property. Removing
  the calls to the global PuppetHelper module.
* Adds the connection_id getter and setter methods to the PuppetHelper to help
  transition the refactor.  These methods will be removed in later commits once
  the refactor is complete
* Because the Sidecar Queue now requires a connection_id and session_state it
  is no longer possible to preload the Puppet information without an actual (or
  mocked connection).  Therefore the spec_helper is updated to inject a JSON
  fixture file into the object cache instead of doing actual sidecar calls.
  This also speeds up tests run time as it no longer has to _actually_ do real
  queries, but just consume a test fixture.

 # Please enter the commit message for your changes. Lines starting
This commit adds commented out code which can be useful when debugging
acceptance tests.
This commit:

* Moves the cache loading helpers, and cache state query methods from the global
  PuppetHelper module into the Client Session State, where it makes more sense.
  The loading and querying depend on the state, specifically the object cache.
* Modifies the spec_helper to prepopulate an object cache from the test fixture.
  This again can speed up tests and means that some tests can be moved from
  integration into unit tests.
* Adds remove_origin!, origin_exist? and section_in_origin_exist? to the object
  cache as helper methods.
* Fixes a bug in the object cache which would raise erorrs for nils instead of
  handling them correctly
Previously when creating a ClientSessionState object it required a "real"
message handler.  Instead this commit updates the initializer so that you can
pass in exactly what the connection_id is, and fallback to message_handler way
if it's nil.  This makes it easier to test and mock.

This commit also removes any unneeded object creations for the session state in
the test suite.
This commit refactors the Puppet Helper to pass in the session state to the
get_node_graph and get_puppet_resource methods. Thereby making them pure
methods and easier to test.
Now that the basics are in place to pass session state around instead of using
global modules, it's time to start updating the object cache helpers in the
PuppetHelper module.  This commit only updates the type helpers.  Later commits
will update the other helpers.

This commit:
* Updates the two type helpers (get_type and type_names) to require the
  session_state to be passed in, instead of using the temporary connection_id
  method
* Updates the completion, definition and hover providers to call the updated
  type helpers with the session_state. This means that the session_state must
  be passed into these providers as well.
* Updates the message_handler to pass in the session state when calling the
  completion, definition and hover providers
* Updates the tests for the completion, definition and hover providers and
  message handler with the updated method signatures.
Now that the basics are in place to pass session state around instead of using
global modules, it's time to start updating the object cache helpers in the
PuppetHelper module.  This commit only updates the function helpers.  Other
commits will update the other helpers.

This commit:
* Updates the two function helpers (function and function_names) to require the
  session_state to be passed in, instead of using the temporary connection_id
  method
* Updates the completion, definition, signature and hover providers to call the
  updated function helpers with the session_state. This means that the
  session_state must be passed into these providers as well.
* Updates the message_handler to pass in the session state when calling the
  completion, definition, signature and hover providers
* Updates the tests for the completion, definition, signature and hover
  providers and message handler with the updated method signatures.
Now that the basics are in place to pass session state around instead of using
global modules, it's time to start updating the object cache helpers in the
PuppetHelper module.  This commit only updates the class helpers.  Other
commits will update the other helpers.

This commit:
* Updates the two class helpers (get_class and class_names) to require the
  session_state to be passed in, instead of using the temporary connection_id
  method
* Updates the completion, definition and hover providers to call the
  updated class helpers with the session_state. This means that the
  session_state must be passed into these providers as well.
* Updates the message_handler to pass in the session state when calling the
  completion, definition and hover providers
* Updates the tests for the completion, definition and hover
  providers and message handler with the updated method signatures.
Now that the basics are in place to pass session state around instead of using
global modules, it's time to start updating the object cache helpers in the
FacterHelper module.  This commit all the helpers.

This commit:
* Updates the all helpers to require the
  session_state to be passed in, instead of using the temporary connection_id
  method
* Updates the completion, definition and hover providers to call the
  updated class helpers with the session_state. This means that the
  session_state must be passed into these providers as well.
* Removes temporary methods that are not longer required.
Now that the basics are in place to pass session state around instead of using
global modules, it's time to start updating the object cache helpers in the
PuppetHelper module.  This commit only updates the class helpers.  Other
commits will update the other helpers.

This commit:
* Updates the one Datatype helpers (datatype) to require the
  session_state to be passed in, instead of using the temporary connection_id
  method
* Updates the hover providers to call the updated datatype helper with the
  session_state. This means that the session_state must be passed into this
  providers as well.
* Updates the message_handler to pass in the session state when calling the
  hover provider
* Updates the tests for the hover provider and message handler with the updated
  method signatures.
* Removes the now redundant inmemory_cache variable and .cache methods from the
  PupeptHelper as they are no longer required due to the refactor.
…n_state

This commit removes the ducktyped DocumentStore module and changes all
references to use the Session State instead.
Now that the sidecar and validation queue inherit from the SingleInstanceQueue
(SIQ), the common tests can be removed from those queues and applied only the
SIQ.  This commit only leaves the queue specific details in the queue specific
test files, for example the validation queue tests only assert on validation
based tasks, not that the queue is single instance.

This commit also updates the SingleInstanceQueueJob so that they key is passed
in at creation time, instead of requiring overriding an abstract method. The
key is immutable so there's no need to make it changeable.
Previously the document store just used a simple hash to store documents that
are being edited. However documents are important and should really by a first
class object type. This commit:
* Refactors the old `document` method to `document_content`.  Also all calls
  to the old method (including tests) were updated with the new method name.
* Refactors the document store so that documents come from the Document class.
* Adds stub classes for Epp, Manifest and Puppetfile document types. Later
  commits will actually use the different document classes for document specific
  tasks, e.g. caching AST, and tokens
(puppetlabsGH-209) Refactor the session state to be a class and pass that instead of global modules
Self merging as this is a mergeback
…services into mergeup-master

* 'master' of https://github.com/glennsarti/puppet-editor-services:
  (maint) Release 0.26.0
  (puppetlabsGH-245) Remove facts_all sidecar request
  (puppetlabsGH-245) Use object cache for fact data
  (puppetlabsGH-245) Add acceptance tests for getFacts request
  (puppetlabsGH-242) Puppet Facts Endpoint
  Revert "(puppetlabsGH-238) Monkey patch Facter for minimal resets"
  (maint) Update branding urls
  (puppetlabsGH-238) Monkey patch Facter for minimal resets
  (maint) Update rubocop to 0.80.x
This commit updates the Facter Helper for 1.0, due to the change in the
session state.
This commit removes the vendored gems from the git repository and instead
modifies Rake tasks and documentation to vendor the gems manually. Note that
the build process does vendor the gems prior to compressing into a Zip.

This is to reduce git history churn when adding or updating vendored gems. The
vendored gem content doesn't change so there's no point replicating in this
repo.
glennsarti and others added 16 commits May 16, 2020 21:08
The puppet-strings (and yard) gem are not available in all instances.  This
commit vendors the gem in the Language Server so that it's always availble
Now that puppet-strings is vendored it needs to be injected into the LOAD_PATH.
This commit:

* Adds the puppet-strings and yard gems to the LOAD_PATH in Language Server
  Sidecar
* Removes any checks to see if puppet-strings is available, as now that it's
  vendored, it's always available
…h Puppet 5

The Language Server Sidecar needs to support both Puppet 5 and Puppet 6. Now
that the puppet-strings feature is becoming mainstream, the puppet-strings
code also needs to to support Puppet 5.

Unfortunately the Loaders in Puppet 5 are different than Puppet 6 therefore the
Loader manipulation etc. can not work. But using the loaders is actually very
complicated and could be prone to error in Puppet 7 and beyond.

This commit:

* Drops the Puppet version restriction from Puppet 6 down to Puppet 5
* Removes the Loader code and monkey patches
* Uses our own `PuppetPathFinder` to find files to parse which is much simplier
  to reason and understand. Note that the integration and acceptance tests prove
  that this class works similarly to the Puppet 6 Loader style.
* The `retrieve_default_data_types` is modified becuase the previous code using
  the TypeFactory as not working in Puppet 5.  Instead we now look at the Ruby
  constants in the Puppet::Pops::Types namespace for anything that is an actual
  Puppet DataType.
This commit removes the puppet-strings feature flag, and any forking
(if-then-else) that was previously done on the puppet-strings feature-flag.

This commit also moves any puppet-strings feature flags tests to the default
test suite. Thereby making puppet-strings the default code path for everything.
Now that puppet-strings is used for metadata information, support for Puppet 4
must be removed.  Ths commit removes Puppet 4 from the testing matrix and
modifies the Debug Server, Language Server and Language Server Sidecar to
terminate early with an error if run under Puppet 4.
This commit adds some documentation to the Puppet Helper in the Language Server
Sidecar.
…s-featureflag

(puppetlabsGH-252) Remove puppetstrings featureflag and remove support for Puppet 4
Due to rubocop/rubocop#8008 this commit pins
rubocop to 0.83.0 until the fix is release in 0.85.0.
Adds a new endpoint for parsing a Puppetfile and returning a list of modules. This only returns forge modules right now because those are the only ones that are resolved by puppetfile-resolver currently.
Previosuly in commit 77878f3 a new puppetfile resolver endpoint was added.
However it was missing acceptance tests.  This commit adds a basic acceptance
smoke test for the puppetfile request.
Previously the puppetfile-resolver endpoint was created with version 0.x of
Editor Services.  Now that 1.0 is being worked on, the method call has changed
slightly.
This commit:
* Updates 1.0 to the head of master
* Fixes one bug with the mergeup
* Prepares 1.0 to be merged back into master
…vices into gh262-merge1.0-to-master

* '1.0' of https://github.com/glennsarti/puppet-editor-services: (34 commits)
  (puppetlabsGH-262) Prepare 1.0 branch for merge into master
  (puppetlabsGH-256) Fix calling getDependencies in 1.0
  (puppetlabsGH-256) Add acceptance tests for puppetfile resolver request
  (maint) Release 0.26.1
  (puppetlabsGH-256) Add puppetfile-resolver endpoint
  (maint) Pin Rubocop to < 0.84.0
  (puppetlabsGH-252) Add documentation to the Puppet Helper
  (puppetlabsGH-252) Remove support for Puppet 4
  (puppetlabsGH-252) Remove the puppetstrings featureflag
  (puppetlabsGH-252) Refactor sidecar puppet-strings loader to work with Puppet 5
  (puppetlabsGH-252) Load vendored puppet-strings
  (puppetlabsGH-252) Vendor puppet-strings
  (maint) Remove vendored gems
  (maint) Fix Facter Helper
  (puppetlabsGH-209) Refactor documents in the Document Store
  (puppetlabsGH-209) Refactor single instance queue tests
  (puppetlabsGH-209) Refactor references to DocumentStore to use session_state
  (puppetlabsGH-209) Refactor helper for datatype information
  (puppetlabsGH-209) Refactor helper for fact information
  (puppetlabsGH-209) Refactor helper for class information
  ...
@glennsarti glennsarti self-assigned this Jun 14, 2020
@glennsarti glennsarti added this to the 1.0.0 milestone Jun 14, 2020
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woohooo!

@jpogran jpogran merged commit 6e28bcc into puppetlabs:master Jun 18, 2020
@glennsarti glennsarti deleted the gh262-merge1.0-to-master branch July 22, 2020 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.0] Merge 1.0 into master
2 participants