Abstract navy data rails with blank tiles and a red inserted tile shifting a row Abstract navy data rails with blank tiles and a red inserted tile shifting a row

GitHub Usage Report CSV: Fix Imports Before the User ID Column

A new adjacent field can break a fixed-position import. Our local fixture run compares old and new layouts, named headers and a missing required column.

A GitHub usage report CSV importer can read the wrong value without losing a single row. Before the announced 1 December 2026 user_id addition, check whether your script identifies fields by header name or by a hard-coded position. Then test what happens when a required field is missing.

We ran two small local parsers on paired synthetic layouts. A fixed index found the expected quantity in all three old-layout rows and none of the three new-layout rows. A header-based read found it in all three rows of both layouts. These results describe our fixtures, not a GitHub export or a billing audit.

GitHub usage report CSV: what changes on December 1?

GitHub’s 23 November notice says applicable reports containing username gain an adjacent user_id field from 1 December. Fields after username shift right. The detailed, AI and premium-request usage reports are in scope; the summarized report is unchanged. The notice covers Enterprise Cloud and standalone Team organizations.

The same notice says account-unlinked usage can have an empty ID, while bot usage can have an account ID. It also describes separate rows for different deleted accounts and possible last-decimal rounding differences. These are reasons to retain attribution and precision rules, rather than assuming a layout change alters underlying consumption.

Use a minimal fixture before a full export

Our old fixture has username, quantity and unit_type. The new fixture inserts user_id after username. Each contains the same fictional member, bot and unattributed records, with quantities 10, 5 and 2 in one deliberately fictional unit. These are reduced teaching schemas, not complete or exact production report layouts.

The synthetic IDs are labels, not real GitHub account identifiers. We use them only to make accidental field substitution obvious. Neither fixture contains a price or a currency. Its total of 17 fixture units is an arithmetic check within this one example, not an amount that can be compared across product SKUs.

Layout / parserCorrect quantity fieldsWhat happened
Old / fixed index3 of 3Index 1 happens to be quantity
Old / header name3 of 3quantity selected explicitly
New / fixed index0 of 3Index 1 now reads user_id
New / header name3 of 3quantity still selected explicitly
Observed local Python reads of synthetic CSVs. Correctness means an exact expected field value, not successful numeric conversion, valid billing or production compatibility.
Local synthetic parser run finds three correct quantity fields in each header read, while a fixed-position read falls from three of three old-layout rows to zero of three new-layout rows
The denominator is three fixture rows per layout. This is a deterministic schema test, not a benchmark, error prevalence estimate or a measured GitHub service result.

Why a header read still needs validation

Python’s csv documentation describes DictReader, which maps row values to field names. That avoids relying on an unchanged position, but it does not decide which headers your application requires. Our separate missing-quantity fixture is deliberately rejected before aggregation.

import csv
with open(path, newline="") as source:
    reader = csv.DictReader(source)
    required = {"username", "quantity", "unit_type"}
    missing = required - set(reader.fieldnames or [])
    if missing:
        raise ValueError(f"Missing required columns: {sorted(missing)}")
    rows = list(reader)
    quantities = [row["quantity"] for row in rows]

This short teaching extract returns strings and checks only a small required-header set. Production code also needs a deliberate response to duplicate headers, malformed rows, unexpected units and invalid numeric values. Choose those rules for the report you actually consume. A header match alone cannot validate every value underneath it.

Schema comparison shows user_id inserted after username, moving the positional quantity index while preserving its named header
These minimal editorial schemas illustrate field movement. Read named fields, stop on missing required headers and preserve unknown identity values.

Keep unknown identity separate from zero usage

In our unattributed row, username and user_id are blank in the new fixture, but quantity is 2. A blank identity does not erase that recorded quantity. Likewise, it does not prove that all unattributed records belong to one person. Preserve the row and its scope instead of inventing an account key.

When joining an authorized real report to other evidence, document the key and missing-value rule. Do not replace every blank ID with a shared numeric zero and then describe the resulting group as one account. Keep identity handling separate from quantity validation so a repair in one area does not silently change the other.

Confirm the report type and units before adapting the code

GitHub’s billing-report reference lists report-specific fields and distinguishes quantity, unit type and billable amounts. It also scopes the detailed report’s current retrieval route separately from summarized REST usage. Check the exact report and export route you have; this example does not assume every endpoint returns the same schema.

Before replacing an importer, retain a small permitted sample and run both paths side by side. Compare record counts, named values, missingness and unit-specific totals. A file loading successfully is only the first gate. Save the observed discrepancy and your decision so another maintainer can reproduce why the importer changed.

Download and reproduce the fixture reads

For related reasoning, see our Copilot payer-policy model and coverage-denominator guide. Counts, attribution and money need their own definitions before they can support a conclusion.

Method and limitations

Research and local execution: 27 November 2026. Python 3.9.6 read the retained synthetic CSV files with csv.reader and csv.DictReader. Assertions checked all six expected quantity values and the missing-header condition. No private export, API call or account billing data was used. The files are a reproducible schema lesson; they do not certify a production importer.

Suggested citation: Learn Coding USA, “GitHub Usage Report CSV: Fix Imports Before the User ID Column”, 27 November 2026. Retain the synthetic-schema and field-correctness qualifications with the results.

Tech Consulting Tailored to Your Coding Journey

Get expert guidance in coding with a personalized consultation. Receive unique, actionable insights delivered in 1-3 business days.

Get Started