1
0
Fork 0
Commit Graph

307 Commits (1bb5191e3e41a60547c3c81bd286e4fdd4e06236)

Author SHA1 Message Date
Mike Gerwitz 2ac393070a DataValidator: properly chain queue
This was not properly chain the promises---it was always chaining on
the original _pending (so, the first request) and never clearing
_pending after that point.

* src/validate/DataValidator.js (_onceReady): Properly chain.
* test/validate/DataValidatorTest.js: Updated test.  Don't ask.
2017-02-21 16:21:18 -05:00
Mike Gerwitz 6fb077d29c Version bump v0.11.{0=>1}
* configure.ac: Bump version.
2017-02-21 14:20:43 -05:00
Mike Gerwitz 68e929d2b8 Validation monitoring fixes
This does two things:

  - Ensures previous validation requests are complete before
    processing another, preventing internal state from being screwed
    up; and

  - Prevents empty diffs from triggering staging bucket events, which
    is both a performance benefit and stops ValidStateMonitor from
    getting confused and immediately marking failures as fixed in
    certain circumstances.
2017-02-21 14:19:31 -05:00
Mike Gerwitz 62996102a8 StagingBucket: Use strict mode (and fix accidental globals)
This fixes accidental global variables and enables strict mode to
prevent it in the future.

* src/bucket/StagingBucket.js: Enable strict mode.  Use const/let where
    appropriate instead of var.
2017-02-20 12:16:49 -05:00
Mike Gerwitz c5194b4ec5 StagingBucket: Do not process non-changes
Since changes trigger any event observers---which can be
expensive---it is ideal to ignore sets that do not result in any
changes to the bucket.

This also resolves issues with systems that are confused by empty
diffs.

* src/bucket/StagingBucket.js
  (_hasChanged): Add method.
  (setValues): Use it.

* test/bucket/StagingBucketTest.js: Add test case.

DEV-2299
2017-02-20 12:16:24 -05:00
Mike Gerwitz 4f7654c7c4 Liberate numerous bucket classes
* src/bucket/DelayedStagingBucket.js: Add class.
* src/bucket/QuoteDataBucket.js: Add class.
* src/bucket/StagingBucket.js: Add class.
* src/bucket/StagingBucketAutoDiscard.js: Add class.
* src/client/ClientDependencyFactory.js: Add class.
2017-02-17 15:14:17 -05:00
Mike Gerwitz ac7ec6c5f2 DataValidator: Hold concurrent requests
Since we maintain state (as a kluge for the time being to integrate
with the rest of the system), we need to be careful to protect against
concurrent requests that might mess with it before the original
request is complete.

* src/validate/DataValidator.js
  (validate, updateFailures): Hold concurrent requests.
  (_onceReady): Add method.

* test/validate/DataValidatorTest.js: Add tests.
2017-02-17 11:31:32 -05:00
Mike Gerwitz eefd268abf Revert "DataValidator: Always clear store state"
This breaks everything. :x

This reverts commit e0c2e4dc86, reversing
changes made to e610372c84.
2017-02-16 16:49:29 -05:00
Mike Gerwitz e22aa2a880 DataValidatorTest: Extract boilerplate instantiation (cleanup)
Tidy up a little bit; this thing is a mess and hard to work with.

* test/validate/DataValidatorTest
  (createStubs): Add function.
  Use it.
2017-02-16 16:20:18 -05:00
Mike Gerwitz 73390530bf Add missing #updateFailures test
Not sure how this was missing...!

* test/validate/DataValidatorTest.js: Add test.
2017-02-16 16:03:35 -05:00
Mike Gerwitz 71024bd389 DataValidator: Queue validations when incomplete
* src/validate/DataValidator.js (validate): If a validation is
    ongoing, queue requests.

* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-16 12:37:46 -05:00
Mike Gerwitz 9225924e7e Version bump v0.{10.2=>11.0} 2017-02-16 09:13:25 -05:00
Mike Gerwitz d99d1e3bed Program UI testing library 2017-02-16 09:12:44 -05:00
Mike Gerwitz 5f36d9272f Testing utilities for stubbing Program
This allows for testing assertions.  It's fairly primitive, but will
work for the time being.

