status-im / open-bounty

Enable communities to distribute funds to push their cause forward.
https://openbounty.status.im/
GNU Affero General Public License v3.0
118 stars 36 forks source link

Issues with titles longer than 256 chars cannot be a bounties #444

Open churik opened 6 years ago

churik commented 6 years ago

Description

Type: Bug Summary: if you create an issue with long title (> 256 chars) and put bounty label on it - contract is not deployed because issue_title in DB has restriction 256 chars

Expected behavior

contract is deployed

Actual behavior

contract is not deployed

Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO issues (repo_id, issue_id, issue_number, title)
  SELECT
    124034908 ,
    317955458 ,
    196 ,
    'Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+)'
  WHERE NOT exists(SELECT 1
                   FROM issues
                   WHERE repo_id = 124034908 AND issue_id = 317955458 ) was aborted: ERROR: value too long for type character varying(256)  Call getNextException to see other errors in the batch.
    at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148) ~[commiteth.jar:na]
    at org.postgresql.core.ResultHandlerDelegate.handleError(ResultHandlerDelegate.java:50) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2191) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:472) ~[commiteth.jar:na]
    at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:791) ~[commiteth.jar:na]
    at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_batch.invokeStatic(jdbc.clj:526) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:519) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_execute_prepared_statement$fn__1400.invoke(jdbc.clj:937) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:732) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:702) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:715) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:702) ~[commiteth.jar:na]
...
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(256)
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190) ~[commiteth.jar:na]

Reproduction

Requirements: GH account is whitelisted, signed app, test application is added to repo;

Note: PRs with long names also are not recognizable as open claims. The reason is the same.

Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO pull_requests (pr_id,
  repo_id,
  pr_number,
  title,
  issue_number,
  issue_id,
  commit_sha,
  user_id,
  state)
VALUES( 184614240 ,
  112186688 ,
  183 ,
  'Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+)gggggghhhhhhggg' ,
  182 ,
  318351300 ,
  'e8d757d07bde42ad8ba0e34194e424548041a784' ,
  4557972 ,
  0 )
ON CONFLICT (pr_id,issue_id) DO UPDATE
SET
  state = 0 ,
  issue_number = 182 ,
  issue_id = 318351300 ,
  title = 'Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+) Issue with long title (3+)gggggghhhhhhggg' ,
  updated = timezone('utc'::text, now()),
  commit_sha = 'e8d757d07bde42ad8ba0e34194e424548041a784'  was aborted: ERROR: value too long for type character varying(256)  Call getNextException to see other errors in the batch.
    at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148) ~[commiteth.jar:na]
    at org.postgresql.core.ResultHandlerDelegate.handleError(ResultHandlerDelegate.java:50) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2191) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:472) ~[commiteth.jar:na]
    at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:791) ~[commiteth.jar:na]
    at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_batch.invokeStatic(jdbc.clj:526) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:519) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_execute_prepared_statement$fn__8872.invoke(jdbc.clj:937) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:732) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:702) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:715) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:702) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_execute_prepared_statement.invokeStatic(jdbc.clj:936) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:922) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_prepared.invokeStatic(jdbc.clj:960) ~[commiteth.jar:na]
    at clojure.java.jdbc$db_do_prepared.invoke(jdbc.clj:940) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_BANG_$execute_helper__8931.invoke(jdbc.clj:1201) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1203) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1185) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1196) ~[commiteth.jar:na]
    at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1185) ~[commiteth.jar:na]
    at clojure.lang.AFn.applyToHelper(AFn.java:156) ~[commiteth.jar:na]
    at clojure.lang.AFn.applyTo(AFn.java:144) ~[commiteth.jar:na]
    at clojure.core$apply.invokeStatic(core.clj:661) ~[commiteth.jar:na]
    at clojure.core$apply.invoke(core.clj:652) ~[commiteth.jar:na]
    at hugsql.adapter.clojure_java_jdbc.HugsqlAdapterClojureJavaJdbc.execute(clojure_java_jdbc.clj:12) ~[na:na]
    at hugsql.adapter$fn__11260$G__11244__11265.invoke(adapter.clj:3) ~[commiteth.jar:na]
    at hugsql.adapter$fn__11260$G__11243__11271.invoke(adapter.clj:3) ~[commiteth.jar:na]
    at clojure.lang.Var.invoke(Var.java:396) ~[commiteth.jar:na]
    at hugsql.core$db_fn_STAR_$y__11515.doInvoke(core.clj:463) ~[commiteth.jar:na]
    at clojure.lang.RestFn.invoke(RestFn.java:445) ~[commiteth.jar:na]
    at hugsql.core$db_fn_STAR_$y__11515.invoke(core.clj:453) ~[commiteth.jar:na]
    ... 43 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(256)
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477) ~[commiteth.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190) ~[commiteth.jar:na]
    ... 73 common frames omitted