Skip to content

20260811 - Green the dead-code gate after the spec revision - #10

Merged
Purple10101 merged 1 commit into
mainfrom
20260811-dead-code-gate
Aug 11, 2026
Merged

Purple10101 merged 1 commit into
mainfrom
20260811-dead-code-gate

Conversation

@Purple10101

Copy link
Copy Markdown
Collaborator

main is red. Neither branch was wrong: #9 added the gate against models
generated from the pre-revision spec, #7 adopted the 2026-08-10 revision and
regenerated them. Two green branches, one red merge.

The findings

Seventeen, all in the generated retina_telemetry/wire/models.py, and only six
distinct names. None is dead code:

Name Why it survives
model_config, root pydantic reads both itself — root is RootModel's field
stopping, unknown spec vocabulary we deliberately never send (Q17, and "have not looked" ≠ "looked and could not tell")
public, private carried as strings, so the enum members are never named

Why the section is rewritten rather than extended

The old entries had rotted, and how they rotted is the argument for the new
shape. Their line numbers now point at unrelated code, and the Error entry no
longer means what it did — datamodel-codegen collided on the name, so Error
is now the item type of HeartbeatRequest.errors while the real error response
schema regenerated as Error1.

Line numbers are gone from this section for that reason: they churn on every
regeneration, and going stale silently is worse than not having them.

Not excluding the generated file wholesale, though it was tempting. A new
name appearing in the wire contract is worth a glance, and a failing gate is how
that glance gets scheduled. The cost is one whitelist edit per spec revision.

Verified

Against a clean git archive of tracked files only, since my working tree has
gitignored scratch files CI never sees:

  • tools/check-dead-code.shno dead code found
  • 412 tests, ruff clean, generate-models.sh --check clean

One thing for upstream

tools/check-dead-code.sh prints "no dead code found" when vulture is not
installed
— the missing-module error goes to /dev/null and the empty result
reads as success. That is why it passed locally while CI failed. The script is
shared from offworldlabs/ops, so the fix belongs there rather than here.

🤖 Generated with Claude Code

main went red on the merge of #7 without either branch being wrong. The gate
landed in #9 against the models generated from the pre-revision spec; #7 adopted
the 2026-08-10 revision and regenerated them. Two green branches, one red merge.

Seventeen findings, all in retina_telemetry/wire/models.py, and six distinct
names. None is dead code:

  model_config, root   pydantic reads both itself, so nothing we write names
                       them. `root` is RootModel's field.
  stopping, unknown    spec vocabulary we deliberately never send — a final
                       heartbeat during shutdown means a network call on the way
                       out (Q17), and we distinguish "have not looked" from
                       "looked and could not tell" by omitting the field.
  public, private      carried as strings, so the enum members are never named.

The generated-models section is rewritten rather than extended, because the old
one had rotted in a way worth recording. Its entries carried line numbers that
now point at unrelated code, and its `Error` entry no longer means what it did:
datamodel-codegen collided on the name, so `Error` is now the item type of
HeartbeatRequest.errors and the actual error response schema regenerated as
`Error1`. Line numbers are gone from this section for that reason — they churn
on every regeneration and going stale silently is worse than not having them.

Deliberately not excluding the generated file wholesale. A new name appearing in
the wire contract is worth a glance, and a failing gate is how that glance gets
scheduled; the cost is one whitelist edit per spec revision.

Note for whoever hits this next: tools/check-dead-code.sh reports "no dead code
found" when vulture is not installed, because the missing-module error goes to
/dev/null and the empty result reads as success. It passed locally for that
reason while CI failed. The script is shared from offworldlabs/ops so the fix
belongs upstream, not here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Purple10101
Purple10101 force-pushed the 20260811-dead-code-gate branch from fbc5e78 to 4f47209 Compare August 11, 2026 14:51
@Purple10101
Purple10101 merged commit 42baef3 into main Aug 11, 2026
2 checks passed
@Purple10101
Purple10101 deleted the 20260811-dead-code-gate branch September 6, 2026 15:51
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