Repository navigation
Description
Problem
config/constants.py and config/defaults.py declare 98 names (61 constants, 37 defaults) that only one of these 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:
k8s/29,argo/14,valkey/12,docker/11,tf/10,prometheus/9,grafana/8 andcloudflare/5. 25 modules read them. The largest readers areargo/crd.py(12),tf/analysis.py(10),docker/engine.py(9),k8s/rbac.py(7),k8s/informer.py(7),grafana/builders.py(6) andprometheus/promql.py(6). - Three are read by two or more modules of one package:
CONST_GRAFANA_DASHBOARD_GRID_WIDTH(constants.py:1617,grafana/builders.py,linter.pyandschema.py),CONST_GRAFANA_DEFAULT_DATASOURCE_TYPE(:1620) andDEFAULT_VALKEY_TIMEOUT_SECONDS(defaults.py:612,valkey/client.pyandpool.py). - Four test files import them from
config/:test_argo_crd.py,test_docker_engine.py,test_k8s_service.pyandtest_valkey_concurrency.py.
The placement rule (#1016) puts each of these names next to the code that reads it. That item's baseline lists them under k8s, argo, valkey, docker, tf, prometheus, grafana and cloudflare, 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
k8s,argo,valkey,docker,tf,prometheus,grafanaandcloudflareintests/fixtures/config_placement_baseline.jsonis 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 eight 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 three names here, for exampleCONST_GRAFANA_DASHBOARD_GRID_WIDTHandDEFAULT_VALKEY_TIMEOUT_SECONDS. - When does it land? (proposed) After the open items that rewrite these modules' tables, when they are scheduled first. No filed refactor deletes these modules, so this slice can go early.
- 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: no ordering constraint beyond the dependencies. It shares no module with the other move items.
Related: #548, #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/defaults.py:853is:862and:854is:863; the other cited lines are unchanged.Two other items delete some of this item's tables. Leave these in
config/, with their baseline entries:CONST_DOCKER_UNIX_SOCKET_URL,CONST_DOCKER_HOST_ENV_VARandCONST_DOCKER_NETWORK_HOST_SCHEMES(config/constants.py:2012,:2013and:2018, read atdocker/engine.py:231-234). fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108 deletes the block at:2011-2018once the endpoint comes fromdocker.utils.kwargs_from_env(),docker.ContextAPIanddocker.utils.parse_host.valkeydefaults, the ones 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 deletes. 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 replaces the hand-written client with Valkey GLIDE (valkey-glide-sync).valkey/rate_limiter.pyandvalkey/pool.py, which nothing insrcuses in production, with their seven defaults:DEFAULT_VALKEY_RATE_KEY_PREFIX,DEFAULT_VALKEY_RATE_PER_MINUTE,DEFAULT_VALKEY_BURST_CAPACITY,DEFAULT_VALKEY_TOKEN_COSTandDEFAULT_VALKEY_KEY_SUFFIX(config/defaults.py:627-631), andDEFAULT_VALKEY_POOL_MAX_SIZE(:636) andDEFAULT_VALKEY_POOL_IDLE_TIMEOUT_SECONDS(:639). GLIDE multiplexes one connection per client, so no pool setting is left.valkey/client.py's_chunk_commandswith batches cut by command count, and deletesDEFAULT_VALKEY_PIPELINE_CHUNK_BYTES(:854).Move the other four
valkeynames as this item's rule says:DEFAULT_VALKEY_TIMEOUT_SECONDS(:623) goes tovalkey/constants.pywhileclient.pyandpool.pyboth read it, or toclient.pyonce 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 has deletedpool.py.DEFAULT_VALKEY_PATTERN(:626),DEFAULT_VALKEY_SCAN_COUNT(:632) andDEFAULT_VALKEY_PIPELINE_CHUNK_COMMANDS(:853) go toclient.py, their only reader.#1113's second PR replaces
client.pywith one store module and deletes any of these four that the swap leaves unread. 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.Test imports until those items land:
tests/test_docker_engine.pykeeps itsconfig/import ofCONST_DOCKER_UNIX_SOCKET_URL.tests/test_valkey_concurrency.pyimportsDEFAULT_VALKEY_PIPELINE_CHUNK_BYTESfromconfig/andDEFAULT_VALKEY_PIPELINE_CHUNK_COMMANDSfrom its new module. 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 second PR deletes that test file.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.