Skip to content

Remove the usage file - #415

Draft
janvanicek wants to merge 1 commit into
mainfrom
jv-PAT-2006-remove-usage-file
Draft

Remove the usage file#415
janvanicek wants to merge 1 commit into
mainfrom
jv-PAT-2006-remove-usage-file

Conversation

@janvanicek

@janvanicek janvanicek commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Context

Linear: PAT-2006

The usage file has never worked. A component could report its own consumption by writing out/usage.json; job-runner's UsageFile read it, validated it, and handed it to Client::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-client 25.5.0). job-runner was the only caller, and nothing subclasses Client.

So usageData is [] on every queue v2 job (100% of jobs in the last 90 days — 23,010,147). Nothing consumes it either: zero hits for usageData/usage_data in telemetry-billing, billing-api, telemetry-billing-gcp or connection, and the telemetry kbc_job extract has no usage column.

UsageFileTest mocked addJobUsage and 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

  1. keboola/docker-bundleRunner::run() loses its fifth parameter
  2. keboola/job-runner — then composer update keboola/dockerbundle
  3. keboola/job-queue — removes addJobUsage() from the client. The standalone keboola/job-queue-internal-api-php-client is synced from the monorepo, so it picks this up automatically and then needs a new major tag.
  4. keboola/developers-docs + keboola/connection-docs — last, so the docs do not get ahead of the deployed behaviour

What this PR does

Deletes src/UsageFile.php and tests/UsageFileTest.php, and drops the construction and the Runner::run() argument in RunCommand.

Blocked on keboola/docker-bundle#810Runner::run() loses its fifth parameter. Merge that first, then run composer update keboola/dockerbundle on this branch before merging.

Verified: composer phpcs clean. composer phpstan against the current lock reports exactly the two expected index-shift errors (Parameter #5, Parameter #7) and nothing else; built against the docker-bundle branch it reports no errors.

Release Notes

Justification, description
UsageFile read out/usage.json, validated it and passed it to Client::addJobUsage(), which does nothing. This was the only caller anywhere.

Plans for Customer Communication
None needed — the feature never had an effect. The docs advertising it are removed in the paired developers-docs and connection-docs PRs.

Impact Analysis
No API or contract change in this service. One behaviour change inherited from docker-bundle: 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 k8sContainers). $component->getConfigurationFormat() was only read here to pick usage.json vs usage.yml; it is still used elsewhere for the config file.

Deployment Plan
Second in the batch. Requires docker-bundle merged plus a lock bump on this branch. Standard job-runner release afterwards — the DinD executor pod picks up the new image on the next job.

Rollback Plan
Revert this PR and the docker-bundle one, redeploy the previous job-runner image. No state, no migration.

Post-Release Support Plan
Nothing specific. This change cannot make a previously-passing job fail.

`UsageFile` read `out/usage.json`, validated it and handed it to
`Client::addJobUsage()`, which has had an empty body since 2019 — the payload was
always discarded. This was the only caller.

`UsageFileTest` mocked `addJobUsage` and asserted it was called, so it stayed
green against a method that does nothing; that is why this went unnoticed.

Requires the matching keboola/dockerbundle change: `Runner::run()` loses its
fifth parameter. Merge dockerbundle first, then `composer update
keboola/dockerbundle` here.
@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

PAT-2006

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.

1 participant