GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(nix): keep T3 Code from sending telemetry by furedea-agent[bot] · Pull Request #507 · furedea/dotfiles Conversation
Contributor
T3 Code が既定で送るテレメトリ( Closes #506
ブロックしないホスト( 確認
範囲
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsSet T3CODE_TELEMETRY_ENABLED=false in the shell, the t3-server agent and the launchd environment, write a managed policy with limits.telemetry false, block the telemetry and relay hosts in /etc/hosts, and check the setup and the T3 bundle's endpoints whenever the T3 package changes (ADR-0048). Closes #506 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Relay tracing stops when either telemetry is off or OTel export is disabled, so set both as belt and braces in the shell, the t3-server agent and the login launchctl setenv agent (ADR-0048). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| printf x | ||
| ) | ||
| # Both sides carry the sentinel x, so trailing newlines take part in the comparison. | ||
| if [[ "$_updated"$'\n'x == "$_current" ]]; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: The right side of == inside [[ ]] is unquoted, so bash treats the file contents in $_current as a glob pattern, not a literal string. If /etc/hosts has *, ?, [ or \ in a comment, the comparison can report "unchanged" when it isn't. For example, a last line like # foo * gives the pattern ...# foo *\nx, which matches updated. The script then returns 0 without writing, so the block is never installed and no warning is printed. The idempotence tests only use plain hosts lines, so they miss this.
| if [[ "$_updated"$'\n'x == "$_current" ]]; then | |
| if [[ "$_updated"$'\n'x == "$_current" ]]; then |
Quoting the right side ("$_current", as in the suggestion) makes it a literal comparison. Please add a bats case with a glob character in a hosts comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| printf 'warning=%s\n' "$_warning" | ||
| done | ||
| } >"$STATE_DIR/last_check.txt" | ||
| printf '%s\n' "$_package" >"$STATE_DIR/checked_package" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: checked_package is written even when the check produced warnings. The activation in nix/home/default.nix only reruns the check when this value differs from the T3 store path. So a run that warns because a layer isn't in place yet is never repeated until T3 updates. Two cases can cause this:
darwin-rebuild and home-manager run in the wrong order, so policy.json and the hosts block don't exist yet.t3-telemetry-off or t3-server agent isn't loaded yet when the check runs after linkGeneration. Nothing orders the check after setupLaunchAgents.In both cases the one-time warning scrolls past in the switch output and the layer stays broken without being rechecked. The PR's own test plan says to look at warnings=0 afterwards, which hides the problem if the first run was early.
Consider recording checked_package only when ${#warnings[@]} -eq 0. The bundle baseline is already moved separately, so the check would simply rerun on each switch until clean. Alternatively, order the activation entry after the launchd agent setup.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Review summary for #507. No P0 or P1 findings. I posted 2 inline comments, both P2.
I read the diff only. I did not run the tests or the Nix build. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
BSD stat -f prints filesystem info with exit 0 on Linux, so the mode check failed in CI. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| mkdir -p "${t3ServerLogDirectory}" | ||
| '' | ||
| ); | ||
| t3TelemetryCheck = lib.hm.dag.entryAfter [ "linkGeneration" ] '' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: The check can run before the launchd agents are loaded, and it is then never re-run.
t3TelemetryCheck is ordered only entryAfter [ "linkGeneration" ]. Home Manager's setupLaunchAgents is ordered entryAfter [ "writeBoundary" ], so nothing guarantees it runs first. Even if it does, launchctl bootstrap returns before t3-telemetry-off (RunAtLoad) has called launchctl setenv.
On the first switch, check_launchctl_environment and check_service_environment can therefore warn falsely: launchctl getenv is empty, or the old t3-server plist is still loaded. The same happens if home-manager switch runs before darwin-rebuild switch, because the policy and hosts checks then fail.
record_result writes checked_package regardless of warnings. The [ "$(cat checked_package)" != store-path ] guard then skips the check on every later switch until the T3 store path changes. The PR's rollout step ("check that last_check.txt has warnings=0") can end on a stale, false warnings>0 with no supported way to re-run. The only workaround is deleting checked_package by hand.
Suggested fix: write checked_package only when warnings is 0. The check also re-runs on the next switch whenever the previous run warned, and it stays quiet once clean. Alternatively, order the entry after setupLaunchAgents.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Review summaryThe change is well structured: four layers, a hosts rewriter that is idempotent and refuses to touch duplicated, unpaired or non-regular files, and tests for both scripts. I read the diff only and did not run
Not verified: the upstream behaviour the PR relies on. That covers the 🤖 Generated with Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Review summary I found no P0 or P1 problems. I read the code and did not run it, so the bats results and
What I checked and found fine:
I did not review T3's actual behavior, such as whether the policy file or env var is honored upstream. 🤖 Generated with Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| printf 'warning=%s\n' "$_warning" | ||
| done | ||
| } >"$STATE_DIR/last_check.txt" | ||
| printf '%s\n' "$_package" >"$STATE_DIR/checked_package" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: checked_package is written even when the check produced warnings. nix/home/default.nix reruns the check only when that marker differs from the T3 store path. So a warning-producing run is never repeated until T3 updates.
Two ways this goes wrong:
home-manager switch runs before sudo darwin-rebuild switch, the policy and hosts warnings are recorded. The later switch skips the check, and last_check.txt keeps showing warnings>0 until the next T3 update.entryAfter [ "linkGeneration" ], which I don't think guarantees it runs after the launchd agents are loaded. On the first switch, launchctl getenv and launchctl print can report the opt-out as missing, and the result is then pinned.Consider writing checked_package only when ${#warnings[@]} -eq 0, so a failing check retries on the next switch. Alternatively, order the activation entry after the launchd agent setup.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…after hosts change Record the package as checked only when no warning was found, so a switch that runs before the policy, hosts or setenv agent exist does not hide the warning until the next T3 update. Flush the resolver cache when /etc/hosts changed. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| mkdir -p "${t3ServerLogDirectory}" | ||
| '' | ||
| ); | ||
| t3TelemetryCheck = lib.hm.dag.entryAfter [ "linkGeneration" ] '' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: t3TelemetryCheck is ordered only entryAfter [ "linkGeneration" ]. In Home Manager, setupLaunchAgents is ordered only after writeBoundary, and this repo already uses that name at line 774. So nothing orders the check against setupLaunchAgents, and the check may run before the agents are loaded or reloaded.
If it does, the first switch can report spurious warnings. launchctl getenv T3CODE_TELEMETRY_ENABLED would be empty because t3-telemetry-off hasn't run yet. The t3-server check could also report an old plist. Warnings delete checked_package, so the check reruns on the next switch and the problem corrects itself. Still, the "warnings=0" confirmation step in the PR may fail on the first run for this reason alone.
Consider entryAfter [ "linkGeneration" "setupLaunchAgents" ]. Note that setupLaunchAgents may be absent from the DAG on some configurations, and a missing dependency can make the DAG resolution fail. If so, add a short comment saying the first switch can warn spuriously.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Review summaryI found no P0 or P1 problems. I read the diff only. I did not run the tests or build anything. What I checked
Findings
Observations, no action needed
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| mkdir -p "${t3ServerLogDirectory}" | ||
| '' | ||
| ); | ||
| t3TelemetryCheck = lib.hm.dag.entryAfter [ "linkGeneration" ] '' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P2: t3TelemetryCheck has no ordering against setupLaunchAgents, so it can warn falsely.
This entry runs entryAfter [ "linkGeneration" ]. The launchctl getenv check and the launchctl print check for the t3-server agent only see the new state once setupLaunchAgents has loaded the new plists. Nothing orders the two: the log-directory entry about 10 lines above uses entryBetween [ "setupLaunchAgents" ] [ "writeBoundary" ], which shows that ordering is explicit in this file. Both entries only need to come after writeBoundary.
The check runs only when the T3 store path changes. That is exactly when the agents may still be running the old plist or not be loaded yet. The first switch after this PR is the clearest case, because t3-telemetry-off has never run. It can then warn that launchctl getenv is not false, or that the service lacks T3CODE_TELEMETRY_ENABLED => false.
Warnings are not recorded as done, so it reruns on the next switch and recovers. But the PR's own post-switch step is "confirm last_check.txt has warnings=0", and that step can fail on a correct setup.
Suggestion: add "setupLaunchAgents" to the after list, e.g. entryAfter [ "linkGeneration" "setupLaunchAgents" ]. Please confirm the DAG has no cycle.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Review summary (read-only) One finding, inline: P2. I read through the following and found no correctness or security problems:
Not verified: the Minor notes, not worth blocking on:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
#507 の `t3TelemetryCheck` が実際の `darwin-rebuild switch` で偽の警告を 6 件出していたのを直す.#506 は閉じたままで,関連として参照する. ## 原因 Home Manager の activation は PATH が最小で,`awk` がない.`check_telemetry.sh` の `resolves_to` が素の `awk` を呼び,`awk: command not found` になって,`/etc/hosts` が正しくても 3 ドメイン × 2 アドレスの 6 件が「未設定」と警告された(`last_check.txt` は `warnings=6`).bats は PATH に awk があるテスト環境で走るので通っていた. ## 修正 - `check_telemetry.sh` と `update_hosts_block.sh` は `TOOLS_PATH` を必須にし,`PATH` をそれだけにする.呼び出し側の PATH には依存しない. - Nix の wrapper が `TOOLS_PATH` を `lib.makeBinPath` で渡す.check は coreutils,gawk,gnugrep,gnused,hosts 書き換えは coreutils. - 工具ごとの変数(`AWK_BIN` など)を足す案より,`awk`,`grep`,`sed`,`sort`,`comm`,`tr`,`date`,`mkdir`,`rm`,`cat`,`id` をまとめて 1 変数で覆えるので小さい.既存の `JQ_BIN` は残す. - darwin の postActivation は root で `/usr/bin/install` と `/usr/bin/cksum` などを絶対パスで呼び,`update_hosts_block` の wrapper には `TOOLS_PATH`(coreutils)を渡すようにした. ## 確認 - [x] 再現テスト:PATH が `bash` だけの環境で,`TOOLS_PATH` を渡してスクリプトを走らせる bats を両スクリプトに追加.修正前は両方 exit 127 で落ち,修正後は通る - [x] `bats tests/t3`,shellcheck,`home-configuration` と `host-configuration` の `nix build`,pre-commit hook - [x] 実際にビルドした `check_t3_telemetry` wrapper を `env -i PATH=/var/empty` で実行(状態の置き場とポリシーのパスだけ作業用に差し替え)し,正しい hosts で `warnings=0`,exit 0 - [ ] CI - [ ] 利用者:`sudo darwin-rebuild switch --flake .#mbp` を再実行.前回の警告で `checked_package` は記録されていないので,確認は自動で再実行され,`~/.local/state/t3-telemetry/last_check.txt` が `warnings=0` になる <details> <summary>範囲</summary> switch 後の `~/.nix-profile/bin/starship` / `direnv` のエラーは,standalone Home Manager から nix-darwin module に移った後の古い対話シェルが原因で,#507 とは無関係なので対象外. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
## 概要 - Homerow 3.0.0(クローズドソース)が,プライバシーポリシーに記載のない PostHog 解析(`us.i.posthog.com`)を内蔵し,オプトアウトもできないため,PostHog のクラウド取り込みホストをシステム全体でブロックする. - Nani のファビコンプロキシ `f.kiok.jp`(`https://f.kiok.jp/?size=..&url=<origin>` で閲覧ページのオリジンを受け取る)も同じ仕組みでブロックする. - Microsoft Office の診断データを最小化し,任意の接続エクスペリエンスを無効化する. ## 変更内容 ### テレメトリホストのブロック - `0.0.0.0`(IPv4)と `::`(IPv6)に対応付けるホスト: `us.i.posthog.com`, `us-assets.i.posthog.com`, `eu.i.posthog.com`, `eu-assets.i.posthog.com`, `app.posthog.com`, `f.kiok.jp`.他のホストは追加しない. - 機構: main にマージ済みの T3 Code 用 `scripts/t3/update_hosts_block.sh`(`/etc/hosts` のマーカー付きブロックを activation で書き換える方式)を再利用する. - 当初は `environment.etc."hosts"`(Apple 既定内容を保持し `knownSha256Hashes` で置換)を使っていたが,T3 側が同じ `/etc/hosts` を直接書き換える方式を main に入れたため,両立しない(`/etc/hosts` が symlink になると T3 のスクリプトは「通常ファイルではない」として失敗する).このため方式を差し替えた. - スクリプトに環境変数 `HOSTS_BLOCK_NAME`(既定 `t3-telemetry-block`)を追加し,`app-telemetry-block` という別名のブロックを併存させる.既存の T3 ブロックの挙動は変えない(既定のマーカーは従来のままなので,#507 を適用済みのマシンのブロックはその場で書き換えられ,古いブロックが重複して残ることはない).ADR-0048 は,承認済み ADR の本文を変えず front matter の `amended` に追記した.ブロック外の行には触れず,hosts が変わったときだけ DNS キャッシュを消去する既存処理もそのまま効く. - DNS キャッシュは,hosts が変わった場合に activation が自動で消去する(`dscacheutil -flushcache` と `killall -HUP mDNSResponder`). ### Office `system.defaults.CustomUserPreferences."com.microsoft.office"` に設定: - `DiagnosticDataTypePreference = "ZeroDiagnosticData"` - `OfficeExperiencesAnalyzingContentPreference = false` - `OfficeExperiencesDownloadingContentPreference = false` - `OptionalConnectedExperiencesPreference = false` `ConnectedOfficeExperiencesPreference` は変更しない(無効化すると OneDrive と共同編集が使えなくなるため).キー名と値は Microsoft の「Use preferences to manage privacy controls for Office for Mac」で確認済み. 注意: - 反映には Office アプリの再起動が必要. - 職場・学校アカウントでは,テナントのポリシーがこれらの設定を上書きする場合がある. mbp / mba の両ホストは `nix/darwin/default.nix` を共有しているため,両方に適用される. ## 検証 - `nix/checks.nix` の `host-configuration` に契約を追加(`app-telemetry-hosts-blocked-only`: 上記 6 ホストだけを `app-telemetry-block` で遮断し,`environment.etc."hosts"` を持たないこと.`office-telemetry-limited`).実装前に失敗することを確認し,実装後に成功. - `tests/t3/update_hosts_block.bats` に名前付きブロックの併存を指定するテストを追加(先に失敗,実装後に成功).`bats tests/t3` 全件成功. - `nix build` で `host-configuration`, `home-configuration`, `system-configurations` が成功. - main(#507,#515)を merge して競合を解消.#515 の `TOOLS_PATH` 要件とそのテストはそのまま維持している. - `lefthook run pre-commit --all-files` が成功. - `darwin-rebuild` は未実行(適用は利用者が行う). 計画からの逸脱: ブロック機構を `environment.etc` から T3 と共通のマーカー付きブロックに変更した(上記). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: furedea-agent <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
feat(t3): keep T3 Code from sending telemetry on mbp and mba
There was an error while loading. Please reload this page.