Repository navigation
Description
Problem
config/constants.py and config/defaults.py declare 166 names (113 constants, 53 defaults) that only one of the remaining packages uses. Counted at 38517a8 (the release/v0.2.25 tip) by AST, with the method described in #1016: from-imports and attribute reads count, and re-exports do not. The counts are approximate (an independent count differs by up to about ten per item, mostly in how function-local imports and names that only build another config/ name are attributed); the baseline is the exact list.
- By package:
telemetry/38,ui/34,models/21,core/15,output/14 andoutput/formatters/5,cache/7,http/6,docs/5,exceptions/5 (not error codes),server/5 andserver/routes/2,watchers/5 andci/4. 42 modules read them. The largest readers aremodels/k8s.py(21),ui/projections.py(17),telemetry/semconv.py(13),telemetry/tracer.py(12),telemetry/propagation.py(12) andui/widgets.py(10). - 18 are read by two or more modules of one package. For example,
CONST_SOURCE_ROOT_DIR,CONST_TESTS_ROOT_DIRandCONST_TEST_FILE_PREFIX(constants.py:1672-1674) are read bycore/coverage_index.pyandcore/test_selection.py. - Eight test files import them from
config/:test_github_projects.py,test_http.py,test_http_broker.py,test_http_connection_pool.py,test_server_stream.py,test_telemetry_semconv.py,test_trace_propagation.pyandtest_ui_reactive.py.
The placement rule (#1016) puts each of these names next to the code that reads it. That item's baseline lists them under the fourteen packages named above, and its invariant fails once a listed name is moved and its entry is left behind, so this PR deletes those blocks.
Acceptance criteria
- Each name listed under the fourteen packages named above in
tests/fixtures/config_placement_baseline.json(not theCONST_ERROR_CODE_*key, which is refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006's) is declared in the one module that reads it, or in its package'sconstants.pywhen two or more modules of the package read it. Its name, value and comment are unchanged, and it is annotatedFinal.config/constants.pyandconfig/defaults.pyno longer declare it, and its block is gone from the baseline. - Every importer imports the name from its new module, including the test files named above. Nothing in
config/re-exports it. - A name that only code deleted by an earlier item read is deleted, not moved.
- The two invariant tests from docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 pass.
- Apart from the
Finalannotation added where a name lacked it, the PR only moves code:git diff --color-moved=zebrashows every other declaration line as moved. The diff touches onlyconfig/constants.py,config/defaults.py, the baseline, those packages and the tests that import the moved names. -
uv run devops cipasses.
Key questions
- Does a name go into the module that reads it, or into the package's
constants.py? (proposed) Into the module, when one module reads it. Into the package'sconstants.pywhen two or more do, as the rule says. That applies to 18 names here, for exampleCONST_SOURCE_ROOT_DIRandCONST_TEST_FILE_PREFIX. - When does it land? (proposed) After refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006 when it is scheduled first, since it reshapes
exceptions/. TheCONST_ERROR_CODE_*names are refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006's, not this item's. refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000 keeps theDEFAULT_*values behindSettingsfields indefaults.py, and none of them is in this set. - Can the move add an import cycle? (proposed) No. A moved table imports nothing new, and a package's
constants.pyimports nothing from its package.test_no_circular_imports_in_decoupled_subsystems(tests/test_architectural_invariants.py:308) is the check.
Depends on: #1016, #776.
Order: after #1006 when both are scheduled. Otherwise no constraint; it shares no module with the other move items.
Related: #1006, #1000, #974, #776.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsReady
Activity
dan-petty commentedon Oct 3, 2026
Lines cited at dcafadf.
At 132ecc5,
config/constants.py:2295is:2296and:2296-2299is:2297-2300; the other cited lines are unchanged.Three other items delete some of this item's
coreandcachenames. Leave these inconfig/, with their baseline entries:CONST_CLOUD_METADATA_HOSTSandCONST_CLOUD_METADATA_IPS(config/constants.py:2296-2299, read only bycore/validation.py). fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897 deletes them. Metadata and loopback questions are then answered withipaddressobjects and one maintained cloud-metadata classifier, instead of string sets compared after hand canonicalisation.CONST_LOOPBACK_HOSTNAME(:2295). Its only reader is_is_loopback_host(core/validation.py:328-336), at:331, right after the hand canonicalisation at:330. fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897 rebuilds that function and compareslocalhostwithdns.nameequality, so fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897 decides what becomes of this scalar.DEFAULT_DNS_TIMEOUT_SECONDS(config/defaults.py:306). Its only reader is_resolve_host_ips(core/validation.py:120-149, at:123), which fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's second PR deletes.cachenames:CONST_CACHE_KEY_SEPARATOR,CONST_CACHE_TIER_L1,CONST_CACHE_TIER_L2,CONST_CACHE_TIER_L1_L2andCONST_CACHE_TIERS(config/constants.py:1887-1895), andDEFAULT_CACHE_L1_MAX_ENTRIESandDEFAULT_CACHE_TTL_SECONDS(config/defaults.py:641,:643). Their only reader iscache/tiered.py. fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113's first PR deletes thedevops_cli.cachepackage with these names, because its last user,ValkeyCacheProvider, is built only by tests.CONST_CACHE_NAMESPACE_ROOT(:1886) is not in this set:ai/run_store.pyreads it too.If #897 or #1113's first PR has landed, its names are already gone. For any other name, this item's own criterion applies: if an earlier item deleted its only reader, delete the name instead of moving it.
docs(contributing): a matching table lives beside its one owner (#2492)
dan-petty commentedon Oct 28, 2026
Closed as not planned. The item conflicts with a more recent project direction. No code was written.
This item is a bulk move of single-owner tables out of
config/. Its acceptance criteria use the placement baseline and the invariant tests that #1016 planned.The owner decision of 2026-10-22 on #1016 replaced that plan:
core/config_placement.py, the baseline filetests/fixtures/config_placement_baseline.jsonand the two invariants are not built.#2492 (merged 2026-10-28) put the rule in
CONTRIBUTING.md: "When you change the owner of a table inconfig/that only one package reads, move the table to its owner in the same pull request."On origin/main (2026-10-28) the baseline file,
core/config_placement.pyand the placement tests do not exist, so the criteria of this item that use them cannot be met. A bulk move also conflicts with each open pull request that changesconfig/constants.pyorconfig/defaults.py. #1026, the sibling item, is closed with the same evidence.A table in
config/that only one package reads now moves to its owner in the pull request that next changes that owner.