New issue
Advanced search Search tips

Issue 696767 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Extensions: Presubmit script broken.

Project Member Reported by karandeepb@chromium.org, Feb 27 2017

Issue description

What steps will reproduce the problem?
(1) On master, insert an empty line in a template file, say chrome/common/extensions/docs/templates/private/type.html
(2) Run presubmit checks

What is the expected result?
Checks pass.

What happens instead?
Presubmit checks fail

** Presubmit ERRORS **
IntegrationTest failed!

./jsc_view_test.py (0.42s) failed
testAddRules (__main__.JSCViewTest) ... ok
testCreateId (__main__.JSCViewTest) ... ok
testFormatValue (__main__.JSCViewTest) ... ok
testGetEventByNameFromEvents (__main__.JSCViewTest) ... ok
testGetIntroList (__main__.JSCViewTest) ... ok
testGetAPINodeAvailability (__main__.JSCViewWithNodeAvailabilityTest) ... tabs must have a "description" field. This will appear on the API summary page.
FAIL
testGetAPIAvailability (__main__.JSCViewWithoutNodeAvailabilityTest) ... ok

======================================================================
FAIL: testGetAPINodeAvailability (__main__.JSCViewWithNodeAvailabilityTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./jsc_view_test.py", line 386, in testGetAPINodeAvailability
    Request.ForTest(''))
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 639, in CreateJSCView
    samples).ToDict(request)
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 152, in ToDict
    'functions': self._GenerateFunctions(self._jsc_model.functions),
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 246, in _GenerateFunctions
    return [self._GenerateFunction(f) for f in functions.values()]
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 270, in _GenerateFunction
    function_dict['parameters'].append(self._GenerateProperty(param))
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 382, in _GenerateProperty
    'availability': self._GetAvailabilityTemplate()
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/jsc_view.py", line 465, in _GetAvailabilityTemplate
    availability_info = self._current_node.GetAvailability()
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/api_schema_graph.py", line 200, in GetAvailability
    parent_node_availability = self._LookupAvailability(self._GetParentPath())
  File "/b/build/slave/linux/build/src/chrome/common/extensions/docs/server2/api_schema_graph.py", line 83, in _GetParentPath
    assert self._lookup_path[-3] == 'events'
AssertionError
 
The failure is api_schema_graph.py. The path for which the assertion fails is:

['functions', u'addEventListener', 'parameters', u'callback']

The code assumes that only events have callbacks and functions don't.
Cc: dmazz...@chromium.org
Labels: -Pri-3 Pri-2
Bisected this using the commands:

git bisect start HEAD 90e395fb881a5a3f25b6cd425370baa2741090f8 --
git bisect run python chrome/common/extensions/docs/server2/integration_test.py -a

Responsible commit: https://codereview.chromium.org/2649373002

Changes in tools/json-schema-compiler seem responsible.

Aside: Change of stuff in tools/json-schema-compiler, should have triggered running  chrome/common/extensions/docs/server2/integration_test.py. 
Owner: karandeepb@chromium.org
Status: Assigned (was: Available)
There's also another similar failure. 

Run python chrome/common/extensions/docs/server2/jsc_view_test.py

It fails with-

.....tabs must have a "description" field. This will appear on the API summary page.
F.
======================================================================
FAIL: testGetAPINodeAvailability (__main__.JSCViewWithNodeAvailabilityTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "chrome/common/extensions/docs/server2/jsc_view_test.py", line 386, in testGetAPINodeAvailability
    Request.ForTest(''))
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 638, in CreateJSCView
    samples).ToDict(request)
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 152, in ToDict
    'functions': self._GenerateFunctions(self._jsc_model.functions),
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 246, in _GenerateFunctions
    return [self._GenerateFunction(f) for f in functions.values()]
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 270, in _GenerateFunction
    function_dict['parameters'].append(self._GenerateProperty(param))
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 382, in _GenerateProperty
    'availability': self._GetAvailabilityTemplate()
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/jsc_view.py", line 464, in _GetAvailabilityTemplate
    availability_info = self._current_node.GetAvailability()
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/api_schema_graph.py", line 200, in GetAvailability
    parent_node_availability = self._LookupAvailability(self._GetParentPath())
  File "/Users/karandeepb/Desktop/chromium/src/chrome/common/extensions/docs/server2/api_schema_graph.py", line 83, in _GetParentPath
    assert self._lookup_path[-3] == 'events'

----------------------------------------------------------------------
Ran 7 tests in 0.416s

The failing path in this case is ['functions', u'get', 'parameters', u'callback'] for the tabs API.

Didn't bisect this, but the issue is similar.
Project Member

Comment 5 by bugdroid1@chromium.org, Mar 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/08614915649c30c0278a9b154825e370b819a6de

commit 08614915649c30c0278a9b154825e370b819a6de
Author: karandeepb <karandeepb@chromium.org>
Date: Tue Mar 14 18:28:01 2017

Extensions: Fix DocServer assert failures.

Currently, there are a couple of assert failures happening for the DocServer.
Two issues are involved:

  - r446160 updated tools/json_schema_compiler/model.py. It changed the logic to
    assign the callback for a function, so that only the last parameter function
    of a function could be recognised as a callback. This broke some DocServer
    tests and hence the extension presubmit script.
  - Recently the API endpoint
    https://omahaproxy.appspot.com/history.json?channel=dev&os=win&json=1 that
    we use to fetch the branch for a particular Chrome version, stopped
    providing info. for version 15. This led to an assert failure when
    generating the Availability info. for the Webstore API.

This CL fixes the issues so that the extension presubmit tests pass. For issue
1, a new category type is introduced to APICategorizer for the internal APIs. It
is ensured that the API data source does not generate info. for internal APIs
which are never documented. Existing tests are updated to work around the fact
that only the last parameter of a function can be recognised as a callback.

For  issue 2 , it is ensured that the assert failure is not reached. However, the
core issue (omahaproxy endpoint not providing details of all Chrome versions)
still needs to be tackled.

BUG= 696767 ,  700234 

Review-Url: https://codereview.chromium.org/2738623003
Cr-Commit-Position: refs/heads/master@{#456767}

[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/api_categorizer.py
[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/api_data_source.py
[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/api_schema_graph.py
[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/app.yaml
[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/availability_finder.py
[modify] https://crrev.com/08614915649c30c0278a9b154825e370b819a6de/chrome/common/extensions/docs/server2/test_data/object_level_availability/tabs.py

Status: Fixed (was: Assigned)

Sign in to add a comment