Skip to content

fix(build): remove fat LTO from development profile - #2013

Merged
josecelano merged 11 commits into
torrust:developfrom
josecelano:1875-review-lto-fat-in-dev-profile
Jul 21, 2026
Merged

josecelano merged 11 commits into
torrust:developfrom
josecelano:1875-review-lto-fat-in-dev-profile

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

  • remove the obsolete lto = "fat" override from [profile.dev], restoring Cargo's default development-profile behavior
  • retain fat LTO in [profile.release] for production execution performance
  • remove an empty Containerfile continuation line that produced Docker's NoEmptyContinuation warning
  • convert the issue specification to folder format and add the LTO investigation record

Validation

  • cargo test --tests --benches --examples --workspace --all-targets --all-features
  • docker build --target debug --tag torrust-tracker:debug --file Containerfile .
  • docker build --target release --tag torrust-tracker:release --file Containerfile .
  • docker build --target recipe --file Containerfile .
  • TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh --format=json

Closes #1875

Copilot AI review requested due to automatic review settings July 21, 2026 10:35
@josecelano josecelano self-assigned this Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves developer build and CI iteration speed by removing an unnecessary lto = "fat" override from the development Cargo profile, while keeping fat LTO for production release builds. It also cleans up a minor Dockerfile warning and migrates the #1875 issue spec into the repository’s folder-based issue format with an attached research record.

Changes:

  • Remove [profile.dev].lto = "fat" to restore Cargo’s default dev-profile LTO behavior.
  • Keep [profile.release].lto = "fat" unchanged for optimized production artifacts.
  • Fix a Containerfile empty continuation line warning and convert the #1875 spec into folder format with a research note.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Cargo.toml Removes dev-profile fat LTO while retaining release-profile fat LTO.
Containerfile Removes an empty continuation line that triggered Docker’s NoEmptyContinuation warning.
docs/issues/open/1875-review-lto-fat-in-dev-profile/ISSUE.md New folder-format issue spec documenting scope, verification, and acceptance criteria.
docs/issues/open/1875-review-lto-fat-in-dev-profile/research.md Adds investigation notes and rationale for restoring dev-profile defaults.
docs/issues/open/1875-review-lto-fat-in-dev-profile.md Removes the old standalone issue-spec file in favor of the new folder format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings July 21, 2026 10:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 21, 2026 10:55
@josecelano
josecelano requested a review from a team as a code owner July 21, 2026 10:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

@codecov

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.51%. Comparing base (f797ea7) to head (f375d34).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2013      +/-   ##
===========================================
+ Coverage    81.20%   81.51%   +0.30%     
===========================================
  Files          340      340              
  Lines        24000    24000              
  Branches     24000    24000              
===========================================
+ Hits         19490    19564      +74     
+ Misses        4200     4147      -53     
+ Partials       310      289      -21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings July 21, 2026 11:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

docs/pr-reviews/pr-2013-copilot-suggestions.md:32

  • The Workflow section still omits the required “reply before resolve” step, even though the template and the process-copilot-suggestions skill now require replying on every PR suggestion thread (including no-action) before resolving. This doc should match the template/skill so it doesn’t guide future audits to resolve threads without a visible PR reply.
3. Process suggestions one by one:
   - decide `action` or `no-action`
   - if `action`, apply change and validate
   - if needed, commit changes
   - reply on the PR thread with the fix commit and outcome, or the no-action rationale
   - resolve the PR thread

Copilot AI review requested due to automatic review settings July 21, 2026 11:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 21, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 11:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings July 21, 2026 11:47
josecelano added a commit to josecelano/torrust-tracker that referenced this pull request Jul 21, 2026
- reply-to-thread.sh: guard against empty/null REPLY_URL from GraphQL;
  exit 1 if the mutation returns no comment URL so callers detect failure.
- reply-and-resolve-thread.sh: same guard before proceeding to resolve,
  preventing a silent resolve when the reply was never posted.
- check-thread-reply-status.sh: replace printf JSON construction with
  jq -n / --argjson so url:null is emitted as JSON null instead of the
  string "null".

Addresses Copilot review threads PRRT_kwDOGp2yqc6Sj3Ce,
PRRT_kwDOGp2yqc6Sj3Cy, PRRT_kwDOGp2yqc6Sj3DE on PR torrust#2013.
@josecelano

Copy link
Copy Markdown
Member Author

ACK 309426b

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

