Skip to content

Conversation

@bncer
Copy link
Contributor

@bncer bncer commented Nov 16, 2025

Closes #371

Display elapsed time

Currently it's not live, it shows within template.

@bncer
Copy link
Contributor Author

bncer commented Nov 16, 2025

In order to show expected time it seems like I need to store success build duration from Github, database doesn't contain any related information.

@Kobzol
Copy link
Member

Kobzol commented Nov 16, 2025

I think we can do that in several steps (multiple PRs). It is enough to just show the elapsed time in the first PR (this one). Thank you! I will take a look tomorrow.

@bncer bncer marked this pull request as ready for review November 17, 2025 06:10
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thank you! Left a few comments.

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! Left one additional comment.

Once you add the <title>, it would be great to get rid of the merge commit. You can do that e.g. by git fetch origin && git rebase origin/main (assuming that your remote is called origin, it could also be upstream or something else).

@bncer
Copy link
Contributor Author

bncer commented Nov 18, 2025

I faced an issue with sqlx during compilation:

the trait bound `i32: From<std::option::Option<i32>>` is not satisfied
   --> src/database/operations.rs:136:22
    |
136 |           let record = sqlx::query_as!(
    |  ______________________^
137 | |             PullRequestModel,
138 | |             r#"
139 | |             WITH upserted_pr AS (
...   |
183 | |             params.pr_status as _,
184 | |         )
    | |_________^ the trait `From<std::option::Option<i32>>` is not implemented for `i32`

Sqlx thinks some columns nullable, even though in database these fields specified as Not Null.

@Kobzol
Copy link
Member

Kobzol commented Nov 18, 2025

Could you share the code where that happens?

@bncer
Copy link
Contributor Author

bncer commented Nov 19, 2025

Could you share the code where that happens?

in src/database/operations.rs in upsert_pull_request function
and src/database/operations.rs in update_mergeable_states_by_base_branch function

After several hours I built bors and it worked without any errors. But I tried to reproduce this by: cargo clean, rm -rf .sqlx and it fails again 😆

@bncer bncer closed this Nov 19, 2025
@bncer bncer reopened this Nov 19, 2025
@bncer
Copy link
Contributor Author

bncer commented Nov 19, 2025

With sqlx's exclamation mark (!) I lowered number of errors, but clear reason of different behavior blows my mind

### diff --git a/src/database/operations.rs b/src/database/operations.rs
index 6d31e9b..bce49ee 100644
--- a/src/database/operations.rs
+++ b/src/database/operations.rs
@@ -151,22 +151,22 @@ pub(crate) async fn upsert_pull_request(
             )
             SELECT
                 pr.id,
-                pr.repository as "repository: GithubRepoName",
+                pr.repository as "repository!: GithubRepoName",
                 pr.number as "number!: i64",
                 pr.title,
                 pr.author,
-                pr.assignees as "assignees: Assignees",
+                pr.assignees as "assignees!: Assignees",
                 (
                     pr.approved_by,
                     pr.approved_sha
                 ) AS "approval_status!: ApprovalStatus",
-                pr.status as "pr_status: PullRequestStatus",
+                pr.status as "pr_status!: PullRequestStatus",
                 pr.priority,
-                pr.rollup as "rollup: RollupMode",
-                pr.delegated_permission as "delegated_permission: DelegatedPermission",
+                pr.rollup as "rollup!: RollupMode",
+                pr.delegated_permission as "delegated_permission!: DelegatedPermission",
                 pr.base_branch,
-                pr.mergeable_state as "mergeable_state: MergeableState",
-                pr.created_at as "created_at: DateTime<Utc>",
+                pr.mergeable_state as "mergeable_state!: MergeableState",
+                pr.created_at as "created_at!: DateTime<Utc>",
                 try_build AS "try_build: BuildModel",
                 auto_build AS "auto_build: BuildModel"
             FROM upserted_pr as pr

@Kobzol
Copy link
Member

Kobzol commented Nov 19, 2025

Hmm, that's weird. What Postgres version are you using? Does this happen in cargo build, or where are the errors popping up?

@bncer
Copy link
Contributor Author

bncer commented Nov 20, 2025

I'm using postgres:16.9, which was specified in docker-compose.yml.
Yes, it was showing up in cargo build command.

For now I will leave it until I face again.

Add hours to represent

Resolve changes from review

Show time started on hover
@bncer bncer requested a review from Kobzol November 20, 2025 19:23
@bncer
Copy link
Contributor Author

bncer commented Nov 20, 2025

I placed <table class="stripe"> to the right place from MR #463, otherwise it was creating two tables

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Left one nit about the started date title. Thanks for catching the duplicated table!

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thank you! It looks great.

@Kobzol Kobzol added this pull request to the merge queue Nov 20, 2025
Merged via the queue into rust-lang:main with commit c472214 Nov 20, 2025
2 checks passed
@bncer bncer deleted the build-time-queue branch November 20, 2025 21:56
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.

Display the time of a running build on the queue page

2 participants