Repository navigation
fix(build): remove fat LTO from development profile - #2013
Conversation
There was a problem hiding this comment.
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
Containerfileempty 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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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-suggestionsskill now require replying on every PR suggestion thread (includingno-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
- 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.
|
ACK 309426b |
- 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.
309426b to
f375d34
Compare
|
ACK f375d34 |
| 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. |
| 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} |
da2ce7
left a comment
There was a problem hiding this comment.
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.
Summary
lto = "fat"override from[profile.dev], restoring Cargo's default development-profile behavior[profile.release]for production execution performanceNoEmptyContinuationwarningValidation
cargo test --tests --benches --examples --workspace --all-targets --all-featuresdocker 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=jsonCloses #1875