Skip to content

chore: enforce errors.AsType and point CLAUDE.md at AGENTS.md - #7521

Merged
fracasula merged 2 commits into
masterfrom
chore/enforce-errors-astype
Oct 23, 2026
Merged

fracasula merged 2 commits into
masterfrom
chore/enforce-errors-astype

Conversation

@fracasula

@fracasula fracasula commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Enforces errors.AsType[T](err) (Go 1.26+) over errors.As, the same rule as rudderlabs/rudder-go-kit#1262 and rudder-ingestion-svc.

  • .golangci.yml — a forbidigo rule rejects the standard library errors.As.
  • AGENTS.md — a "Never Do" entry next to the other linter-enforced bans, so agents write errors.AsType in the first place.
  • 23 call sites migrated — jobsdb, router, notifier, geolocation, the embedded warehouse transformer, and the warehouse API, source and integrations (BigQuery, ClickHouse, Glue, Redshift, Snowflake). Behaviour is unchanged.

Notes on the less mechanical ones:

  • switch cases (services/notifier, warehouse/source) — errors.AsType runs before the switch, since a case can't declare variables; case order is unchanged.
  • Value-type targets — errors.As(err, &maxminddb.InvalidDatabaseError{}) and errors.As(err, &invalidDestinationCredErr{}) matched the value type, so they become errors.AsType[maxminddb.InvalidDatabaseError] and errors.AsType[invalidDestinationCredErr]. Both implement error on the value.
  • jobsdb/jobsdb_test.go — ignored the errors.As result and then dereferenced e; it now asserts ok first, so a non-*pq.Error fails the test instead of panicking.

CLAUDE.md and .junie point at AGENTS.md

AGENTS.md already holds the guidelines, but nothing pointed Claude Code at it: there was no root CLAUDE.md, and since #6066 .junie/guidelines.md and init/CLAUDE.md have been symlinks to an .ai-agent/guidelines.md that was never committed. A second commit adds a root CLAUDE.md symlink to AGENTS.md, repoints .junie/guidelines.md at it, and removes init/CLAUDE.md, which Claude Code would only read when working inside init/.

Verification

  • The rule was checked against the unmigrated code first: a forbidigo-only golangci-lint run flagged all 23 calls, and reports nothing after the migration. That run type-checks every package, tests included.
  • gofumpt -extra reports no changes on the touched files.
  • Ran locally: router (TestRedact*), services/geolocation, and the warehouse transformer utils timestamp tests.
  • Not run locally: jobsdb, notifier and the warehouse integration suites, which need Docker or cloud credentials. CI covers them.

Linear Ticket

None.

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Add a forbidigo rule rejecting the standard library errors.As, list it
among the linter-enforced bans in AGENTS.md, and migrate the 23 existing
errors.As calls.
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.16%. Comparing base (3c240a3) to head (593aaaa).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
warehouse/integrations/bigquery/bigquery.go 50.00% 2 Missing ⚠️
jobsdb/jobsdb_tx.go 0.00% 1 Missing ⚠️
services/notifier/notifier.go 66.66% 1 Missing ⚠️
warehouse/integrations/snowflake/snowflake.go 0.00% 1 Missing ⚠️
warehouse/source/source.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7521       +/-   ##
===========================================
+ Coverage        0   85.16%   +85.16%     
===========================================
  Files           0      633      +633     
  Lines           0    62917    +62917     
===========================================
+ Hits            0    53585    +53585     
- Misses          0     9329     +9329     
- Partials        0        3        +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

AGENTS.md holds the guidelines, but nothing pointed Claude Code at it:
there was no root CLAUDE.md, and .junie/guidelines.md and init/CLAUDE.md
have linked to an .ai-agent/guidelines.md that was never committed.