* src/test/README: Add file.
* src/test/program/DummyClassifier.js: Add module.
* src/test/program/Program.js: Add class.
* src/test/program/util.js: Add module.
2017-02-15 14:19:33 -05:00
Mike Gerwitz 63aa24703b Version bump v0.10.{1=>2} 2017-02-14 08:57:35 -05:00
Mike Gerwitz e0c2e4dc86 DataValidator: Always clear store state 2017-02-14 08:56:44 -05:00
Mike Gerwitz 3b1df602e1 DataValidator: Always clear store state
In practice, not clearing the store and allowing it to use previous
state has the effect of instantly "fixing" failures if there happens
to be more than one validation call.

This was a log of debugging for a one-line change.

* src/validate/DataValidator.js (_populateStore): Always clear store.
* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-13 15:07:26 -05:00
Mike Gerwitz e610372c84 Version bump 0.10.{0=>1} 2017-02-10 13:31:58 -05:00
Mike Gerwitz 530b92fd33 FieldVisibilityEventHandler: Use new DataValidator API 2017-02-10 13:30:53 -05:00
Mike Gerwitz cc79f8e1f3 FieldVisibilityEventHandler: use new DataValidator API
I updated DataValidator but never updated the caller.  Damnit.  It's
an unfortunate side-effect of dynamic, loosely typed languages and
mitigating it requires what should be boilerplate functional tests (in
this case---functional tests are useful for many other integration
aspects).

* src/event/FieldVisibilityEventHandler.js
  (handle): Use updated DataValidator#clearFailures API, which has
    a different descriptor format.

* test/event/FieldVisibilityEventHandlerTest.js: Update test.
2017-02-09 15:20:23 -05:00
Mike Gerwitz 3ea4efb732 Version bump 0.{9.1=>10.0} 2017-02-08 11:53:05 -05:00
Mike Gerwitz e5e40020ce Clear class failures on field hide
Previous work was done to have field errors clear when any
classification in the assertion stack changes.  The last remaining
piece was to have field errors clear when the field itself is no
longer applicable.†

- Handling in `Client` was replaced with
  `FieldVisibilityEventHandler`.  The event system already existed.
- `DataValidator` and `ValidStateMonitor` just needed the ability to
  clear specific fields (`#clearFields`).

† Technically the "hide" in liza means "not applicable"; I've been
using that new terminology, but this event can't be renamed right now
because it's so heavily used.
2017-02-08 11:50:59 -05:00
Mike Gerwitz e7700e8b69 Liberate ClientDebug classes
This is a separate program of sorts that sits alongside and hooks the
Client.

* src/client/debug/AssertionClientDebugTab.js: Add class.
* src/client/debug/BucketClientDebugTab.js: Add class.
* src/client/debug/CalcClientDebugTab.js: Add class.
* src/client/debug/ClassifyClientDebugTab.js: Add class.
* src/client/debug/ClientDebug.js: Add class.
* src/client/debug/ClientDebugDialog.js: Add class.
* src/client/debug/ClientDebugTab.js: Add interface.
2017-02-08 11:24:56 -05:00
Mike Gerwitz 028606242a Integrate field visibility event handler
* src/client/Client.js
  (_hideField): Remove method (extracted into
    FieldVisibilityEventHandler).
  (handleEvent): Remove show/hide handling.
  (_handleClassMatch): Adjust to new class/API.

* src/client/ClientDependencyFactory.js
  (createClientEventHandler): Add show/hide event handlers.
