dedup: import _load_env from helpers + add dupehound CI#448
dedup: import _load_env from helpers + add dupehound CI#448giattijunior wants to merge 3 commits into
Conversation
- Monthly Renovate run (2nd of month, 02:00 BRT) - minimumReleaseAge: 14 days (supply-chain protection) - Python deps via pep621 manager - Major bumps require manual review
admin.py and daemon.py each defined _load_env and _load_env_file identically (admin.py: 12-30, daemon.py: 10-28). Both now import from helpers.py, which is the canonical source (was already exporting both via module-level _load_env() side effect). CI: - .github/workflows/dupehound.yml: scan (slop score) and check (--diff against base) jobs. check is continue-on-error for now; promote to gate after FP rate <10% over ~10 PRs. Slop score: 0.9% -> 0.0% (4 -> 0 clusters, 18 lines eliminated). 40/40 unit tests pass.
There was a problem hiding this comment.
2 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/dupehound.yml">
<violation number="1" location=".github/workflows/dupehound.yml:30">
P2: Unpinned dupehound binary download without integrity verification introduces supply-chain and reproducibility risk</violation>
</file>
<file name=".github/workflows/renovate.yml">
<violation number="1" location=".github/workflows/renovate.yml:15">
P1: Third-party GitHub Action `renovatebot/github-action` is pinned to a mutable tag (`@v41`) instead of an immutable commit SHA, enabling supply-chain drift. The repo already pins actions to commit SHAs in `dupehound.yml`; this new workflow should follow the same pattern.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Self-hosted Renovate | ||
| uses: renovatebot/github-action@v41 |
There was a problem hiding this comment.
P1: Third-party GitHub Action renovatebot/github-action is pinned to a mutable tag (@v41) instead of an immutable commit SHA, enabling supply-chain drift. The repo already pins actions to commit SHAs in dupehound.yml; this new workflow should follow the same pattern.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/renovate.yml, line 15:
<comment>Third-party GitHub Action `renovatebot/github-action` is pinned to a mutable tag (`@v41`) instead of an immutable commit SHA, enabling supply-chain drift. The repo already pins actions to commit SHAs in `dupehound.yml`; this new workflow should follow the same pattern.</comment>
<file context>
@@ -0,0 +1,20 @@
+ uses: actions/checkout@v4
+
+ - name: Self-hosted Renovate
+ uses: renovatebot/github-action@v41
+ with:
+ configurationFile: .github/renovate.json5
</file context>
| fetch-depth: 0 | ||
| - name: Install dupehound | ||
| run: | | ||
| curl -sL https://github.com/Rafaelpta/dupehound/releases/latest/download/dupehound-x86_64-unknown-linux-gnu.tar.gz | tar xz |
There was a problem hiding this comment.
P2: Unpinned dupehound binary download without integrity verification introduces supply-chain and reproducibility risk
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/dupehound.yml, line 30:
<comment>Unpinned dupehound binary download without integrity verification introduces supply-chain and reproducibility risk</comment>
<file context>
@@ -0,0 +1,58 @@
+ fetch-depth: 0
+ - name: Install dupehound
+ run: |
+ curl -sL https://github.com/Rafaelpta/dupehound/releases/latest/download/dupehound-x86_64-unknown-linux-gnu.tar.gz | tar xz
+ sudo mv dupehound /usr/local/bin/
+ - name: Block new duplicates vs base
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f648fb3ffd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| uses: renovatebot/github-action@v41 | ||
| with: | ||
| configurationFile: .github/renovate.json5 | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
I checked renovatebot/github-action's token docs; they state that GITHUB_TOKEN can't be used to authenticate Renovate because PRs it creates do not trigger PR/push CI. In this workflow that means scheduled dependency PRs, including the github-actions manager configured in .github/renovate.json5, can be opened without this repo's test workflows ever running, so use a PAT or GitHub App token secret such as RENOVATE_TOKEN instead.
Useful? React with 👍 / 👎.
| name: Block new duplicates | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| continue-on-error: true |
There was a problem hiding this comment.
Remove the soft-fail from duplicate gate
GitHub's workflow syntax says job-level continue-on-error: true prevents a workflow run from failing when that job fails. Since this is set on the only job that runs dupehound check, a PR that introduces duplicates will still get a passing workflow instead of being blocked by the “Block new duplicates” check; drop this flag if the gate is meant to enforce the check.
Useful? React with 👍 / 👎.
Summary
First pass of
dupehoundintegration: import_load_envfrom the existing canonical source inhelpers.py, and add the CI workflow from upstreamdocs/ci.md.Changes
Source
src/browser_harness/admin.py: remove local_load_envand_load_env_filedefinitions, import fromhelpers(was duplicated, identical 18-line body atadmin.py:12-30).src/browser_harness/daemon.py: same change (was duplicated atdaemon.py:10-28).helpers.pywas already the canonical source — both_load_envand_load_env_filewere defined there, and module-level_load_env()was called as a side effect on import.CI
.github/workflows/dupehound.yml:scan(slop score) andcheck(--diffagainst base) jobs.checkruns withcontinue-on-error: true— promote to gate after FP rate <10% over ~10 PRs.Metrics
Validation
pytest tests/unit/: 40/40 passdupehound check --diff fork/main .on this branch: clean (no new duplicates introduced)Summary by cubic
Deduplicated env loading by importing
_load_envfromhelpersin the harness. AddeddupehoundCI to flag new duplicates and set up Renovate for monthly dependency updates.Refactors
_load_envand_load_env_filefromsrc/browser_harness/admin.pyandsrc/browser_harness/daemon.py; import both fromhelpersto use the canonical implementation.CI
.github/workflows/dupehound.ymlwithcheck(diff vs base, continue-on-error) andscan(slop score) jobs;actions/checkoutpinned to a commit..github/workflows/renovate.ymland.github/renovate.json5(monthly run,pep621andgithub-actionsmanagers, 14-day minimum age,dependencieslabel).Written for commit f648fb3. Summary will update on new commits.