Repository navigation
Tags
Tags
Migrate skills to .agents and trim GEMINI.md (#3295) AI coding agents and reviewers working across fork-based workflows currently hit four recurring sources of friction: repository skills sit in a legacy directory that standard Git workspaces do not auto-discover, local diff and formatting checks overwrite remote tracking refs or diff against stale fork bases, redundant checklists and contradictory rules bloat always-on context toward per-file truncation limits, and commit messages often bury why a change matters beneath low-level file mechanics. Consolidating and trimming the repository engineering guide, relocating skills to the standard discovery directory, making fork-point detection strictly read-only, and requiring plain-English motivation at the top of every commit eliminate these failure modes. As a result, agents discover repository skills automatically without mutating developer Git remotes, always-on instructions stay comfortably below truncation caps, and reviewers can grasp the purpose and value of every pull request on first read. 1. **`GEMINI.md` (`20,649 B` -> `18,118 B`, down from `28,125 B` pre-#3284):** - Keeps the guide comfortably below the `24,000 B` per-file truncation cap while preserving all invariants added in #3284, #3301, and #3312 (including `Sync & Rebase onto upstream/master`). - Updates `Commit Message Style` so commit and PR bodies open with 2–4 plain-English sentences stating why the change is being made, what problem, waste, or risk exists today, and what concrete outcome improves—before naming classes, flags, or implementation mechanics ("what"/"how"). - Replaces the rigid push ban with a default push gate (halt at local commit unless overridden by a user-level rule or an explicit directive to open/update a PR; use `--force-with-lease` on amended branches; never chain remote transfers with `git commit`). - Resolves internal contradictions: recommends a fixed static `Instant.parse(...)` constant in `reTransact` test helpers (instead of `clock.now()`) and statically imported `formatInstant(...)` from `DateTimeUtils`. - Preserves both Reviewable footer formats (the HTML-comment Reviewable block and `This change is https://reviewable.io/reviews/...`), deduplicates the pre-commit `pr-polisher` checklist into a concise pointer to `.agents/skills/pr-polisher/SKILL.md`, and keeps a single concise `Continuous Improvement` bullet under `Common Pitfalls & Efficiency`. 2. **Migrate repo skills from `.gemini/skills/` to `.agents/skills/`:** - Moves `pr-polisher` (including `check_diff_test.py` from #3311) and `java-ast-refactoring` into `.agents/skills/` so agents automatically discover them in Git workspaces, updating all path references (including `SCRIPT_PATH` in `check_diff.py`). - Removes duplicated `Continuous Improvement` sections from both `SKILL.md` files (previously instructing agents to commit skill edits inside unrelated PRs), keeping the single concise `Continuous Improvement` bullet in `GEMINI.md`, and fixes YAML 1.2 frontmatter quoting in `.agents/skills/pr-polisher/SKILL.md` (removing internal VCS wording). 3. **Read-only merge-base & `pr-polisher` fixes:** - Removes the `git update-ref` mutation of `refs/remotes/origin/master` from `.agents/skills/pr-polisher/scripts/check_diff.py` and replaces hardcoded `HEAD^` diffs (including `check_protostuff_cached_entities()`) with a read-only `get_diff_base()` helper selecting the fresher merge-base across `upstream/master` and `origin/master` (gracefully catching `CalledProcessError` on shallow or unrelated remote refs and falling back to `refs/heads/master`, covered in `check_diff_test.py`). - Updates `java-format/google-java-format-git-diff.sh` (`findForkPoint()`) to pick the fresher merge-base across fully qualified `refs/remotes/upstream/master` and `refs/remotes/origin/master` read-only (falling back cleanly on shallow/unrelated refs via `|| true` and propagating errors via `forkPoint=$(findForkPoint) || exit 1`). - Fixes the self-contradictory `DateTimeUtils.formatInstant(...)` message in `check_diff.py` to recommend statically importing `formatInstant(...)`, and aligns the `Instant.now()` message with `GEMINI.md`. Verification: - `python3 .agents/skills/pr-polisher/scripts/check_diff_test.py -v`: `11/11` passed. - `python3 .agents/skills/pr-polisher/scripts/check_diff.py`: `0` errors, `0` warnings (`spotlessCheck` and `javaIncrementalFormatCheck` passed). - `./gradlew --no-daemon runPresubmits`: `BUILD SUCCESSFUL`. - Verified strict YAML frontmatter parsing on all `.agents/skills/*/SKILL.md` files, `bash -n java-format/google-java-format-git-diff.sh`, and zero remaining `.gemini/skills` references across the repository. BUG=http://b/588443833 Signed-off-by: Ben McIlwain <mcilwain@google.com>
Fix default RDE report URL and add HTTP timeouts (#3310) Non-production RDE report uploads currently hang and return HTTP 500 every day because the default rde.reportUrlPrefix still points at legacy port 8543 on ICANN's test server (which silently drops TCP SYNs while port 443 answers immediately), and UrlConnectionService creates HttpURLConnection instances with infinite connect and read timeouts. When a peer stalls, RdeReportAction hits LockHandlerImpl's 55-second TimeLimiter deadline while the blocked socket thread keeps running until the OS TCP SYN timeout (~2 minutes), causing late Lock.release() collisions after a retry has already acquired the expired 1-minute lock. - Drop the obsolete `:8543` port from `rde.reportUrlPrefix` in `default-config.yaml` so non-production environments target ICANN's standard HTTPS port (`https://test-ry-api.icann.org/report/registry-escrow-report`). - Set default connect (15s) and per-read (60s) timeouts in `Modules.UrlConnectionServiceModule` so unresponsive peers cannot hang worker threads indefinitely across any `UrlConnectionService` caller while preserving large streaming downloads. - Set stricter connect (15s) and read (30s) timeouts in `RdeReporter` (sum 45s < 55s effective lock timeout), log the target URL alongside the XML report, and move `setPayload()` inside `try`/`finally` so failed connect/write calls still invoke `connection.disconnect()`. - Catch `TimeoutException` directly in `LockHandlerImpl` so timeouts thrown by `SimpleTimeLimiter.callWithTimeout()` include lock name, TLD, elapsed duration, and start time instead of falling through to generic `Exception` wrapping. - Add unit tests in `RegistryConfigTest`, `ModulesTest`, `RdeReportActionTest`, and `LockHandlerImplTest`. BUG= http://b/591995151 Signed-off-by: Ben McIlwain <mcilwain@google.com>
Prevent HTTP request smuggling on proxy retry (#3306) Fix buffer readerIndex sharing on failed relay writes in the EPP proxy and bound reflected XML parse error details in Nomulus: - Duplicate ByteBufHolder messages via retainedDuplicate() in RelayHandler.writeToRelayChannel() before writing to the outbound relay channel. Previously, calling retain() shared a single readerIndex 10BC8 with outbound encoders (HttpObjectEncoder and SslHandler), so retrying a failed backend write replayed the original Content-Length header with a partially or fully consumed body, allowing subsequent requests on the shared backend channel to be absorbed into the retried request body. - Truncate SAXParseException and XMLStreamException detail strings to 256 characters in XmlTransformer.unmarshal() so oversized invalid XML values cannot amplify EPP syntax error responses past the proxy HTTP aggregator limit or echo arbitrary request content. - Add unit tests in RelayHandlerTest and XmlTestdataTest covering body preservation across HTTP encoder retries and parse error truncation.
Prevent HTTP request smuggling on proxy retry (#3306) Fix buffer readerIndex sharing on failed relay writes in the EPP proxy and bound reflected XML parse error details in Nomulus: - Duplicate ByteBufHolder messages via retainedDuplicate() in RelayHandler.writeToRelayChannel() before writing to the outbound relay channel. Previously, calling retain() shared a single readerIndex with outbound encoders (HttpObjectEncoder and SslHandler), so retrying a failed backend write replayed the original Content-Length header with a partially or fully consumed body, allowing subsequent requests on the shared backend channel to be absorbed into the retried request body. - Truncate SAXParseException and XMLStreamException detail strings to 256 characters in XmlTransformer.unmarshal() so oversized invalid XML values cannot amplify EPP syntax error responses past the proxy HTTP aggregator limit or echo arbitrary request content. - Add unit tests in RelayHandlerTest and XmlTestdataTest covering body preservation across HTTP encoder retries and parse error truncation.
Prevent HTTP request smuggling on proxy retry (#3306) Fix buffer readerIndex sharing on failed relay writes in the EPP proxy and bound reflected XML parse error details in Nomulus: - Duplicate ByteBufHolder messages via retainedDuplicate() in RelayHandler.writeToRelayChannel() before writing to the outbound relay channel. Previously, calling retain() shared a single readerIndex with outbound encoders (HttpObjectEncoder and SslHandler), so retrying a failed backend write replayed the original Content-Length header with a partially or fully consumed body, allowing subsequent requests on the shared backend channel to be absorbed into the retried request body. - Truncate SAXParseException and XMLStreamException detail strings to 256 characters in XmlTransformer.unmarshal() so oversized invalid XML values cannot amplify EPP syntax error responses past the proxy HTTP aggregator limit or echo arbitrary request content. - Add unit tests in RelayHandlerTest and XmlTestdataTest covering body preservation across HTTP encoder retries and parse error truncation.
Enforce registrar ownership in bulk domain action (#3287) ConsoleBulkDomainAction executes EPP commands with isSuperuser=true for admin users, which bypasses EPP's verifyResourceOwnership check in DomainDeleteFlow and DomainUpdateFlow. As a result, a bulk delete, suspend, or unsuspend request tagged with registrarId=B could mutate domains sponsored by registrar A when submitted by an admin (e.g. during a UI registrar switch race). For each target domain, load the active domain via ForeignKeyUtils.loadResource inside the same transaction that the EPP flow enlists in so ownership is verified atomically at the flow's transaction timestamp (eliminating TOCTOU races with concurrent transfers or registrations). Return an EPP 2201 authorization error without running EPP or recording ConsoleUpdateHistory when the domain's current sponsor does not match registrarId. For nonexistent or deleted domains, invoke EPP with isSuperuser=false to preserve existing 2303 behavior without superuser fallthrough. Also reject null entries in domainList with HTTP 400 and deduplicate domainList (preserving order) before execution so duplicate entries do not execute EPP twice or fail in toImmutableMap after mutating the DB. Add unit tests covering admin cross-registrar delete, suspend, mixed batches, duplicate domains, null list entries, nonexistent/deleted domains, and expired pending transfers projected to another registrar. BUG= http://b/588464773
Enforce registrar ownership in bulk domain action (#3287) ConsoleBulkDomainAction executes EPP commands with isSuperuser=true for admin users, which bypasses EPP's verifyResourceOwnership check in DomainDeleteFlow and DomainUpdateFlow. As a result, a bulk delete, suspend, or unsuspend request tagged with registrarId=B could mutate domains sponsored by registrar A when submitted by an admin (e.g. during a UI registrar switch race). For each target domain, load the active domain via ForeignKeyUtils.loadResource inside the same transaction that the EPP flow enlists in so ownership is verified atomically at the flow's transaction timestamp (eliminating TOCTOU races with concurrent transfers or registrations). Return an EPP 2201 authorization error without running EPP or recording ConsoleUpdateHistory when the domain's current sponsor does not match registrarId. For nonexistent or deleted domains, invoke EPP with isSuperuser=false to preserve existing 2303 behavior without superuser fallthrough. Also reject null entries in domainList with HTTP 400 and deduplicate domainList (preserving order) before execution so duplicate entries do not execute EPP twice or fail in toImmutableMap after mutating the DB. Add unit tests covering admin cross-registrar delete, suspend, mixed batches, duplicate domains, null list entries, nonexistent/deleted domains, and expired pending transfers projected to another registrar. BUG= http://b/588464773
Enforce registrar ownership in bulk domain action (#3287) ConsoleBulkDomainAction executes EPP commands with isSuperuser=true for admin users, which bypasses EPP's verifyResourceOwnership check in DomainDeleteFlow and DomainUpdateFlow. As a result, a bulk delete, suspend, or unsuspend request tagged with registrarId=B could mutate domains sponsored by registrar A when submitted by an admin (e.g. during a UI registrar switch race). For each target domain, load the active domain via ForeignKeyUtils.loadResource inside the same transaction that the EPP flow enlists in so ownership is verified atomically at the flow's transaction timestamp (eliminating TOCTOU races with concurrent transfers or registrations). Return an EPP 2201 authorization error without running EPP or recording ConsoleUpdateHistory when the domain's current sponsor does not match registrarId. For nonexistent or deleted domains, invoke EPP with isSuperuser=false to preserve existing 2303 behavior without superuser fallthrough. Also reject null entries in domainList with HTTP 400 and deduplicate domainList (preserving order) before execution so duplicate entries do not execute EPP twice or fail in toImmutableMap after mutating the DB. Add unit tests covering admin cross-registrar delete, suspend, mixed batches, duplicate domains, null list entries, nonexistent/deleted domains, and expired pending transfers projected to another registrar. BUG= http://b/588464773
PreviousNext