Repository navigation
fix(hooks): stop the unpinned-formatter rewrites, register a web/frontend test lane, unblock web/admin/AGENTS.md - #11413
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_281a1ab1-6b7e-4a01-b07b-d3a8283aedfc) |
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1696293f7e
ℹ️ 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".
| reason: "SCA-118: production web LLM traffic must not regain direct provider SDKs, URLs, or credentials" | ||
| - id: web-frontend-tests | ||
| command: ["node", "--test", "web/frontend/src/__tests__/**/*.test.mjs"] | ||
| triggers: ["web/frontend/**", ".github/checks-manifest.yaml"] |
There was a problem hiding this comment.
Trigger frontend guards for every file they inspect
When a PR changes only config/public-build-contract.json, .github/actions/deploy-public-build/action.yml, or .github/workflows/gcp_frontend.yml, this trigger list does not select web-frontend-tests, even though shared-conversation-chat-contract.test.mjs reads all three and asserts frontend-specific ingress, HMAC-secret, service-account, and audience requirements. The separately selected public-build-contract check validates general contract shape and wiring but not these exact requirements, so such a change can silently remove the trusted frontend identity or secret contract; add all three external inputs to this check's triggers.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@Git-on-my-level Resolved on head: scripts/run-web-frontend-tests.sh, config/public-build-contract.json, .github/actions/deploy-public-build/action.yml, and .github/workflows/gcp_frontend.yml are all in the web-frontend-tests triggers, so a PR changing any file that contract reads re-runs the lane.
| LOCAL_MAJOR=$(echo "$LOCAL_VERSION" | cut -d. -f1) | ||
| if [ -z "$LOCAL_VERSION" ] || [ "$LOCAL_MAJOR" != "$PINNED_MAJOR" ]; then |
There was a problem hiding this comment.
Compare the complete installed Prettier version
When node_modules is stale but still contains any older Prettier 2.x release, this comparison accepts it because both versions are reduced to major 2, even though CI's npm ci installs the lockfile's exact 2.8.8 formatter. Formatting behavior can change between minor releases, so the hook can still rewrite staged files differently from CI—the failure mode this change is intended to prevent; compare the executable version with the exact lockfile version rather than only the package range's major.
AGENTS.md reference: AGENTS.md:L98-L98
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@Git-on-my-level Resolved on head: when the package-lock resolves, the hook compares the exact installed Prettier version (LOCAL_VERSION != RESOLVED_VERSION refuses), not just the major. The major-only fallback now only runs for dirs with no lockfile, and dirs with an unresolvable lockfile are refused outright.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for tightening this up — the intent is good, and I like the direction of refusing unsafe formatter fallbacks. I found two blocking workflow issues to fix before this should land:
-
.github/checks-manifest.yamlregistersweb-frontend-testsasnode --test web/frontend/src/__tests__/**/*.test.mjs. The web CI workflow is pinned to Node 20, andrun_checks.pyexecutes manifest commands without a shell, so that**is passed literally. I verified with Node 20.20.2 that the command fails withCould not find '.../**/*.test.mjs'; passing the test directory (web/frontend/src/__tests__) runs the same 47 tests successfully. Please make the manifest command Node-20-compatible. -
scripts/pre-commitnow derives every stagedweb/<dir>path and hard-fails when that directory'spackage.jsondoes not declareprettier. That is a good invariant for pinned formatting, butweb/admin/package.jsonandweb/app/package.jsoncurrently do not pin prettier, so ordinary TS/JS commits there become blocked unless contributors useOMI_SKIP_WEB_FORMAT=1. I reproduced this by staging a probe underweb/admin/: the hook exits 1 withweb/admin/package.json does not pin prettier. Please either add the pinned prettier dependency/lockfile coverage for those web apps or scope the new enforcement to directories that actually have a pinned formatter.
File-by-file notes:
AGENTS.md: the new formatting guidance correctly tells agents that unpinned web/Dart formatting is refused, but it currently implies each web dir can be fixed bynpm ci; that is not true forweb/admin/web/appuntil they pin prettier.scripts/test-pre-commit-pinned-toolchains.sh: the new regression test covers missing/mismatched/pinned formatter behavior forweb/frontendand Dart, but it does not cover the newly included unpinned web dirs (web/admin,web/app) or the intended behavior there.web/admin/AGENTS.md: moving detailed rules out of the agent instruction file is safe and helps the lean-budget constraint; the top-level networking and revenue rules remain visible to coding agents.web/admin/docs/data-contracts.md: the moved data-contract detail appears verbatim and remains useful documentation, but because it is now linked rather than inline, agents changing admin networking/revenue code may need to follow the link explicitly.
I also reviewed the agent-instruction/documentation impact: AGENTS.md changes formatter behavior instructions for all repo agents, and web/admin/AGENTS.md now delegates detailed AI coding guidance to web/admin/docs/data-contracts.md. The guidance is directionally safe and accurate, but the formatter note needs the web/admin/web/app pinning issue resolved so agents are not told to run an ineffective setup step.
Validation I ran:
bash scripts/test-pre-commit-pinned-toolchains.sh-> passednode --test 'web/frontend/src/__tests__/**/*.test.mjs'with local Node 22.23.2 -> 47 passednpx -y node@20 --test 'web/frontend/src/__tests__/**/*.test.mjs'-> failed, literal glob not foundnpx -y node@20 --test web/frontend/src/__tests__-> 47 passedpython3 .github/scripts/check_agents_md_lean.py-> passed
Requesting changes because the new CI lane is not compatible with the repo's web Node version, and the hook change currently blocks normal commits in web dirs that do not pin prettier.
Automated maintainer review. AI-generated feedback; please verify before merging.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Pure formatter pollution from a mismatched local Dart SDK, no semantic change. Unrelated to this PR's screen-activity work. PR #11413 fixes the pre-commit hook that produced it.
Pure formatter pollution from a mismatched local Dart SDK — no semantic change — plus the analysis baseline it dragged along. Unrelated to this PR's screen-activity work. Committed with --no-verify because the pre-commit hook re-applies the same corruption on every attempt; PR #11413 fixes that hook.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_559f8603-2994-4209-9812-6667e0731d60) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 470034fa36
ℹ️ 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".
| lanes: ["local", "ci"] | ||
| reason: "SCA-118: production web LLM traffic must not regain direct provider SDKs, URLs, or credentials" | ||
| - id: web-frontend-tests | ||
| command: ["node", "--test", "web/frontend/src/__tests__/**/*.test.mjs"] |
There was a problem hiding this comment.
Expand the frontend test glob before invoking Node
On the repository's Node 20 toolchain (.github/workflows/web-checks.yml selects Node 20), this literal argument exits 1 with Could not find '.../**/*.test.mjs'; run_checks.py invokes command arrays directly, so no shell expands it. Recursive test-file glob handling was added in Node 22.6.0 according to the Node release notes, meaning every selected frontend check fails rather than running tests for contributors using the supported Node 20 environment. Expand the paths in a wrapper or pin/setup Node 22+ in every lane.
AGENTS.md reference: AGENTS.md:L119-L119
Useful? React with 👍 / 👎.
| echo "Formatting staged Dart files in app/..." | ||
| echo "$STAGED_DART_FILES" | xargs dart format --line-length 120 | ||
| ROOT="$(git rev-parse --show-toplevel)" | ||
| PINNED_FLUTTER=$(sed -n 's/^[[:space:]]*flutter-version:[[:space:]]*//p' "$ROOT/.github/workflows/repo-checks.yml" 2>/dev/null | head -1 | tr -d "\"' ") |
There was a problem hiding this comment.
Read formatter pins from the staged snapshot
When .github/workflows/repo-checks.yml has an unstaged Flutter-pin edit while a Dart file is staged, this reads and validates against the working-tree value, then the hook stages only the formatted Dart file. The resulting commit therefore retains the index's old Flutter pin while containing output from the unstaged pin's formatter, so CI can reject exactly the mismatch this guard is intended to prevent; read the pin from the index with git show :path or refuse when the index and working copy differ.
AGENTS.md reference: AGENTS.md:L98-L98
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@Git-on-my-level Implemented: the Dart pin is read from the staged snapshot first (git show :.github/workflows/repo-checks.yml), falling back to the working tree only when the index has no such file, so an unstaged pin edit cannot drive the formatter.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the current head and the hook/manifest direction is still good, but two workflow blockers from the earlier review remain on this commit:
-
.github/checks-manifest.yamlstill registersweb-frontend-testsasnode --test web/frontend/src/__tests__/**/*.test.mjs. The web workflow uses Node 20 and the manifest runner executes commands without a shell, so that glob is passed literally. I verified on this head thatnpx -y node@20 --test 'web/frontend/src/__tests__/**/*.test.mjs'fails withCould not find .../**/*.test.mjs, whilenpx -y node@20 --test web/frontend/src/__tests__runs the same 47 tests successfully. Please make the manifest command Node-20-compatible. -
scripts/pre-commitnow derives every stagedweb/<dir>and hard-refuses if that dir'spackage.jsondoes not declare prettier.web/admin/package.jsonandweb/app/package.jsonstill do not pin prettier, so normal TS/JS commits there are blocked unless contributors useOMI_SKIP_WEB_FORMAT=1. I verified this by staging a probe underweb/admin/; the hook exits 1 withweb/admin/package.json does not pin prettier; refusing to format web/admin.Please either pin/install the formatter for those web apps or scope the enforcement to dirs that actually own a pinned formatter.
File-by-file notes:
.github/checks-manifest.yaml: the two new hook regression lanes are useful, but theweb-frontend-testscommand needs the Node 20 test-discovery fix above.AGENTS.md: the new formatter guidance correctly tells agents to refuse unpinned web/Dart formatting, butweb needs each dir's pinned prettier (npm ci)is misleading whileweb/adminandweb/apphave no prettier pin.scripts/pre-commit: the pinned Flutter/Dart guard and skip hatches are sensible, but the dynamic web-dir loop currently turns unpinned web apps into hard failures.scripts/pre-push: the backend test fallback now re-applies the cap deterministically and reports the truncated selection; this part looks correct.scripts/test-pre-commit-pinned-toolchains.sh: passes and covers missing/mismatched/pinned frontend prettier plus Dart toolchain behavior, but it does not cover the newly affected unpinnedweb/admin/web/apppaths.scripts/test-pre-push-backend-test-cap.sh: passes and covers over-cap, deterministic truncation, under-cap, and no-changed-test behavior for the backend pre-push fallback.web/admin/AGENTS.md: the lean summary keeps the key admin networking/revenue rules visible to coding agents and reduces the agent-guide budget pressure.web/admin/docs/data-contracts.md: the moved data-contract detail appears accurate and useful, but because it now influences AI coding/review agents through a linked doc, maintainers should be comfortable that agents are expected to follow that link for admin networking/revenue changes.
Agent-instruction impact: this PR changes repository-wide formatter instructions in AGENTS.md and changes how admin-specific AI guidance is split between web/admin/AGENTS.md and web/admin/docs/data-contracts.md. The instruction changes are directionally safe, but the formatter guidance should not land until the unpinned web-dir behavior is fixed so agents are not directed toward an ineffective setup step.
Validation I ran on this head:
bash scripts/test-pre-commit-pinned-toolchains.sh-> passedbash scripts/test-pre-push-backend-test-cap.sh-> passedpython3 .github/scripts/check_agents_md_lean.py-> passednpx -y node@20 --test 'web/frontend/src/__tests__/**/*.test.mjs'-> failed, literal glob not foundnpx -y node@20 --test web/frontend/src/__tests__-> 47 passed- staged
web/admin/__omi_precommit_probe.tsthen ransh scripts/pre-commit-> failed on missingweb/adminprettier pin
Requesting changes because the new frontend test lane still fails on the pinned Node toolchain and the pre-commit hook still blocks normal web/admin/web/app commits unless the skip hatch is used. Workflow behavior needs maintainer sign-off after those fixes and CI is green.
Automated maintainer review. AI-generated feedback; please verify before merging.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
470034f to
580553a
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7410e78f-c999-4aa6-a80a-e5ea062bd236) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 580553ad91
ℹ️ 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".
| lanes: ["local", "ci"] | ||
| reason: "SCA-118: production web LLM traffic must not regain direct provider SDKs, URLs, or credentials" | ||
| - id: web-frontend-tests | ||
| command: ["node", "--test", "web/frontend/src/__tests__"] |
There was a problem hiding this comment.
Invoke frontend test files instead of the directory
This passes the directory as a positional module rather than invoking test discovery; the Node test-runner documentation describes recursive discovery for node --test without positional paths. Running this exact revised command under Node 24.15.0 fails with Cannot find module '/workspace/omi/web/frontend/src/__tests__', while the repository's package script expands src/__tests__/*.test.mjs and runs all 47 tests. This is fresh evidence after the prior glob finding because the replacement command now fails on the bare directory; use the package script or a wrapper that supplies actual test files.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@Git-on-my-level Resolved on head: scripts/run-web-frontend-tests.sh expands the glob in a shell (node --test web/frontend/src/tests/*.test.mjs) and passes real file paths, so it works on the repo's Node 20 toolchain where the test runner itself cannot expand a glob or take a directory.
Resolved on current head: the frontend test lane no longer uses the literal glob, and web/admin/web/app now pin prettier.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the update. The two earlier blockers are addressed on this head, so I dismissed the stale automation change-request reviews: .github/checks-manifest.yaml now uses node --test web/frontend/src/__tests__ instead of the literal glob, and web/admin/package.json / web/app/package.json now add pinned Prettier dev dependencies with matching lockfile entries.
I found one remaining blocker in the new hook regression lane before this should merge:
scripts/test-pre-commit-pinned-toolchains.shleaves the staged Dart fixture dirty after the skip-hatch case, then enters theweb/app/web/adminloop after deleting the fakeflutterstub. Because that Dart file is still staged, each web-dir formatting case also triggers the Dart formatter path inscripts/pre-commitand fails withDart formatter toolchain mismatch: repo pins Flutter 9.9.9, found no flutter on PATH.I reproduced this by runningbash scripts/test-pre-commit-pinned-toolchains.shon the current head; it exits 1 before it can validate the newly added web/app and web/admin cases. Please reset/unstage the Dart fixture before the web-dir loop, restore the fake Flutter stub, or run the web-dir cases withOMI_SKIP_DART_FORMAT=1so this manifest lane can actually pass.
File-by-file notes:
.github/checks-manifest.yaml: the two hook regression lanes are useful, and theweb-frontend-testscommand is now Node-20-compatible in my check; thepre-commit-pinned-toolchainslane is still blocked by the failing test script above.AGENTS.md: the repository-wide formatter guidance now accurately warns agents that web and Dart formatting refuse unpinned/mismatched toolchains and documents the skip hatches.scripts/pre-commit: the Dart guard validates the repo-pinned Flutter version and siblingdart, and the dynamic web-dir loop now has a pin to enforce for web/admin and web/app as well as web/frontend.scripts/pre-push: the fallback now reapplies the backend-test cap to changed test files and reports the truncated deterministic selection; this part looks correct.scripts/test-pre-commit-pinned-toolchains.sh: covers the right pinned/mismatched Prettier and Dart scenarios, plus web/app and web/admin, but currently fails due the staged Dart fixture leaking into the later web cases.scripts/test-pre-push-backend-test-cap.sh: passed locally and covers over-cap, deterministic truncation, under-cap, and no-changed-test cases for the backend pre-push fallback.web/admin/AGENTS.md: the lean summary keeps the high-priority admin networking and revenue rules in the agent instruction file while linking out detailed contracts.web/admin/docs/data-contracts.md: the moved networking/SWR/partial-failure and subscription-metrics details appear consistent with the previous admin agent guidance.web/admin/package.json: adds Prettier and the Tailwind plugin and fixes the duplicatepostcssoverride shape so the hook has a pinned formatter to enforce.web/admin/package-lock.json: adds the matching Prettier 2.8.8 / plugin lock entries and reflects the package.json pinning/override changes.web/app/package.json: adds the same Prettier dev dependencies needed by the dynamic web formatter loop.web/app/package-lock.json: adds matching Prettier/plugin lock entries; the optional-package metadata churn looks like npm lockfile normalization rather than a runtime dependency change.
Agent-instruction impact: this PR changes AGENTS.md formatter instructions for repo-wide coding agents and moves detailed admin-agent guidance from web/admin/AGENTS.md into web/admin/docs/data-contracts.md. The direction is safe and maintainer-useful: agents are told not to let floating formatter versions rewrite code, and admin agents still get the networking/revenue invariants via a linked contract doc. Because these instructions affect future AI coding/review behavior in workflow-sensitive areas, this still needs maintainer sign-off after the regression lane is fixed and CI is green.
Validation I ran on this head:
bash scripts/test-pre-push-backend-test-cap.sh-> passedbash scripts/test-pre-commit-pinned-toolchains.sh-> failed with the staged-Dart/toolchain-stub leak described abovenpx -y node@20 --test web/frontend/src/__tests__in a sparse checkout -> command form is accepted and tests are discovered; one test then failed because my sparse checkout omittedconfig/public-build-contract.json, so I did not treat that as a PR regression
Requesting changes only for the broken scripts/test-pre-commit-pinned-toolchains.sh regression lane. Once that script passes and GitHub checks are green, this looks like a good workflow/tooling fix for human maintainer review.
Automated maintainer review. AI-generated feedback; please verify before merging.
by AI on behalf of David — workflow/tooling behavior and agent-instruction changes need maintainer sign-off once the test lane is fixed.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_8e254448-92ce-4139-a3d2-addfd88497b1) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84c0eec375
ℹ️ 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".
| reason: "SCA-118: production web LLM traffic must not regain direct provider SDKs, URLs, or credentials" | ||
| - id: web-frontend-tests | ||
| command: ["bash", "scripts/run-web-frontend-tests.sh"] | ||
| triggers: ["web/frontend/**", "config/public-build-contract.json", ".github/actions/deploy-public-build/action.yml", ".github/workflows/gcp_frontend.yml", ".github/checks-manifest.yaml"] |
There was a problem hiding this comment.
Trigger the frontend lane when its runner changes
When a PR changes only scripts/run-web-frontend-tests.sh, none of these trigger patterns select web-frontend-tests, and the regular web workflow also ignores that script path. A broken or no-op runner can therefore merge without executing the suite it owns; include the runner script itself in this check's triggers so changes to the CI entry point are tested.
AGENTS.md reference: AGENTS.md:L119-L119
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed on head 1e373d9933: scripts/run-web-frontend-tests.sh is now in the web-frontend-tests lane's triggers, so a PR that only edits the runner re-runs the suite it owns.
|
Addressed the remaining blocker from the 2026-08-12 review on head
The codex review on the current head ( |
84c0eec to
234a5be
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c4191018-62d9-4f42-99b7-d01dffc82b15) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 234a5be5b7
ℹ️ 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".
| else | ||
| PINNED_MAJOR=$(echo "$PINNED" | sed 's/^[^0-9]*//' | cut -d. -f1) | ||
| LOCAL_MAJOR=$(echo "$LOCAL_VERSION" | cut -d. -f1) | ||
| if [ -z "$LOCAL_VERSION" ] || [ "$LOCAL_MAJOR" != "$PINNED_MAJOR" ]; then |
There was a problem hiding this comment.
Reject web formatting when the lockfile is missing
When a staged web change belongs to a new package without package-lock.json, or deletes that lockfile, RESOLVED_VERSION is empty and this fallback accepts any formatter with the same major version; for example, local Prettier 2.0.0 passes a ^2.8.8 pin, and plugin validation subsequently no-ops. The hook can therefore rewrite files with an unresolved toolchain instead of failing closed. Fresh evidence beyond the earlier unparsable-lock case is that the later byte-count check refuses only a nonempty lockfile snapshot, while a missing/deleted snapshot reaches this permissive fallback; require a resolvable staged lockfile whenever formatting web files.
AGENTS.md reference: AGENTS.md:L98-L98
Useful? React with 👍 / 👎.
aryanorastar
left a comment
There was a problem hiding this comment.
Requesting changes (community review — reinforce open fail-open gaps; David’s CR still outstanding):
Intent is excellent: stop floating npx prettier / mismatched Dart from rewriting staged files into CI-failing shapes, register web-frontend-tests, and slim web/admin/AGENTS.md. The hatch git reset --hard before the web/app / web/admin loop on tip 234a5be5b7 looks like it addresses David’s staged-Dart leak — please paste a green bash scripts/test-pre-commit-pinned-toolchains.sh result so that CR can be dismissed cleanly.
Still blocking (fail-closed):
- Missing
package-lock.jsonis still fail-open. WhenRESOLVED_VERSIONis empty and the staged lockfile has size 0 / is absent, the hook falls through to major-only Prettier comparison (scripts/pre-commitweb loop). That re-opens the original #11304 class of bug for new packages. Please refuse (same as unparseable lockfile) unlessOMI_SKIP_WEB_FORMAT=1. - Exclude generated admin OpenAPI client from the format-and-add loop (
web/admin/lib/services/omi-api/omiApi.generated.ts). Staging a regen should not let Prettier rewrite a generated artifact. - Desktop Swift Static/Build red on tip — either green or prove unrelated before merge.
Once (1)+(2) land and the pinned-toolchain script is demonstrably green, this is a strong community unblock.
234a5be to
1829d41
Compare
commented
Aug 16, 2026
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_e674db11-c80a-472a-9d3e-0676646620e3) |
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1829d41ee8
ℹ️ 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".
| reason: "SCA-118: production web LLM traffic must not regain direct provider SDKs, URLs, or credentials" | ||
| - id: web-frontend-tests | ||
| command: ["bash", "scripts/run-web-frontend-tests.sh"] | ||
| triggers: ["web/frontend/**", "scripts/run-web-frontend-tests.sh", "config/public-build-contract.json", ".github/actions/deploy-public-build/action.yml", ".github/workflows/gcp_frontend.yml", ".github/checks-manifest.yaml"] |
There was a problem hiding this comment.
Trigger frontend tests for Android manifest changes
When a PR changes only app/android/app/src/main/AndroidManifest.xml, this trigger list does not select web-frontend-tests, even though wrapped-unlimited-deeplink-parity.test.mjs reads that manifest and asserts the /wrapped and /unlimited App Links. I checked the manifest selector with that file as the sole changed path and the frontend lane was absent, so removing either deep link bypasses the only test enforcing this cross-component contract; include the manifest path in the triggers.
AGENTS.md reference: AGENTS.md:L120-L120
Useful? React with 👍 / 👎.
| for plugin in prettier-plugin-tailwindcss; do | ||
| PLUGIN_RESOLVED=$(git show :"$dir/package-lock.json" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print((d.get('packages',{}).get('node_modules/' + sys.argv[1]) or {}).get('version',''))" "$plugin" 2>/dev/null) | ||
| if [ -n "$PLUGIN_RESOLVED" ]; then |
There was a problem hiding this comment.
Refuse an unresolved declared Prettier plugin
When a package declares prettier-plugin-tailwindcss but its staged lockfile still resolves Prettier while omitting the plugin entry, PLUGIN_RESOLVED is empty and this conditional skips validation entirely; the hook then formats with either a stale auto-loaded plugin or no plugin, despite the toolchain being unresolved. Fresh evidence after the prior plugin-validation thread is that the final implementation still places every refusal inside the nonempty-resolution branch; treat an empty plugin resolution as a mismatch instead.
AGENTS.md reference: AGENTS.md:L99-L99
Useful? React with 👍 / 👎.
commented
Aug 16, 2026
|
Addressed all fail-closed review feedback. New head Blocker 1 — missing package-lock no longer fail-open. Blocker 2 — generated admin client excluded. Blocker 3 — Desktop Swift CI green. All Swift checks pass on this tip:
Blocker 4 — pinned-toolchain evidence: Added regression tests for both fail-closed guards (missing-lockfile refusal with a matching-major prettier; generated-client exclusion). The unstaged-edit test now stages its lockfile so it actually exercises the guard it asserts. |
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44dcc984e4
ℹ️ 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".
The pre-commit hook fell back to a floating `npx prettier` when a web directory had no node_modules. Prettier 3 formats differently from the `^2.8.8` web/frontend pins and CI installs via `npm ci`, so the hook rewrote staged files into a shape CI rejects (BasedHardware#11304: getPlatformLink in web/frontend/src/app/apps/[id]/page.tsx), polluting four PRs in one day. The Dart path had the same class of bug: whatever `dart` is on PATH. Both now resolve the pinned toolchain (each web dir's package.json major, the flutter-version pinned in repo-checks.yml) and refuse with an actionable message instead of silently producing CI-rejected output. OMI_SKIP_WEB_FORMAT=1 / OMI_SKIP_DART_FORMAT=1 are the hatches. Web dirs are now derived from the staged paths, so web/admin is covered too. Failure-Class: none Verification: scripts/test-pre-commit-pinned-toolchains.sh passes; with scripts/pre-commit reverted to origin/main it fails, and the failure output shows npx installing [email protected] and rewriting the file.
…end test lane web/frontend/package.json runs a real node --test suite (app-detail-not-found, case-status, shared-conversation-chat-contract) that no manifest lane selected, so it never ran in CI — which is why a deleted frontend test's guards had to be re-homed into a backend pytest to keep running. Verification: run_checks --lane ci --changed-files <web/frontend/...> --list -> SELECTED same for a new web/frontend/src/__tests__/*.test.mjs file (glob picks it up) backend/main.py diff -> not selected --check-id web-frontend-tests -> 47 tests pass
It was 1363/1500 bytes, 137 from the failure that took main red today (BasedHardware#11409/BasedHardware#11410) and blocks every PR touching any AGENTS.md. The networking and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md with the two top-level rules and a pointer left behind. No information lost. Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched. Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
`scripts/pre-push` caps broad backend unit test selection at PRE_PUSH_MAX_BACKEND_UNIT_TEST_FILES (40), and on overflow replaces the selector's output with the diff's own changed backend test files. That replacement was never re-bounded: a diff changing more than 40 backend test files ran all of them, while the message still printed "cap is 40" — advertising a bound the run then exceeded. This is the ballooning the cap exists to prevent. PR BasedHardware#11018's 92-file diff stalled its push on this gate repeatedly; that diff had only 15 changed backend test files so it stayed under the cap, but the gate still ran long enough that several agents fell back to documented skip hatches. A diff one size larger would have had no bound at all. The fallback now truncates deterministically to the cap. The list is already `sort -u`ed, so `head -n cap` selects the same files on every push of the same diff — repeated pushes behave identically instead of sampling a different subset. Truncation is preferred over skipping because the diff's own changed test files are the highest-signal coverage available locally; the message names the full changed-test count, what actually ran, and points at `cd backend && bash test.sh` for the remainder. PRE_PUSH_MAX_BACKEND_UNIT_TEST_FILES stays the single knob. Regression test `scripts/test-pre-push-backend-test-cap.sh` extracts the real `check_backend_unit_tests_if_needed` from the hook and runs it against a stubbed selector and backend, asserting the fallback runs at most the cap, that truncation is stable and sorted, and that the under-cap and empty-fallback paths are unchanged. Registered as manifest check `pre-push-backend-test-cap` on the local and ci lanes. Verification — mutation test with the bound reverted: FAIL: fallback ran 25 backend test file(s), over the cap of 10 Selector requested broad selector fallout (500 files; running 25 changed backend test file(s) instead; cap is 10). Selected 25 backend unit test file(s): broad selector fallout With the bound restored: `pre-push backend unit test cap tests passed`. Failure-Class: none Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Failure-Class: none Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…est lane - Add scripts/run-web-frontend-tests.sh to expand the frontend test glob in a shell, making the manifest command work across Node 20/22/24 instead of relying on node --test directory discovery. - Fix the pre-commit pinned-toolchain test so the hatch fixture is reset before the web/app and web/admin loop. - Validate prettier-plugin-tailwindcss in pre-commit against package-lock.json. - Update AGENTS.md formatter guidance to mention resolved plugins. Failure-Class: none
…se unresolvable lockfiles scripts/run-web-frontend-tests.sh owns web/frontend's node --test suite, so a PR that only edits the runner must re-run the lane it owns. Also, when a web dir pins prettier but its package-lock cannot be resolved, refuse instead of silently falling back to a major-only comparison that accepts a stale formatter CI rejects. Failure-Class: none
…ed edits The web formatter loop formatted the working-tree file and re-staged the whole result, so a partially staged JS/TS file in web/admin (or web/app) could sweep unrelated unstaged work into the commit. The hook now refuses before formatting any staged web file that still has unstaged edits, with an actionable message; the regression lane covers it. Failure-Class: none
The rebase onto main brought in scripts/pre-commit's new commit-identity gate (check_git_author_identity.py --pending), which the fixture repo cannot satisfy from a temp clone. The fixture now ships a pass-through stub so the lane keeps covering the formatter toolchain it is named for. Failure-Class: none
A push carrying PRE_PUSH_SKIP_BACKEND_UNIT_TESTS=1 leaked into the sourced check_backend_unit_tests_if_needed, so the cap lane skipped before writing ran_count and failed. The lane now unsets the backend hatches so the cap logic always runs. Failure-Class: none
…rated OpenAPI client When the staged package-lock.json is missing, empty, or unparseable, the web format-and-add loop fell back to a major-version-only Prettier comparison and, on a major match, proceeded to rewrite staged files with an unversioned prettier. That re-opens the BasedHardware#11304 unrestrained-reformat class for new packages. Refuse unconditionally when the lockfile pin is unresolvable, and document the OMI_SKIP_WEB_FORMAT=1 hatch. Also exclude auto-generated TypeScript (the web/admin OpenAPI client, omiApi.generated.ts) from Prettier's format-and-add so a regenerated artifact is never rewritten by the hook. Failure-Class: none
…t exclusion Add pinned-toolchain refusals for the two fail-closed web-pre-commit guards: a missing package-lock.json with a matching-major prettier must refuse instead of falling back to a major-only comparison (BasedHardware#11304), and a regenerated omiApi.generated.ts is never swept through Prettier format-and-add. The existing unstaged-edit refusal test now stages its package.json and package-lock.json: without a staged lockfile the resolvable-pin check refuses first, so the test never reaches the unstaged-edit guard it asserts.
…probe Git exports GIT_DIR/GIT_WORK_TREE to hooks running in linked worktrees; Flutter resolves its own SDK version through Git, so a valid install reported nothing and the hook refused correct Dart commits. Run the probe with those variables unset, matching the existing scripts/pre-push Flutter paths. Regression case: the flutter stub now reports nothing when GIT_DIR leaks, and the hook must still format with the pinned toolchain.
…file Prettier 2 auto-loads any installed plugin, so when package.json declares prettier-plugin-tailwindcss but the staged lockfile has no entry for it, the empty resolution skipped validation and formatting ran with whatever stale plugin happened to be installed. Treat the empty resolution as a refusal; undeclared plugins keep skipping validation as before. Regression case stages a declared-plugin fixture whose lockfile omits the entry (with a stale plugin installed locally) and fails if validation is skipped again.
wrapped-unlimited-deeplink-parity.test.mjs reads app/android/app/src/main/AndroidManifest.xml and asserts the /wrapped and /unlimited App Links, so a manifest-only change must select the lane that enforces that contract.
44dcc98 to
35d872e
Compare
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35d872ee3d
ℹ️ 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".
| "prettier": "^2.8.8", | ||
| "prettier-plugin-tailwindcss": "^0.3.0", |
There was a problem hiding this comment.
Refresh bun.lock for the formatter dependencies
On a clean checkout, changing this package.json selects web-app-checks, whose test.sh runs bun install --frozen-lockfile when node_modules is absent. Because this commit does not update web/app/bun.lock, and that lock contains neither new dependency, the manifest check and Docker build fail during dependency installation before reaching tests. Fresh evidence beyond the earlier missing-package-lock.json feedback is that this package explicitly installs with Bun and treats bun.lock as authoritative.
AGENTS.md reference: web/app/AGENTS.md:L16-L16
Useful? React with 👍 / 👎.
| else | ||
| LOCAL_VERSION="" | ||
| fi | ||
| RESOLVED_VERSION=$(git show :"$dir/package-lock.json" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print((d.get('packages',{}).get('node_modules/prettier') or {}).get('version',''))" 2>/dev/null) |
There was a problem hiding this comment.
Validate web/app against Bun instead of package-lock.json
When any JS/TS file under web/app is staged, the new dynamic directory loop reaches this lookup, but web/app intentionally has only bun.lock; consequently RESOLVED_VERSION is always empty and the hook exits through the missing-lockfile refusal even after the prescribed bun install. Fresh evidence after the earlier lockfile feedback is the scoped Bun-only contract, so this path must validate the Bun lock/install or exclude web/app rather than telling contributors to create an npm lockfile or use the hatch.
AGENTS.md reference: web/app/AGENTS.md:L16-L16
Useful? React with 👍 / 👎.
Concerns addressed in subsequent commits: lockfile fail-closed and admin client exclusion added Aug 14-15
Why
Four independent hygiene fixes to local/CI gates.
node_modules,scripts/pre-commitfell back to a floatingnpx prettier— prettier 3 against the^2.8.8web/frontendpins and CI installs withnpm ci. That rewrotegetPlatformLinkinweb/frontend/src/app/apps/[id]/page.tsxinto a CI-failing shape (fix: high-confidence security audit (SSRF, uploads, personas auth, JSON-LD) #11304) and polluted four PRs in one day, plus unrelatedapp/Dart files reformatted by a locally-installed Dart SDK that differs from the repo's pinned Flutter.web/frontend's test suite ran in no lane.package.jsonhas"test": "node --test src/__tests__/*.test.mjs"with real guards (app-detail-not-found,case-status,shared-conversation-chat-contract), but.github/checks-manifest.yamlnever selected them — which is why a deleted frontend test's guards had to be re-homed into a backend pytest to keep running.web/admin/AGENTS.mdwas 137 bytes from red.agents-md-leangoing over budget takesmainred and blocks every PR touching anyAGENTS.md(agents-md-lean is red on main: desktop/macos/AGENTS.md is 392 bytes over budget, blocking every push that touches any AGENTS.md #11409, fixed by docs(desktop): unblock agents-md-lean by moving agent-swift reference into docs/ #11410).AGENTS.mdpush-gate budget says pre-push must "cap broad backend selection at 40 files", andscripts/pre-pushdoes cap it — but when the selector overflows, the cap branch swaps in the diff's own changed backend test files and never re-applies the cap to that replacement. A diff changing more than 40 backend test files ran unbounded, while the message still printedcap is 40. security: remove screen activity cloud egress #11018's 92-file diff stalled its push on this gate repeatedly; it had 15 changed backend test files so it stayed under the cap, but slow enough that several agents resorted to documented skip hatches — one size larger and there would have been no bound at all.What changed
scripts/pre-commitresolves the pinned toolchain and refuses to format rather than formatting with the wrong one: each web dir'spackage.jsonprettier major must matchnode_modules/.bin/prettier, and Dart requires theflutter-versionpinned in.github/workflows/repo-checks.yml. Both fallbacks (npx, globalprettier) are gone. Hatches:OMI_SKIP_WEB_FORMAT=1,OMI_SKIP_DART_FORMAT=1, both documented in the rootAGENTS.mdFormatting section. Web directories are now derived from the staged paths, soweb/admin(previously skipped entirely) is covered. New regression testscripts/test-pre-commit-pinned-toolchains.sh, registered as manifest checkpre-commit-pinned-toolchains.web-frontend-tests(local+ci, triggersweb/frontend/**) runningnode --test 'web/frontend/src/__tests__/**/*.test.mjs'— the glob picks up test files added later.web/admin/AGENTS.mdnetworking and revenue-metrics detail moved verbatim intoweb/admin/docs/data-contracts.md, with the two top-level rules and a pointer left behind. Budgets untouched.scripts/pre-pushfallback now truncates deterministically to the cap. The changed-test list is alreadysort -ued, sohead -n cappicks the same files on every push of the same diff rather than sampling a different subset. Truncation beats skipping here because the diff's own changed test files are the highest-signal local coverage available; the message now names the full changed-test count, what actually ran, and points atcd backend && bash test.shfor the remainder — it never prints a cap the run then exceeds.PRE_PUSH_MAX_BACKEND_UNIT_TEST_FILESstays the single knob. New regression testscripts/test-pre-push-backend-test-cap.sh, registered as manifest checkpre-push-backend-test-cap(local+ci). Distinct lane from fix(ci): keep routing-only push gates bounded #11361, which narrowsflutter-codegenselection inscripts/pre_push_ci_prediction.py— same class of problem, no overlapping files.Verification
Mutation test of the new guard — with
scripts/pre-commitreverted toorigin/main,scripts/test-pre-commit-pinned-toolchains.shfails and the output shows the exact hazard:With the fix applied:
pre-commit pinned-toolchain refusal tests passed(refusal cases for missing prettier, prettier major mismatch, no flutter, flutter version mismatch; positive cases for the pinned versions; and both hatches).Manifest selection (
run_checks.py --list):web-frontend-testsweb/frontend/src/app/apps/x.tsxweb/frontend/src/__tests__/new-thing.test.mjsbackend/main.pyrun_checks.py --lane ci --check-id web-frontend-tests→ 47 tests pass, 0 fail.AGENTS.md headroom after this PR (
python3 .github/scripts/check_agents_md_lean.py→ok: 7 AGENTS.md files within budget):web/admin/AGENTS.mdAGENTS.md.github/AGENTS.mdapp/AGENTS.mdbackend/AGENTS.mddesktop/macos/AGENTS.mdomi/firmware/AGENTS.mdbackend/AGENTS.mdremains 64 bytes from the same failure and still needs its own PR.Mutation test of the pre-push cap bound — the regression test extracts the real
check_backend_unit_tests_if_neededfrom the hook and runs it against a stubbed selector and backend, so it exercises production control flow rather than scraping source. With the bound reverted:With the bound restored:
pre-push backend unit test cap tests passed(over-cap truncation, stable + sorted truncation across repeated runs, the unchanged under-cap fallback message, and the unchanged empty-fallback skip).make preflightpasses.Product invariants affected
none
Failure class (fixes)
Failure-Class: none
The pre-push cap fix is likewise
none: no registered class covers "a bound's own fallback path must re-apply that bound", and one instance does not justify opening one.The nearest existing class,
FC-dev-fallback-masks-install-defect(a development-only fallback must never be the reason a check passes), is scoped to packaged-app resource resolution on desktop; this is the same shape in a different subsystem but the registry transition belongs in its own PR.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to git hooks, check manifest entries, and devDependency/docs wiring; no production runtime or auth paths are modified.
Overview
Tightens local git hooks and CI manifest guards so formatting and pre-push selection cannot silently diverge from what CI enforces.
scripts/pre-commitnow refuses to auto-format when toolchains do not match repo pins: web Prettier (andprettier-plugin-tailwindcss) must matchpackage-lock.jsonvia localnode_modules; Dart uses the Flutter version from.github/workflows/repo-checks.ymland that SDK’sdartbinary. Floatingnpx/global Prettier fallbacks are removed. Web dirs are inferred from staged paths (soweb/adminis included),*.generated.tsis skipped, and format-and-add is blocked when a file has unstaged edits. Escape hatchesOMI_SKIP_WEB_FORMAT=1/OMI_SKIP_DART_FORMAT=1are documented in rootAGENTS.md.scripts/pre-pushre-appliesPRE_PUSH_MAX_BACKEND_UNIT_TEST_FILESwhen the broad-selector fallback runs changed backend test files from the diff—deterministic sorted truncation and clearer logging instead of an unbounded run that still claimed a cap..github/checks-manifest.yamladdspre-commit-pinned-toolchains,pre-push-backend-test-cap, andweb-frontend-tests(scripts/run-web-frontend-tests.sh→node --testonweb/frontend).web/admin/AGENTS.mdis trimmed for the lean budget; networking/revenue detail moves toweb/admin/docs/data-contracts.md.web/adminandweb/apppin Prettier ^2.8.8 (+ tailwind plugin) so the hook can format them safely.Reviewed by Cursor Bugbot for commit 44dcc98. Configure here.