Add a root CLAUDE.md symlink to AGENTS.md, repoint .junie/guidelines.md,
and remove init/CLAUDE.md, which Claude Code only reads inside init/.
@fracasula fracasula changed the title chore: enforce errors.AsType over errors.As chore: enforce errors.AsType and point CLAUDE.md at AGENTS.md Oct 22, 2026
@fracasula
fracasula marked this pull request as ready for review October 22, 2026 12:40
@fracasula
fracasula merged commit 5c7e088 into master Oct 23, 2026
76 checks passed
@fracasula
fracasula deleted the chore/enforce-errors-astype branch October 23, 2026 07:50
itsmihir pushed a commit that referenced this pull request Oct 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.92.0-rc.1](v1.91.0...v1.92.0-rc.1)
(2026-10-26)


### Features

* **processor:** pyt test-pod deployer sets PYT_MODE=test
([#7506](#7506))
([a050ed6](a050ed6))
* **processor:** reset the per-workspace pyt client on 421
([#7494](#7494))
([83db4d6](83db4d6))
* **router:** re-fetch the cached OAuth token when the control plane
holds a newer secret (PRO-5947)
([#7478](#7478))
([742779d](742779d))
* **router:** tag oauth_action counters with destinationId and count
AUTH_STATUS_INACTIVE (PRO-5946)
([#7477](#7477))
([0e15eb4](0e15eb4))


### Bug Fixes

* flaky TestDrainConfigRoutine failing with "database is closed"
([#7489](#7489))
([9baa89f](9baa89f))


### Miscellaneous

* block new ginkgo/gomega usage in tests
([#7502](#7502))
([e1c9d38](e1c9d38))
* bump dependency versions
([#7522](#7522))
([1067ff4](1067ff4))
* enforce errors.AsType and point CLAUDE.md at AGENTS.md
([#7521](#7521))
([5c7e088](5c7e088))
* go 1.27.3
([#7516](#7516))
([3c240a3](3c240a3))
* migrate debugger, services, async destination and utils tests from
ginkgo to testify
([#7503](#7503))
([1a8c85a](1a8c85a))
* migrate gateway, rsources, reporting, batchrouter and manager tests
from ginkgo to testify
([#7507](#7507))
([ffdd505](ffdd505))
* remove ginkgo and gomega from tests
([#7508](#7508))
([d3e7e0f](d3e7e0f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir pushed a commit that referenced this pull request Oct 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.92.0](v1.91.0...v1.92.0)
(2026-10-26)


### Features

* **processor:** pyt test-pod deployer sets PYT_MODE=test
([#7506](#7506))
([a050ed6](a050ed6))
* **processor:** reset the per-workspace pyt client on 421
([#7494](#7494))
([83db4d6](83db4d6))
* **router:** re-fetch the cached OAuth token when the control plane
holds a newer secret (PRO-5947)
([#7478](#7478))
([742779d](742779d))
* **router:** tag oauth_action counters with destinationId and count
AUTH_STATUS_INACTIVE (PRO-5946)
([#7477](#7477))
([0e15eb4](0e15eb4))


### Bug Fixes

* flaky TestDrainConfigRoutine failing with "database is closed"
([#7489](#7489))
([9baa89f](9baa89f))


### Miscellaneous

* block new ginkgo/gomega usage in tests
([#7502](#7502))
([e1c9d38](e1c9d38))
* bump dependency versions
([#7522](#7522))
([1067ff4](1067ff4))
* enforce errors.AsType and point CLAUDE.md at AGENTS.md
([#7521](#7521))
([5c7e088](5c7e088))
* go 1.27.3
([#7516](#7516))
([3c240a3](3c240a3))
* migrate debugger, services, async destination and utils tests from
ginkgo to testify
([#7503](#7503))
([1a8c85a](1a8c85a))
* migrate gateway, rsources, reporting, batchrouter and manager tests
from ginkgo to testify
([#7507](#7507))
([ffdd505](ffdd505))
* remove ginkgo and gomega from tests
([#7508](#7508))
([d3e7e0f](d3e7e0f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants