Remove the usage file - #810
Draft
janvanicek wants to merge 1 commit into
Draft
Conversation
`out/usage.json` was read, validated and then handed to `Client::addJobUsage()`, which has had an empty body since 2019 — the payload was always discarded, on every runtime. Removes the whole read path: `UsageFileInterface`, `NullUsageFile`, `Configuration\Usage` and its adapter, the (unreferenced) usage JSON schema, the `TestUsageFile` double, and the `$usageFile` parameter threaded through `Runner::run()`, `runRow()`, `runComponent()` and `runImages()`. BC break: `Runner::run()` loses its fifth parameter. Behaviour change: a malformed `out/usage.json` no longer fails an otherwise successful job. That validation was the feature's only observable effect, and it had no counterpart on the k8sContainers runtime, so this also removes a dind/no-dind divergence.
This was referenced Aug 10, 2026
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.
Context
Linear: PAT-2006
The usage file has never worked. A component could report its own consumption by writing
out/usage.json;job-runner'sUsageFileread it, validated it, and handed it toClient::addJobUsage()— a method with an empty body (// todo implement this) since it was introduced on 2019-07-04 (af3033b). Verified at the version pinned into job-runner's production build (keboola/job-queue-internal-api-php-client25.5.0).job-runnerwas the only caller, and nothing subclassesClient.So
usageDatais[]on every queue v2 job (100% of jobs in the last 90 days — 23,010,147). Nothing consumes it either: zero hits forusageData/usage_dataintelemetry-billing,billing-api,telemetry-billing-gcporconnection, and the telemetrykbc_jobextract has no usage column.UsageFileTestmockedaddJobUsageand asserted it was called, so it stayed green against a method that does nothing — that is why this survived seven years.Only one component in the org writes a usage file:
keboola.ex-google-analytics-v4. Its reports have been discarded all along, so nothing changes for it.Deployment order for this batch
keboola/docker-bundle—Runner::run()loses its fifth parameterkeboola/job-runner— thencomposer update keboola/dockerbundlekeboola/job-queue— removesaddJobUsage()from the client. The standalonekeboola/job-queue-internal-api-php-clientis synced from the monorepo, so it picks this up automatically and then needs a new major tag.keboola/developers-docs+keboola/connection-docs— last, so the docs do not get ahead of the deployed behaviourWhat this PR does
Removes the whole read path:
UsageFileInterface,NullUsageFile,Configuration\Usageand its adapter, the (unreferenced)Resources/schemas/usage.json, theTestUsageFiledouble, the two usage tests inRunnerTest, and the$usageFileparameter threaded throughRunner::run(),runRow(),runComponent()andrunImages(). Five now-stalephpstan-baseline.neonentries go with them.Verified:
composer phpstan(analysessrcandTests, so all ~70Runner::run()call sites are argument-checked) andcomposer phpcsboth clean. The full test suite needs live Storage API/ECR credentials and was not run.Release Notes
Justification, description
out/usage.jsonwas read and validated on every main-image run and then thrown away, becauseaddJobUsage()is an empty method. This removes the dead path rather than leaving a parameter that can only ever be a no-op. It also removes a dind/no-dind divergence: thek8sContainersruntime never had a usage-file counterpart.Plans for Customer Communication
None needed. No customer-visible feature is being withdrawn — the feature never did anything. The documentation that advertised it is removed in the paired
developers-docsandconnection-docsPRs.Impact Analysis
BC break for library consumers:
Runner::run()loses its fifth parameter.job-runneris the only consumer ofkeboola/dockerbundle(runner-sync-apihas been DinD-free since sync actions moved to pods) and is updated in the paired PR.One behaviour change: a malformed
out/usage.jsonno longer fails an otherwise successful job.storeUsage()ran in afinallyblock, so a bad usage file surfaced as an application error — the feature's only observable effect. Jobs that used to fail this way will now succeed, which matches how the same job already behaves onk8sContainers. Onlykeboola.ex-google-analytics-v4writes a usage file at all, and it writes a valid one.Deployment Plan
Merge first in the batch (see order above), then bump the lock in
job-runner.Rollback Plan
Revert the commit and revert the paired
job-runnerPR. No data migration, no state to unwind.Post-Release Support Plan
Nothing to watch specifically. If a component starts failing right after the job-runner release, this change can only make a previously-failing usage-file job pass, not the reverse.