```bash
git add <files>
git commit -S -m "chore(review): <concise description>"
git commit -S -m "fix(review): <concise description>"
- reply-to-thread.sh: guard against empty/null REPLY_URL from GraphQL;
  exit 1 if the mutation returns no comment URL so callers detect failure.
- reply-and-resolve-thread.sh: same guard before proceeding to resolve,
  preventing a silent resolve when the reply was never posted.
- check-thread-reply-status.sh: replace printf JSON construction with
  jq -n / --argjson so url:null is emitted as JSON null instead of the
  string "null".

Addresses Copilot review threads PRRT_kwDOGp2yqc6Sj3Ce,
PRRT_kwDOGp2yqc6Sj3Cy, PRRT_kwDOGp2yqc6Sj3DE on PR torrust#2013.
Added rows for PRRT_kwDOGp2yqc6Sj3Ce, PRRT_kwDOGp2yqc6Sj3Cy,
PRRT_kwDOGp2yqc6Sj3DE — all resolved in commit 3039b38.
Copilot AI review requested due to automatic review settings July 21, 2026 13:24
@josecelano
josecelano force-pushed the 1875-review-lto-fat-in-dev-profile branch from 309426b to f375d34 Compare July 21, 2026 13:24
@josecelano

Copy link
Copy Markdown
Member Author

ACK f375d34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment on lines +5 to +6
Issue and EPIC specs use a folder named after the GitHub issue. The primary specification file
inside the folder is `ISSUE.md` for issues or `EPIC.md` for EPICs.
Comment on lines +21 to +25
Output:
- JSON lines to stdout, one per unresolved thread:
{"thread_id":"...","path":"...","url":"...","has_reply":true|false}
- Summary line at the end:
{"summary":true,"total":N,"with_reply":N,"without_reply":N}
@josecelano
josecelano merged commit a4105db into torrust:develop Jul 21, 2026
20 checks passed

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a post-merge review of #2013 as the change stands at e170b9620 on the default branch.

What still runs: the profile change holds, with [profile.dev] at Cargo.toml:249-251 setting only debug = 1 and opt-level = 1, and [profile.release] keeping lto = "fat" at Cargo.toml:255. The stub-file list the Containerfile edit touched is no longer in that file, and check-thread-reply-status.sh was replaced in 65f5ba4. The two reply scripts this pull request added are live byte for byte: e3c24d6 moved them to .claude/skills/resolve-review-threads/scripts/, and the audit records still show them in use, for example docs/pr-reviews/pr-2716-review/PR-REVIEW.md:253. The description covers only the build-profile and container edits. It does not mention these scripts, which post replies to review threads and resolve them, or the other review-workflow files, and none of its validation commands runs either script. Its claim that the change restores the default development-profile behaviour is true for LTO only, because the profile still overrides debug and opt-level.

[Minor] Both scripts pass the reply text as -F body="${BODY}" (.claude/skills/resolve-review-threads/scripts/reply-and-resolve-thread.sh:90, .claude/skills/resolve-review-threads/scripts/reply-to-thread.sh:78). gh api -F applies its documented magic conversion to the value, so the body is not always sent as written. A reply that begins with @, such as @reviewer fixed in ..., is taken as a file name: the call fails with a file-not-found error, or, when the rest of the text names a readable path such as @.env, the contents of that file are posted publicly in place of the reply. A body of exactly true, false, null or an integer is sent as a non-string value, which the String! variable rejects. {owner}, {repo} and {branch} are replaced with values from the local checkout, so a reply quoting the format! call at contrib/dev-tools/checks/ci-gate/src/change_detection.rs:201, which contains {branch}, is posted with the current branch name in its place. --body-file gives no protection, because the file is read into the same variable (reply-and-resolve-thread.sh:71, reply-to-thread.sh:64). Smallest fix: use -f body="${BODY}" (a raw string field) in both scripts, and -f threadId= for the ID as well.

[Minor] At .claude/skills/resolve-review-threads/scripts/reply-and-resolve-thread.sh:111-122 the reply has already been posted when the resolve call runs. If that call fails, set -e stops the script with exit status 1 and an empty stdout. That is the same status as a reply that was never posted, and the reply URL obtained at line 88 is never printed. The repository documents an identity that may reply but not resolve (viewerCanResolve false, .claude/skills/resolve-review-threads/SKILL.md:115-116, .claude/skills/process-pr-review/SKILL.md:112). For such an identity, or after a transient error on the second call, the thread has the reply, the caller has no URL to record, and a retry posts a second reply. Line 122 also prints "resolved":true without reading the isResolved field the mutation asks for. Smallest fix: run the resolve call under if ! and, on failure, print a line with the reply URL and "resolved":false, then exit with its own status. Take resolved from --jq '.data.resolveReviewThread.thread.isResolved' instead of discarding the response.

[Nit] An option given last with no value, such as a trailing --thread-id or --body followed by an unquoted empty variable, reaches shift 2 with one argument left. The shift fails and set -e ends the script with exit status 1 and no message (reply-and-resolve-thread.sh:34, :38, :42; reply-to-thread.sh:31, :35, :39). Smallest fix: test [[ $# -ge 2 ]] in each branch that takes a value, and report the missing value with exit status 2, as the other usage errors do.

[Nit] reply-and-resolve-thread.sh:81 builds the --dry-run line with printf and %s from the unchecked thread ID, so an ID that contains a double quote or a backslash produces an invalid JSON line. Line 122 and reply-to-thread.sh:96 are built the same way, but by then the ID has passed the remote lookup. This pull request already moved check-thread-reply-status.sh to a JSON encoder for the same reason, and the same change fits here.

[Nit] No skill at e170b9620 names either script. .claude/skills/resolve-review-threads/SKILL.md:9 lists only resolve-all-unresolved-threads.sh as a related artifact. .claude/skills/process-pr-review/SKILL.md:103 requires a reply on each thread before it is resolved, but does not say how to post one; the references were removed in 62dc767. The scripts are still called, yet their stdout line and exit statuses are not documented anywhere a caller would look. Smallest fix: list both scripts in the resolve-review-threads skill with their output and exit statuses, or remove them if the plain resolve call in that skill is the intended path.

Checked and found sound: every expansion of the body, the ID and the file path is quoted, and nothing passes through eval or word splitting, so neither the body nor the ID can inject shell commands. The reply is posted before the resolve, and an empty or null reply URL stops the script before it resolves (reply-and-resolve-thread.sh:103-106, added in 8c2cf5d within this pull request). The existence check for --body-file works, and failed remote calls are not masked: set -euo pipefail applies, and gh api exits non-zero on GraphQL errors. Neither script reads or prints a credential, and no workflow under .github/workflows calls either one. The dev profile no longer enables fat LTO, while release still does.

This branch was previously deployed

1 inactive deployment
coverage — f375d34d Deployed Jul 21, 2026 by josecelano via Generate Coverage Report #1636
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.

Review and fix lto = "fat" in [profile.dev]

3 participants