https://dev.arvados.org/https://dev.arvados.org/favicon.ico?15576888422021-04-23T14:12:00ZArvadosArvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=921432021-04-23T14:12:00ZLucas Di Pentimalucas.dipentima@curii.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/92143/diff?detail_id=88817">diff</a>)</li></ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922032021-04-27T13:17:33ZLucas Di Pentimalucas.dipentima@curii.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li></ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922072021-04-27T16:39:43ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>Sending JSON data via <code>curl</code> is working correctly:</p>
<pre>
$ curl -v -X PUT --data '{"collection":{"name":"[Deprecated]"}}' -H "Authorization: OAuth2 xxxtokenxxx" -H "Content-Type: application/json" https://ce8i5.arvadosapi.com/arvados/v1/collections/ce8i5-4zz18-9m0e1jso8boqqxy
</pre>
<p>OTOH, Chrome's inspector shows what seems to be a correct request body, for example while creating a new collection</p>
<pre>
{"name":"{A new coll","description":null,"preserve_version":true}
</pre>
<p>...so I'm not sure what's going on yet.</p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922132021-04-27T17:15:59ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>I've found different behaviors depending on the shape of the passed JSON payload.</p>
<p>This is what wb2 is trying to pass (failing request):</p>
<pre>{"name":"[Some name]"}</pre>
<p>...but the following does work ok:</p>
<pre>{"collection":{"name":"[Some name]"}}</pre>
<p>...so I'm wondering now whether this is a client or a backend bug.</p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922182021-04-27T19:56:13ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>From chat:</p>
<p>Tom: I suspect it's either controller or rails that needs fixing. foo=[true] and foo="bar" are ambiguous in a form-encoded body, but {"foo":"[bar]"} is not ambiguous in a json-encoded body, so we should be able to handle that correctly.<br />Suspect part/all of the fix will be making controller use a JSON request body instead of formencoded. I'm not sure why we ever would have used formencoded. I vaguely recall it could be that _method=GET didn't work in a JSON body... if that's the case, maybe we can use the X-Http-Method-Override header instead?</p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922462021-04-28T14:29:07ZLucas Di Pentimalucas.dipentima@curii.com
<ul><li><strong>Target version</strong> changed from <i>2021-04-28 bughunt sprint</i> to <i>2021-05-12 sprint</i></li></ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=922642021-04-28T15:40:23ZPeter Amstutzpeter.amstutz@curii.com
<ul><li><strong>Category</strong> changed from <i>Workbench2</i> to <i>API</i></li><li><strong>Project</strong> changed from <i>Arvados Workbench 2</i> to <i>Arvados</i></li></ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=923522021-05-04T16:54:49ZPeter Amstutzpeter.amstutz@curii.com
<ul><li><strong>Blocks</strong> <i><a class="issue tracker-6 status-3 priority-4 priority-default closed parent" href="/issues/17512">Idea #17512</a>: Release Arvados 2.2</i> added</li></ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925032021-05-11T04:26:58ZTom Cleggtom@curii.com
<ul></ul><p>in (*lib/controller/router.router)loadRequestParams():</p>
<pre><code class="go syntaxhl"> <span class="c">// The Ruby "arv" cli tool sends a </span>
<span class="c">// JSON-encode params map with </span>
<span class="c">// JSON-encoded values. </span>
</code></pre>
<p>It seems that in order for "arv" to work, we double-decode a top level params, so this works:</p>
<pre>
{"properties":"{\"foo\":\"bar\"}"}
</pre>
<p>...but we don't double-decode lower levels, so this also works:</p>
<pre>
{"collection":{"name":"{\"foo\":\"bar\"}"}}
</pre>
<p>fwiw the examples at <a class="external" href="https://doc.arvados.org/main/api/requests.html">https://doc.arvados.org/main/api/requests.html</a> put updated fields at lower levels.</p>
<p>Is it really annoying to change workbench2 to send a body like <code>{"collection":{"name":"[foo]"}}</code> instead of <code>{"name":"foo"}</code>?</p>
Other possibilities:
<ul>
<li>detect afflicted versions of Ruby CLI/SDK (via user-agent?), fix current Ruby CLI/SDK, and turn off this weird behavior for normal clients</li>
<li>treat malformed JSON as a string, which would probably solve most real-world cases (like "[foo]") but would still break confusingly on other cases (like "[]").</li>
</ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925042021-05-11T05:36:17ZTom Cleggtom@curii.com
<ul></ul><p>17582-failing-test @ <a class="changeset" title="17582: Test string params that look a little like JSON. Arvados-DCO-1.1-Signed-off-by: Tom Clegg..." href="https://dev.arvados.org/projects/arvados/repository/arvados/revisions/0e1853309e69b6be2a214ccf66a335e39e8eaa4a">0e1853309e69b6be2a214ccf66a335e39e8eaa4a</a> -- <a class="external" href="https://ci.arvados.org/view/Developer/job/developer-run-tests/2466/"<a href="https://ci.arvados.org/view/Developer/job/developer-run-tests/2466/">developer-run-tests: #2466 <img src="https://ci.arvados.org/buildStatus/icon?job=developer-run-tests&build=2466" alt="" /></a></a></p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925112021-05-11T15:28:31ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>Ok, so as suggested by Tom, I fixed it on the wb2 side: <a class="changeset" title="17582: Merge branch 'master' into 17582-square-brackets-on-names-fix Arvados-DCO-1.1-Signed-off-..." href="https://dev.arvados.org/projects/arvados/repository/arvados-workbench2/revisions/c0d7c33919f2ab55ada391fd4223483b060166a5">arvados-workbench2|c0d7c33</a> - branch: <code>17582-square-brackets-on-names-fix</code><br />Test run: <a class="external" href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/407/"<a href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/407/">developer-tests-workbench2: #407 <img src="https://ci.arvados.org/buildStatus/icon?job=developer-tests-workbench2&build=407" alt="" /></a></a></p>
<ul>
<li>Updated the common resource service to send payloads of the form <code>{rsc_name: { data }}</code> instead of just a JSON object with the plain data.</li>
<li>Updated tests.</li>
</ul> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925152021-05-11T16:02:20ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>Rebased and added integration tests at <a class="changeset" title="17582: Fixes bug by avoiding an JSON param decoding issue on controller. Makes create and update..." href="https://dev.arvados.org/projects/arvados/repository/arvados-workbench2/revisions/d1400d750add1a427bf2def7ed61abe213b147c5">arvados-workbench2|d1400d7</a><br />Test run: <a class="external" href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/409/"<a href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/409/">developer-tests-workbench2: #409 <img src="https://ci.arvados.org/buildStatus/icon?job=developer-tests-workbench2&build=409" alt="" /></a></a></p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925162021-05-11T16:53:27ZLucas Di Pentimalucas.dipentima@curii.com
<ul></ul><p>Fixes cypress test to support testing names with <code>{curly braces}</code> at <a class="changeset" title="17582: Fixes test to avoid treating '{strings}' like cypress commands. Arvados-DCO-1.1-Signed-of..." href="https://dev.arvados.org/projects/arvados/repository/arvados-workbench2/revisions/52517c004729bb893cf1ba8953def1947d20a66a">arvados-workbench2|52517c0</a><br />Test run: <a class="external" href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/412/"<a href="https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/412/">developer-tests-workbench2: #412 <img src="https://ci.arvados.org/buildStatus/icon?job=developer-tests-workbench2&build=412" alt="" /></a></a></p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925192021-05-11T17:10:26ZTom Cleggtom@curii.com
<ul></ul><p>This LGTM, thanks!</p> Arvados - Bug #17582: Cannot assign names that start with '['https://dev.arvados.org/issues/17582?journal_id=925262021-05-11T18:04:18ZLucas Di Pentimalucas.dipentima@curii.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li></ul>