2017-02-08 11:24:56 -05:00
Mike Gerwitz e26a7c3cac FieldVisibilityEventHandler: Add class
This extracts code from internal lovullo repo rating-fw (originally
Client#_hideFields), 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/event/FieldVisibilityEventHandler.js: Add class.
* test/event/FieldVisibilityEventHandlerTest.js: Add test case.
2017-02-08 11:24:56 -05:00
Mike Gerwitz ed21707920 DataValidator, ValidStateMonitor: Add #clearFailures argument
This allows clearing only the specified failures.

* src/validate/ValidStateMonitor.js
  (clearFailures): Add `fields' argument.  Make method more concise.
  (_fixFailure): Handle clearing `_failures' record.

* src/validate/DataValidator.js
  (clearFailures): Add `fields' argument.

* test/validate/ValidStateMonitorTest.js: Add test.
* test/validate/DataValidatorTest.js: Add test.
2017-02-08 11:24:56 -05:00
Mike Gerwitz dd7c2760f4 Client: Extract from internal repo
This thing is an ugly monstrosity that has witheld some pretty rough
development times.  As code is touched, it is being removed.

This depends on many things not yet in the liza repo; they'll be added
in time.

These classes were changed slightly to work within liza (e.g. paths).

* src/client/Client.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/client/ClientDependencyFactory.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-07 15:38:33 -05:00
Mike Gerwitz e3b6ee05fa tools/gen-index: Generate getters
LoVullo dropped support for IE<9, so getters can now be used to
lazy-load modules.

This also means that, during the transition from LoVullo's internal
rating-fw repo to liza, and broken require paths (program/, mainly)
will not cause problems unless the module containing those requires is
explicitly requested.

* tools/gen-index.js: Generate getters.
2017-02-07 15:38:33 -05:00
Mike Gerwitz a65f568714 UnknownEventError: use ease.js
ease.js supports Error extending now.

* src/event/UnknownEventError.js: Use easejs.
2017-02-06 16:12:26 -05:00
Mike Gerwitz bd81e2e726 Liberate event handlers
These are extracted from rating-fw commit
5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-06 16:12:26 -05:00
Mike Gerwitz 25701c747b configure.ac: fix harmony destructuring flag
:x
2017-02-06 08:57:43 -05:00
Mike Gerwitz 9c4755407a Version bump 0.9.{0=>1} 2017-02-02 14:04:31 -05:00
Mike Gerwitz 3cfb026f33 Ability to clear all errors on ValidStateMonitor 2017-02-02 14:03:24 -05:00
Mike Gerwitz c7b5ce5595 DataValidator, ValidStateMonitor: Add #clearFailures
* src/validate/DataValidator.js (clearFailures): Add public method.
* test/validate/DataValidatorTest.js: Add #clearFailures test.

* src/validate/ValidStateMonitor.js (clearFailures): Add public method.
* test/validate/ValidStateMonitorTest.js: Add #clearFailures test.
2017-02-02 14:01:13 -05:00
Mike Gerwitz 2c22d962b5 Version 0.{8=>9}.0 bump 2017-01-30 12:13:15 -05:00
Mike Gerwitz 08e0d20cad Consider classification changes on failed fields
The individual commits contain more useful detail, but since there's a
lot of _new_ code, you might be okay with looking at the full diff.

This adds support to Liza for considering classification changes when
detecting field fixes.  It can be boiled down to: abstract the bucket
diff array into a `Store`, which can also handle classification diffs,
and have `ValidStateMonitor` check that instead of the original
array.  The diff data format is unchanged.

- The diff portion of it comes together in `system/client.js` where it
  constructs the Store.

- `ValidStateMonitor` is what performs the validations, and existed
  previously; it was modified to support Promises and be
  async.  `DataValidator` extracts some logic (much less than I had
  hoped to) from `Client` in the `rating-fw` repository and glues it
  together.  If it doesn't look coherent, that's because the process
  is a bit of a mess; the overall architecture _did not_ change with
  this.

A lot of the project design changed or was abandoned upfront before
code was written: I committed my design notes in the new `liza-notes`
repo.  It notes a lot of my thoughts and design decisions, and shows a
lot of what was abandoned or simplified.
2017-01-30 12:10:39 -05:00
Mike Gerwitz 61a59db4e0 system.client: working data.diffStore
* src/system/client.js (data.diffStore): Compose all stores.
* test/system/clientTest.js: Update test case.

DEV-2296
2017-01-30 00:43:13 -05:00
Mike Gerwitz 0dcbd32202 DataValidator: accept classification results
* src/validate/DataValidator.js
  (validate): New `classes' parameter.  API BC break from previous
    commits.
  (populateStore, updateFailures): Generalize methods.

* test/validate/DataValidatorTest.js:
  Add associated test.
  Refactor existing tests to adhere to new API/expectations.

DEV-2206
2017-01-30 00:29:25 -05:00
Mike Gerwitz 28d74d7068 ValidStateMonitor: handle empty diff on past failure
See the description in the test case.  This is a bug fix.

* src/validate/ValidStateMonitor.js
  (_checkCauseFix): Do not consider an empty diff on a past failure to
    be a fix.

* test/validate/ValidStateMonitorTest.js: Add test.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 24180e704a Add DiffStore
* src/store/DiffStore.js: Add class.
* test/store/DiffStoreTest.js: Add test case.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 3289e42003 Update MemoryStore syntax to ES6
`#reduce` is much better.

* src/store/MemoryStore.js: Update syntax.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 282c0acf54 Store#clear to return self
* src/store/MemoryStore.js (clear): Promise resolve to self.
* src/store/Store.js (clear): Update docblock.
* test/store/MemoryStoreTest.js: Update test case accordingly.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz b62673791b Add PatternProxy Store trait
Life is so much less miserable now that the project is supporting ES6.

* src/store/PatternProxy.js: Add trait.
* src/store/StorePatternError.js: Add Error.
* test/store/PatternProxyTest.js: Add test case.

DEV-2296
2017-01-30 00:29:15 -05:00
Mike Gerwitz 29fb75d1a3 ES6-ify ValidStateMonitor
This also helps to demonstrate how the more concise syntax improves
readability.

* src/validate/ValidStateMonitor.js: Syntax to ES6.

DEV-2296
2017-01-29 22:44:35 -05:00
Mike Gerwitz 4d981bd39f Store#add to return self
This allows for Promise chaining (and consequently temporary classes,
great for testing).

* src/store/MemoryStore.js
  (add): Resolve promise to self.
    Modify docblock.
* src/store/Store.js (add): Modify docblock.
* src/store/Cascading.js (add): Modify docblock.

* test/store/MemoryStoreTest.js: Modify test accordingly.

DEV-2296
2017-01-29 22:44:34 -05:00
Mike Gerwitz 38b4a58dde Began system/ with client
This will contain various factories (compounded in some cases) to
instantiate various parts of a coherent system.  It aims to replace
(as one of many pieces) the ClientDependencyFactory that's referenced
in the code, which is still part of rating-fw (internal LoVullo repo
from which liza is being liberated).

* src/system/client.js: Add module.
* test/system/clientTest.js: Add functional test case.

DEV-2296
2017-01-29 22:44:34 -05:00
Mike Gerwitz 2045c76f7e Integrate Store into DataValidator, ValidStateMonitor
ValidStateMonitor now uses a Store in place of the original primitive
object-based diff format.  The original format is translated by
DataValidator.  The code is in a transitional state, and considering
the amount of time we spend on various areas of this project, will
likely stay this way for a while.

* src/validate/DataValidator.js
  (__construct): Accept Store factory parameter.
  (_store_factory): Add field.
  (_createStores): Add method.
  (_validate): Handle Store.
  (updateFailures): Add method.
  (_populateStore): Add method.

* test/validate/DataValidatorTest.js: Add tests.

* src/validate/ValidStateMonitor.js
  (update): Enforce Store diff.
    Wait to process failures until fixes are calculated.
  (_checkFailureFix): Handle asynchronous, Promise-based diff.
  (_checkCauseFix): Extract logic from _checkCauseFix.

* test/validate/ValidStateMonitorTest.js:
  Modify test cases to be Promise-based and handle async calls where
  appropriate.  That was a friggin' expensive mess.

DEV-2296
2017-01-29 22:44:27 -05:00
Mike Gerwitz 203b25f10e Add DataValidator
This extracts some gross code from Client in the rating-fw repo, which
is responsible for gluing change validations together.

* src/validate/DataValidator.js: Add class.
* test/validate/DataValidatorTest.js: Add test case.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz c8d77085ec Make BucketDataValidator public methods virtual
This class is terribly factored and not tested.

* src/validate/BucketDataValidator.js
  (validate,format): Make methods virtual.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz fb3cd11265 ValidStateMonitor#update return Promise
Stepping stone to async. fix checks.

* src/validate/ValidStateMonitor.js
  (update, detectFixes, _checkFailureFix): Return Promise.
* test/validate/ValidStateMonitorTest.js: Update to use promises.

DEV-2296
2017-01-27 15:57:40 -05:00