Repository navigation
chore(hooks): replace pip pre-commit framework with plain .githooks - #923
Merged
Merged
Conversation
The pip-based pre-commit framework cold-installs its hook environments on every fresh CI runner; in the #921 @infer run that took 7m2s and was killed by the agent's Bash tool timeout. Replace it with a plain .githooks/pre-commit shell script (same pattern as infer-action): git diff --cached --check for whitespace/conflict markers, staged-file-gated mod:tidy and mocks:generate, then fmt + lint. The hook uses task from PATH (announcing which one it picked) and only falls back to re-executing inside flox for local commits made outside an activated shell, so CI needs neither flox nor pip. task precommit:install now sets core.hooksPath; task precommit:run executes the hook directly, keeping the existing CI/agent contract. pre-commit is dropped from the flox manifest.
When the telemetry unit tests run under a live infer session (an agent running go test), ChildEnv has injected TRACEPARENT and OTLP exporter env vars into the subprocess. The fixture recorders then export real OTLP spans parented under the live tool span - fake 'session/chat openai/gpt-4o' trees appeared in the #921 run's trace - and TestTraceSpansNestAndExport fails because its session span is no longer a root. Unset the trace-context and OTEL_* vars in TestMain so the package is hermetic.
Contributor
|
🎉 This PR is included in version 0.148.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In the #921 @infer run (29505567185), the agent's
pre-commit runspent 7m2s cold-installing pip hook environments and was killed by the Bash tool timeout (exit status -1). The framework's only real job here was invokingtaskcommands.What
.githooks/pre-commit(plain POSIX sh, same pattern as infer-action):git diff --cached --checkfor trailing whitespace + conflict markers,task mod:tidywhengo.mod/go.sumstaged,task mocks:generatewheninternal/domain/interfaces.gostaged, thentask fmt+task linttaskfrom PATH and announces which one it picked (pre-commit: using task from PATH (...)), so CI logs show the pipeline toolchain won; falls back to re-executing insideflox activateonly for local commits outside an activated shell; fails loudly when neither is available. CI needs neither flox nor pip for the hook.task precommit:install→git config core.hooksPath .githooks;task precommit:run→ runs the hook directly (existing CI/agent contract unchanged).pre-commit-config.yaml, droppedpre-commitfrom the flox manifest, updated docsAlso includes a
test(telemetry)commit: scrub inheritedTRACEPARENT/OTEL_*env in the package'sTestMain— under a live infer session the fixture recorders were exporting fakesession → chat openai/gpt-4ospans into the real trace (the_OTHERerror in the #921 trace) andTestTraceSpansNestAndExportfails because its session span is no longer a root.Follow-up for the reusable workflow (drop
pip install pre-commit): inference-gateway/.github#112Verification
task precommit:runpasses on a clean tree; both commits in this PR were made through the new hookTRACEPARENT=... OTEL_EXPORTER_OTLP_ENDPOINT=... go test ./internal/telemetry/...fails without the TestMain scrub, passes with it