Skip to content

Audit D: compile_time, coarray, persistent_worker, test_environment, ui_layer policies

Audited 2026-10-21 against the working tree at fd5b5bc8e (+ the two dirty cftc files, which no finding touches). Read-only. Scratch files of this audit (scans, generated lookup, audit JSON) are in the same scratchpad directory, prefix D_. Checks that pass today: scripts/check_test_registry.py . --verbose (37 selectors, 46 programs, 19 registry rows: consistent), scripts/check_descr.py, scripts/check_flex_dag.py.


doc/policies/compile_time_policy.md (lines 206; last commit 2026-10-04; verdict: minor drift; the rules are right, the code does not follow several and nothing checks them)

  • [L][DRIFT] L6: "A clean build compiles about 840 sources." -> now: 907 compile commands with tests (813 .f90, 81 .F90, 13 C/C++), 736 without (build/compile_commands.json, configured today). Fix: "about 900 compiles with the tests, about 740 without".
  • [M][DRIFT] L39-41: umbrellas named are simple_core_module_api, simple_commanders_api. -> also simple_stream_api, simple_pftc_srch_api (32 importers), simple_ori_api (12), simple_ui_modules (32, src/main/ui/simple_ui_modules.f90), simple_gui_metadata_api. Fix: name them all, or define "umbrella" as any module whose body is mostly use lines and list them in one sentence.
  • [M][CONTRADICTS] L94-96: "Existing umbrellas stay as they are (see "What does not work")." -> that table has no umbrella row (dangling reference). The rule is also weaker than .github/skills/simple-main-apis/SKILL.md ("do not widen the existing umbrellas ... (doc/policies/compile_time_policy.md)") and than layering_and_project_ownership_policy.md section 2 ("compile_time_policy.md forbids widening the umbrella"); CLAUDE.md says only "no new umbrella modules or re-exports". Fix: "Do not add names to an existing umbrella and do not import one in new code. A module an umbrella re-exports without only: (simple_defs, simple_type_defs, simple_default_clines, simple_qsys_funs, ...) widens it whenever it gains a public name."
  • [M][STALE] L104-107: "One library target for SIMPLE." -> src/CMakeLists.txt:185-212 builds a second static library ${SIMPLE_COARRAYLIB} from all sources when USE_COARRAYS=ON; production/CMakeLists.txt:49-59 links only simple_private_exec to it. Also three always-run custom targets the library depends on (simple_args, simple_ui_defaults, simple_git, src/CMakeLists.txt:27,58,61) and ExternalProject targets (cmake/Dependencies.cmake:261,323). Fix: state the coarray exception and why (module files of the two modes must not mix, src/CMakeLists.txt:180-182).
  • [M][GAP] "Where the time goes": the commit hash is a parameter of the root module. src/defs/simple_defs.f90:176 includes build/lib/simple/SimpleGitVersion.h; simple_git (src/CMakeLists.txt:61-68) rewrites it on every build after a new commit; the decompressed build/modules/simple_defs.mod contains the current hash (fd5b5bc8). So each commit changes the interface of the module nearly every file imports. Rebuild cascade expected, not measured. Only 6 files use the constant (production/*.f90 x5, src/main/commanders/test/simple_test_state_fixture.f90:111). Proposal: rule "no volatile value (commit hash, date, path) as a parameter of a module others import; keep it in a leaf module imported by the executables"; then measure with profile_build.sh touch/probe.
  • [M][VIOLATED] L55-59 (large types allocatable): plain type(cmdline) components: 8 (src/main/strategies/parallelization/simple_refine3D_strategy.f90:75 dated 2026-10-13, i.e. after the policy, and :99-103; simple_calc_pspec_strategy.f90:36,49); plain type(builder): 2 (simple_make_cavgs_strategy.f90:58,69); builder itself holds plain sp_project and polarft_calc (src/main/simple_builder.f90:23,28); if sp_project and qsys_env count as heavy aggregates: 8 more plain sp_project and 13 plain qsys_env components in strategies/parallelization/*. type(parameters) components: 0 (clean).
  • [L][VIOLATED] L61-63 (no whole-parameters copy): 3 sites, all older than the policy: src/main/cavg_quality/simple_cavg_quality_relations.f90:91, src/main/commanders/single/single_commanders_tseries.f90:273,330 (a fourth, in src/main/pca/simple_diff_map_denoise.f90, went with that file on 2026-11-02).
  • [M][VIOLATED] L77-81 (testers declare large objects class(T), allocatable): 191 plain parameters (27), builder (13), cmdline (151) locals in *tester*.f90, 51 of them with git blame date >= 2026-10-04 (simple_pftc_inplane_tester.f90 14, simple_stream_stage_solve3D_tester.f90 11 (cmdline), simple_stream_chain_tester.f90 5); type(stream_stage_initial_analysis) :: stage plain at simple_stream_stage_initial_analysis_tester.f90:718. Against it: 57+16+18 class(T), allocatable declarations. The rule names "stage, sieve or similar"; cmdline is named a heavy type in L28-34 but not in L77-81. Fix: say "parameters, builder, cmdline and every stage".
  • [M][VIOLATED] L90-93 (use ..., only:): module-level use without only: (intrinsic modules excluded): 768 statements in 481 of 785 source files; in the 592 files changed since 2026-10-01: 546 in 348 files (top: simple_core_module_api 146, simple_test_utils 96, simple_commanders_api 51, simple_defs 38, simple_ui_modules 32, simple_pftc_srch_api 21, json_module 15); in the 172 files ADDED since 2026-10-01: 63 in 59 files (simple_test_utils 42, simple_core_module_api 20, simple_commanders_api 2, simple_pftc_srch_api 1, simple_ran_tabu 1). Examples (new): src/fileio/simple_stack_read_session.f90:11, src/fileio/simple_image_slab.f90:9, src/main/project/simple_eo_partition.f90:7, src/main/pick/simple_segdiam_bin_picker.f90:18, src/main/strategies/search/simple_strategy3D_cont_1jyx_tester.f90:17. Procedure-level bare use: 51 (42 in changed files). Convention that contradicts the rule: every tester starts use simple_test_utils bare.
  • [M][VIOLATED] L94-95 (no umbrellas in new code): files importing simple_core_module_api: 278 at 2026-10-04 -> 291 at HEAD (+13); 58 of the 172 new files import it (40 with only:, which does not remove the build edge); simple_commanders_api 60 -> 60; simple_stream_api 4 -> 2. The umbrellas themselves did not widen except one name: files_identical added to the simple_fileio list of src/main/apis/simple_core_api.f90 (d3480ae79, 2026-10-08); simple_commanders_api, simple_stream_api and simple_pftc_srch_api shrank.
  • [L][VIOLATED] L97-100 (third-party only:): bare use json_module (17 statements, 9 files), json_kinds (8), CPlot2D_wrapper_module (8), e.g. src/main/ui/simple_ui.f90:253,276,301.
  • [M][GAP] Enforcement. No rule of this policy has a check; see the table in "Cross-cutting gaps". Proposal: a report-only scripts/check_compile_rules.py with a committed baseline, run by run_fast_gate.sh next to check_descr.py: (a) plain heavy components, (b) whole-parameters copies, (c) bare module-level use in files changed vs. baseline, (d) umbrella imports in files absent from the baseline, (e) plain heavy locals in testers. Counts may fall, not rise.
  • [L][GAP] Build configuration L112-115: ${ARCH_FLAG} is -march=native (Linux) or -mtune=... (macOS) when USE_ARCHOPT=ON; Debug flags differ by platform (cmake/CompilerConfig.cmake Debug block: macOS -fcheck=bounds,do,mem, Linux -fcheck=all; reason documented only in the CMake comment); --traps / SIMPLE_DEBUG_TRAPS (compile_debug.sh) are in no policy although the fast gate is a Debug gate.
  • [L][GAP] scripts/default_audit.py:828-829 writes simple_ui_default_values.f90 unconditionally (path.write_text), unlike scripts/simple_args_generator.pl (compare, keep). Any touch of a scanned source (src/CMakeLists.txt:35-42 globs commanders, exec, stream, params, defs) regenerates and recompiles that 3000-line file. Same-content output would avoid it.
  • [L][STRUCTURE] L191-206 "Evidence": a dated measurement log (6 rows, 1 dated sentence) in a policy. Rules are justified by it, but it belongs in doc/refactoring_notes/completed/stream_owned_state_compile_time_report.md (already linked) and the "What does not work" table is the part worth keeping.
  • [L][DRIFT] scripts/profile_build.sh header cites doc/refactoring_notes/planned/contract_submodule_architecture.md, now under rejected/; the policy lists 4 of the script's 6 commands (probe, report missing).
  • CLAUDE.md compile bullets: all five match the policy; no contradiction. Rules in the policy but not in CLAUDE.md: remove never-read state; keep widely declared types small; put state where used (companion module); split leaf test commanders into submodules; name third-party entities; release flags and -Wno-maybe-uninitialized; bounded -j; the profiling procedure and 5 s keep rule. Also missing from both: umbrellas other than the two named, the coarray library, the commit-hash mechanism.

doc/policies/coarray_execution_policy.md (lines 292; last commit 2026-10-03; verdict: minor drift)

All protocol claims (staging keys, command line, image mapping, nimages formula, log names, sync all, qsys_declare_part_finished early return, no this_image() outside the driver) match simple_qsys_ctrl.f90:349-372,707-741, production/simple_private_exec_driver.f90:68-163, simple_qsys_funs.f90:58-66.

  • [M][VIOLATED] L67-70 and L222-224: "must not leak into strategy, commander, or domain-level branching". -> src/main/strategies/search/simple_matcher_ptcl_io.f90:343 (ptcl_buffer_budget, added 2026-10-14 in 77a8df9a8) branches on qsys .eq. 'coarray' (coarray like local: node memory, not job_memory_per_task). Fix: either allow it ("the qsys name may be read to size memory") or move the decision behind qsys_env.
  • [M][GAP] Section 3: which executables are coarray-enabled. simple_private_exec alone links ${SIMPLE_COARRAYLIB} and a separate module directory modules_coarray (production/CMakeLists.txt:49-59, src/CMakeLists.txt:176-212); simple_exec, simple_stream, single_exec stay on the normal library. Consequence a developer needs: coarray constructs live only in code compiled into both libraries under #ifdef USE_COARRAYS (simple_private_exec_driver.f90:71,129), and a source must compile in both modes. Proposal: add to section 3.
  • [M][GAP] Re-entrancy. One image runs its partitions one after the other in one process (simple_private_exec_driver.f90:102-107 calls run_private_exec_line per partition). Module state, the thread count, the random state (params%new reseeds) and memoised tables therefore carry from one partition to the next, unlike a script backend (new process per part). Since the 2026-10-20 rule, moved master steps neither call params%new nor restore threads. No sentence states the obligation. Proposal in section 7: "a private commander is re-entrant: it releases its module state in kill, and the driver restores threads".
  • [M][DRIFT] L51-53: simple_private_exec.f90 "detect --coarray, delegate to run_coarray_direct, and otherwise ..." -> it also dispatches --coarray-smoke to run_coarray_smoke (production/simple_private_exec.f90:14-17), the entry the coarrays CTest platform test and compile_coarrays.sh run (production/CMakeLists.txt coarrays). Fix: add the second flag and say it exercises launch plus sync all only.
  • [L][STRUCTURE] L271-292 "Current Limits And Follow-Up" mixes limits (true) with a design wish (L284-292: "Future cleanup should decide ...", "intended foundation for future coarray reductions"). Keep the limits, drop the wishes (a planned note).
  • [L][GAP] Batch failure semantics differ from script backends: qsys_ctrl%update_queue returns at once for qsys_coarray (simple_qsys_ctrl.f90:889-892), so the exit-code/liveness path of the other backends does not apply; failure is the aggregate THROW_HARD of submit_coarray_jobs. One sentence in section 8.

doc/policies/persistent_worker_policy.md (lines 327; last commit 2026-10-01; verdict: minor drift; two false statements, four missing contracts)

Wire protocol, message values, TCP_BUFSZ, worker arguments, UID, thread-slot rules, shutdown owners match simple_persistent_worker_message_types.f90, simple_persistent_worker_server.f90, production/simple_persistent_worker.f90.

  • [H][STALE] L188-191: "batch scheduling watches JOB_FINISHED*; streaming scheduling watches EXIT_CODE_JOB_*" -> qsys_ctrl%update_queue (simple_qsys_ctrl.f90:918-936, since 2307ea96f, 2026-10-13) also reads EXIT_CODE_JOB_* in batch mode: a non-zero status marks the part failed (stop_on_failed_parts), and a part without a status is checked for liveness every JOB_LIVENESS_S=300 s and given JOB_LOST_EXIT_CODE=254 after two misses (simple_qsys_job_record.f90:20-22,53-54). Fix: rewrite the bullet list: sentinel = success, exit-code file = failure, liveness = loss; the worker server is still not a completion authority.
  • [M][STALE] L108-114: reuse "only when ... existing worker count is at least the requested value" -> the check is commented out (simple_qsys_env.f90:279). The enforced checks: server running, same launch backend, and check_worker_claim (the requested per-task threads must not exceed the server's threads per worker, :321-324). Fix: delete the worker-count bullet or restore the check; add the claim check.
  • [M][GAP] Client-only role. L120 mentions client_only in passing. Not stated: parameters worker_server (host:port) and worker_server_nthr (simple_parameters.f90:262,490; in UI_ENVIRONMENT_KEYS), that a process given worker_server starts no workers and no listener (simple_qsys_env.f90:260-299), that its warm-up callback is not registered, and that the stream master hands both to every stage (simple_commanders_stream_p00_master.f90:451,576-579). Today only doc/policies/stream/README.md:66-75 says it. Proposal: new section "5a Server roles: owner and client" here; stream README then links.
  • [M][GAP] Warm-up / cooldown autoscaling (enable_warmup_cooldown, SCALE_UP_COOLDOWN_S=15, SCALE_DOWN_COOLDOWN_S=300, claim_warmup_worker_ids, qsys_env%service_persistent_worker_warmup, warmup_callback, register_warmup_env). L129 names the state, nothing states the contract: only a streaming queue turns it on, reuse never turns it off (simple_qsys_env.f90:281-282; stated only in sieving_and_rejection/ptcl_sieve_policy.md:246-249), scale-down sends TERMINATE to an idle worker, the owner process relaunches slots. Proposal: new section in this policy, move the sieve sentence here.
  • [M][DRIFT] L143-144: "Task selection order is high, normal, low." -> strictly: the normal queue is considered only when the high queue is empty, the low queue only when both are empty (simple_persistent_worker_server.f90:1015-1022,1031); an undispatchable high task blocks every normal one. stream/README.md:73 relies on this. Fix: say so.
  • [M][GAP] Loss and cancellation limits (section 10 should list them). A persistent-worker task is recorded as "none 0" (write_job_record); the liveness check cannot see a task on another host than the master (JOB_UNKNOWN, simple_qsys_job_record.f90:7-21,50), so a worker lost on a remote node is waited for; cancel signals the script and children on the master's host only. The fork contract is also unwritten: a forked stage must call forget_inherited_persistent_worker (simple_stream_master_stage.f90:87-92; simple_qsys_env.f90:789-794). Both are in stream/restart_policy.md:116-133 only.
  • [L][DRIFT] L63-65: "A qsys name containing _worker activates the overlay." -> not with script=yes (simple_qsys_env.f90:242-244). The qsys_name UI choices list no *_worker name (simple_ui_params_common.f90:688-689); the accepted names are documented nowhere.
  • [L][STRUCTURE] Contracts of this backend live in three other policies (stream/README.md:66-75, stream/restart_policy.md:116-133, ptcl_sieve_policy.md:246-249); this document says it is "the single policy authority". No history or status text found; the structure is good.

doc/policies/test_environment_policy.md (lines 1328; last commit 2026-10-21; verdict: minor drift on facts, rewrite by splitting)

Verified correct: tier table and counts (15 fast, 7 library, 19 highlevel, 1 platform = SIMPLE_CTEST_BUDGET 42; provisional-free labels), run_fast_gate.sh order and ctest_budget.py 60 s, fast env (OMP_THREAD_LIMIT=4, OPENBLAS_NUM_THREADS=1, 600 s), sub-suite tables of 13 of 14 areas, suite_id rule, 32-character names, registry rows and check_test_registry.py coverage, seeds (20260923, stride 2654435761), GRACE_S=60, 90 % memory, identity exclusions (word 14, bytes 121-128), CI workflows ci_build.yml/ci_test.yml steps, test_gate/simple_test_truth_metrics routine names, fixture cache key, numeric constants of 8 cards spot-checked.

  • [M][STALE] L702: get_test_seed_offset() -> does not exist; simple_test_utils exports set_test_seed_offset, offset_seed, fix_test_seed, set_fixed_seed, enter_fixture, leave_fixture (src/utils/simple_test_utils.f90:16-17). Fix: replace with offset_seed(base) and add the two fixture helpers to the table.
  • [M][CONTRADICTS] L596-598: scratch files "named tmp_<tester>_* and deleted at the end of the test, also when a check failed" -> the shared helper enter_fixture/leave_fixture (simple_test_utils.f90:330-350, 21 testers) makes <tag>_<pid> and KEEPS it when a check failed; 26 testers still use tmp_. Fix: document the helper as the default and the keep-on-failure rule.
  • [M][DRIFT] L318-320 (keep_outputs=no): "deletes the subdirectories of each execution's run directory ... as soon as it ends" -> only a passed execution (simple_test_dispatch.f90:81,96-97,325 EXEC_PASSED); failed ones keep their outputs. Also L277-280 (known limits) assumes the other reading.
  • [L][DRIFT] L100-116: unit_project row lists 19 sub-suites, the table has 21 (micrograph subset, particle subset missing; suites_project). The whole 1.1 table duplicates what simple_test_exec test=<area> suite=list and the generated test_inventory.md print: a drift magnet. Fix: replace the table by area, scope and one example sub-suite.
  • [L][DRIFT] L190: rnd_seed_parameter.md -> doc/refactoring_notes/planned/rnd_seed_parameter.md.
  • [L][DRIFT] L622-626 (..._<area>.f90): the pipeline-test file families are class, highlevel, single, stream for commanders and routers, but the test UI has only simple_test_ui_class.f90 and simple_test_ui_highlevel.f90; the 11 simple_commanders_test_highlevel_*.f90 are submodules of simple_commanders_test_highlevel. Fix: name the real files.
  • [L][DRIFT] L50-52: "the gate takes about 5 s on the reference Mac in Debug" vs production/CMakeLists.txt comment "fifteen together 11.6 s ... 24-core test machine, 2026-10-19". Two timings, no definition; a log in a policy. Fix: delete; the budget is 60 s.
  • [L][VIOLATED] L573-575 (no process control in a tester): stop "unexpected type" at src/utils/structs/simple_linked_list_tester.f90:247,265,273; error stop at src/main/volume/simple_pcg_sparse_tester.f90:140.
  • [L][DRIFT] L679-684: get_rmat_ptr_padded "is for the one caller" -> callers: simple_image_slab.f90:121, simple_stack_read_session.f90:557, and the tester simple_stack_io_tester.f90:783-784 (which the same paragraph forbids).
  • [M][GAP] Day-to-day commands. Not mentioned anywhere in the policy: ./run_tests.sh [fast|library|highlevel|platform|all|list|TEST] (rerun from an existing build, repo root), make check (CMakeLists.txt:124), and the incremental loop make -C build -j<n> + scripts/run_fast_gate.sh build + make -C build -j<n> install that CLAUDE.md prescribes. Only the full-rebuild compile_*.sh are documented. The three scripts disagree on the budget: run_tests.sh:18 "30-second fast gate", run_fast_gate.sh header "30 s wall-time budget", ctest_budget.py usage text --budget 30, while all pass 60.
  • [M][GAP] Front-door keys. seed_offset, target, nseeds, dir1, dir2, keep_outputs are accepted by simple_test_exec only because scripts/simple_args_generator.pl (scripts/simple_args_generator.pl:141) lists them by hand; a new front-door key not added there is rejected by the parser. Policy sections 1.4/4.1 do not say. Same trap for UI inputs, see ui_layer U4.
  • [M][GAP] CLAUDE.md asks to "run the high-level entries a change affects"; no document maps a code area to the entries (and check_test_registry.py holds no such column). Proposal: a one-line covers: field per registry row, printed by test=list, and one sentence in section 3.
  • [L][GAP] compile_debug.sh --traps/SIMPLE_DEBUG_TRAPS, the macOS/Linux difference of Debug checks (cmake/CompilerConfig.cmake), and scripts/run_fast_gate.sh still selecting fast|provisional (no provisional entry exists) are not mentioned.
  • [M][STRUCTURE] Size and content: 1328 lines. Proposed split (line counts of the current sections):
  • Keep test_environment_policy.md (about 600): purpose, tiers and gate (sections 1 intro, 1.3, 1.4), 2, 3.1-3.3, 4, 5. Replace 1.1/1.2 tables by pointers to suite=list/registry.
  • New test_suite_runner_and_gates_policy.md (about 330): 1.5 dispatcher, registry, nightly/profile/identity (L210-345), 6.1-6.3, and the floor rule 6.2 (L754-822).
  • Move out of policy: 6.5 test cards (L931-1126, 196 lines: profiles, dated medians, wall times, 33 dates and 10 "ruling" mentions in the file; floors are also written next to the checks, so each number lives twice) to doc/code_overview/ or the test sources; 1.2 (L121-145, 25 very long rows duplicating 6.5); 6.6 "Real data (planned)" (L1128-1169) to doc/implementation_notes/planned/testing_and_benchmarking_plan.md (it already cites that plan); 6.4 (L881-929, 49 lines specifying an external repository's workflow) to that repository or to the plan; 7-9 (L1171-1328, 158 lines of history; the 106-line mapping table duplicates doc/refactoring_notes/completed/test_review_record.md) to that record, leaving one rule paragraph ("no standalone test programs") in section 3.
  • 3.4 (L493-554: master-based working, worktrees, push rules, CI badges) is a development-workflow policy, not a test rule (see cross-cutting).
  • [L][STRUCTURE] L1-8: dated status line ("records the state after the test-environment refactoring of September 2026"). Delete.
  • [L][CONTRADICTS] production/CMakeLists.txt comment for lib_cart_align3D says "5 000 simulated 1JYX particles"; code and policy say 1 000 (simple_strategy3D_cont_1jyx_tester.f90:43). Policy is right; fix the comment.

doc/policies/ui_layer_policy.md (lines 552; last commit 2026-10-03; verdict: minor drift; the model is current, the status section is false)

Verified: field lists of ui_program, ui_program_input, ui_requirement_group, ui_activation; UI_VIS_*; 30-100/40/100 character limits; seven section lists; UI_ENVIRONMENT_KEYS; has_input/accepts; ui_choices validity rules; UI_ALT gone; module-local UI_CATEGORY (incl. the new simple_ui_refine2D.f90: id refine2d, "Refine 2D Workflows", order 30); validate_complete_ui_json (ALL) and validate_/update_stream_ui_contract; NICE migration 0006_rename_programs.py; link to 3D/solve3D_addon_policy.md; default_audit.py generates the lookup from CMake, and its output equals build/lib/simple/simple_ui_default_values.f90.

  • [M][STALE] L530-532: "The optional audit_ui_defaults report currently contains no errors or warnings" -> run today (scripts/default_audit.py --ui-executable build/bin/simple_private_exec): 344 diagnostics, 8 errors, 20 warnings. Errors: simple_stream programs assign_optics, gen_pickrefs, master, pick_extract, pool2D, preproc, sieve_cavgs, solve3D_stream "could not locate execute method for router case" (the audit's extract_stream_routes does not follow the p00-p07 restructuring). Warnings include the new public program: refine2D cenlp, lpstart, lpstop "unresolved command-line assignment" and center_type, extr_lim, oritype "default rule is not exposed by this UI program" (src/defs/simple_default_clines.f90:30-39), plus classify3D_refs x5, refine3D oritype, solve2D center_type. Fix: delete the sentence (status) and repair extract_stream_routes; decide whether refine2D exposes center_type/extr_lim/oritype.
  • [H][GAP] Private programs. simple_private_prgs.f90 holds the required keys of programs that exist only on simple_private_exec; a private program that has a public program's name (refine2D, refine3D, ...) is checked against the PUBLIC descriptor by cmdline%parse_private (simple_cmdline.f90:225,266; no refine2D/refine3D row in simple_private_prgs.f90). Adding a required input or a requirement group to a public program therefore also constrains every worker command line. The new refine2D comment says it (simple_ui_refine2D.f90, new_refine2D), the skill simple-main-ui says it, the policy does not mention simple_private_prgs at all. Proposal: new section "Private programs" with this rule and "the memory estimator keys on the program name" (structure2D report, item 2).
  • [M][GAP] Scope of the default generator (L56-62 and "Default ownership"). scripts/default_audit.py:842-848 reads src/main/commanders, exec, stream, defs, params only. src/main/strategies (108 if (.not. cline%defined(k)) call cline%set(k, v) sites, e.g. set_preprocess_defaults at simple_preprocess_strategy.f90:122, simple_motion_correct_strategy.f90:130) and src/main/solve (4) are invisible, and a helper called from a commander is traced only if named in TRACED_DEFAULT_HELPERS/DELEGATED_WORKFLOWS (default_audit.py:57,61). The generated lookup has no override set for preprocess, motion_correct, ctf_estimate, pick, make_cavgs, reextract. Since the 2026-10-20 rule moves bodies out of commanders, defaults moved with them silently fall back to the baseline. Proposal: state the scan scope in "Default ownership" and the rule "a default the UI must show is set in the commander or in a helper listed in TRACED_DEFAULT_HELPERS" (the skill has the second half).
  • [M][GAP] Accepted keys (L249-250, L493-494). Where the "generated argument vocabulary" comes from is not stated: scripts/simple_args_generator.pl reads the type(parameters) declarations of simple_parameters.f90 (lines before contains), adds vol1..vol20 and a hand-written list (job_memory_per_task, projname, simple_path, time_per_image, user_*, qsys_partition, qsys_qos, qsys_reservation, job_name, the six test front-door keys) and writes simple_args.f90/simple_varlist.txt. A UI input whose key is in neither place is rejected by the parser. The rule "registered inputs = accepted keys" has no check (verified today: 27 UI-registered keys are absent from simple_varlist.txt and rely on the hand list; nothing asserts inputs are a subset of the vocabulary). Proposal: add the three-line recipe "new key: parameters field, simple_parameters_parse.f90 registration, UI input" and a unit_ui check.
  • [L][DRIFT] L135-136: "ui_hash ... supplies typed access to ui_program and ui_param" -> only ui_program (simple_ui_hash.f90:1-3).
  • [L][DRIFT] L141-152: the ui_param field table omits required and example_value (simple_ui_param.f90:22,25); example_value carries the numeric example of the placeholder.
  • [L][DRIFT] L347-349: the 100-character ceiling "is enforced by ui_program%new" -> new enforces 100; both bounds (30 and 100) are enforced for every registered program in validate_ui_presentation (simple_ui.f90:89-92).
  • [L][DRIFT] L254-257: "solve3D_addon is the first such program" -> solve3D_chunks uses accepts too (simple_commanders_solve3D_chunks.f90:61,286).
  • [L][GAP] Group labels: L176-178 says group creates a group with "a plain-English label"; the label comes from a hard-coded table in ui_program (simple_ui_program.f90:402-420, unknown ids label themselves). The stream UI keeps the old-name id "cluster 2D" (simple_ui_stream.f90:53-92, simple_ui_program.f90:418) because production/stream_ui_contract.json fixes it.
  • [L][GAP] How to get the JSON: simple_exec prg=print_ui_json, simple_private_exec prg=write_ui_json/print_stream_ui_json, the validate_ui_json sub-suite of unit_ui, and the three hand-written writers that "are duplicated today" (L512-513: write2json/create_json_entry in simple_ui_program.f90, print_stream_ui_json in simple_ui.f90:299-508) are not named. Name them so "update all JSON paths" is actionable.
  • [M][STRUCTURE] L517-553 "Refactor status / Current phase: complete / Deferred review": status narrative inside a policy (eight completed bullets, one false, see first finding); L123 ("UI_ALT and alt_ios have been removed") and L296-302 ("Renamed programs") are history mixed with rules. Move the status and removals to doc/refactoring_notes/completed/, keep one rule: "programs are renamed without aliases".
  • [L][CONTRADICTS] L481-483 "Commit the descriptor changes and production/stream_ui_contract.json in the same commit" vs CLAUDE.md "Never commit or push" (agent rule, not scoped there). Say "the maintainer commits ...".

Counts

doc H M L total
compile_time_policy 0 9 7 16
coarray_execution_policy 0 4 2 6
persistent_worker_policy 1 5 2 8
test_environment_policy 0 7 9 16
ui_layer_policy 1 4 7 12
total 2 29 27 58

By category (a finding with two tags is counted once, under its first): STALE 5, DRIFT 16, OLDNAME 0, CONTRADICTS 4, VIOLATED 8, GAP 19, STRUCTURE 6.


Compile-time rules: what checks them

Source: the "Rules for day-to-day development", "Measuring" and "Reducing" sections. "Gate" = run_fast_gate.sh; "CI" = .github/workflows (builds with warnings on, no -Werror, no warning count).

# rule check
1 heavy types (parameters, cmdline, stage, sieve, aggregate) are allocatable components, allocated before the constructor, freed in kill on both paths; new/kill symmetric and idempotent none (review). Greppable.
2 no snapshot of parameters none (review). Greppable (4 sites).
3 remove never-read state partial: -Wall -Wunused finds unused locals and private module variables; scripts/fix_warnings.py (manual) fixes them; write-only components undetected
4 keep widely declared types small none (review); profile_build.sh shows the cost afterwards
5 state used by one submodule is declared there; shared state in a companion module partial: gfortran "unused private module variable"
6 testers: class(T), allocatable none (review). Greppable.
7 split leaf test commanders into parent + submodules none; profile_build.sh tail
8 use ..., only: and only what the module needs; procedure-level imports local none for bare use; stale only: names caught by -Wunused (+ fix_warnings.py)
9 no new umbrella modules or re-exports; do not widen existing none
10 third-party modules imported with only: none
11 one library target none (review of CMake)
12 no per-file compile options, fix warnings in code convention only; the only set_source_files_properties is the vendor -w (src/CMakeLists.txt:125); no -Werror, no CI warning check
13 Release flags -O3 ${ARCH_FLAG} -fPIC, -Wno-maybe-uninitialized; new global flag needs a benchmark encoded in cmake/CompilerConfig.cmake; change is review
14 bounded job count enforced by the compile_*.sh scripts via scripts/simple_build_jobs.sh; a hand-run make -j is not
15 pre-commit builds include tests and gate enforced by default in the compile_*.sh (gate between make and install); CI runs them nightly
16 like-for-like profile comparison, 5 s keep rule, single samples procedure; profile_build.sh compare prints deltas, nothing refuses a bad comparison

Current violations of the three easiest-to-grep rules (scripts: D_use_scan.py, D_comp_scan.py, D_pcopy.py): see the findings above. Summary: plain heavy components cmdline 8, builder 2, parameters 0; whole-parameters copies 4 (none new); tester plain heavy locals 191 (51 new); bare module-level use 768 in 481/785 files (changed since 2026-10-01: 546 in 348/592; added: 63 in 59/172); umbrella importers simple_core_module_api 291 (+13 since 2026-10-04), new files 58/172.

The 'apis' umbrella modules

  • Is there a policy statement that new code must not widen them? Partly. compile_time_policy.md L94-96 says "Do not add new umbrella modules or re-exports ... Existing umbrellas stay as they are (see 'What does not work')", with a dangling cross-reference; it names two umbrellas. The explicit "do not widen simple_core_module_api, simple_commanders_api, simple_stream_api" is only in the skill simple-main-apis (and its description). CLAUDE.md: "no new umbrella modules or re-exports". layering_and_project_ownership_policy.md (untracked draft) section 2 says the compile policy "forbids widening the umbrella", which the compile policy does not literally say.
  • What does the code do? The umbrellas are stable: since 2026-10-04 one name was added (files_identical to simple_core_api.f90, d3480ae79); simple_commanders_api, simple_stream_api, simple_pftc_srch_api lost imports (nice/guistats retirement, solve2D_chunks move, sigma2_binfile). Importers keep growing: core API 278 -> 291 files (58 of 172 new files), commanders API constant at 60, simple_stream_api 4 -> 2. Widening can also happen without editing the file: simple_core_module_api and simple_commanders_api re-export simple_defs, simple_type_defs, simple_defs_conv, simple_defs_fname, simple_defs_stream, simple_default_clines, simple_qsys_funs with no only:, so every public name added there widens them (and the git hash is one such name).

Cross-cutting gaps in this cluster

  1. Queue-system contract has no home. Completion by sentinel/exit code/liveness (JOB_FINISHED_*, EXIT_CODE_JOB_*, JOB_LOST_EXIT_CODE), stop_on_failed_parts, cancellation, qsys_declare_part_finished, numlen, the job record, update_queue per backend are described by no queue policy; the coarray and persistent-worker policies each assume "the existing scheduler" and the stream policies hold fragments (stream/restart_policy.md:110-133). No skill covers src/utils/qsys either. Proposal: queue_system_policy.md (common contract) with the two backend policies as deltas.
  2. Development-workflow rules have no policy: "never commit or push" and "preserve dirty worktree" (CLAUDE.md, for agents), "everyone works on master, push after a green ./compile_debug.sh" (test policy 3.4, for maintainers), the incremental build loop and parallel install (CLAUDE.md/memory), and "which tests to run for which change". These conflict in tone unless scoped to actor. Proposal: development_workflow_policy.md taking test policy 3.4.
  3. General Fortran source conventions are in the skill simple-modern-fortran and in the test policy only by accident: !@descr: header and one module per file (enforced by check_descr.py in the gate, documented in test policy 4.1/4.5), new/kill symmetry, THROW macro traps, comments. A contributor reading policies only never meets them. Proposal: a short fortran_conventions_policy.md or a section of the compile policy for the enforced ones.
  4. Generated sources and the accepted-key vocabulary: simple_args.f90, simple_varlist.txt, simple_ui_default_values.f90, SimpleGitVersion.h, doc/code_overview/{code_base_map,test_inventory}.md (written into doc/ by every build) are described only in skills and CMake comments. Where a new key must be declared (parameters field + parse registration + generator hand list + UI) is in no policy (ui U4, test T11). Proposal: one section "Generated sources" in ui_layer_policy.md.
  5. Enforcement is by review everywhere in the compile policy and the coarray/persistent-worker policies; the fast gate has three static checks (registry, headers, FLEX DAG) and the layering draft proposes a fourth. The compile rules need the same treatment (check_compile_rules.py, report-only, baseline).
  6. The brief's items about the new layering_and_project_ownership_policy.md (untracked) and doc/policies/README.md (untracked): the README links doc/refactoring_notes/planned/policy_set_audit_2026-10-21.md, which does not exist yet; README rows for my five policies are correct. CLAUDE.md "Structure" lists five production executables; production/CMakeLists.txt:11,24 builds a sixth, simple_persistent_worker.
  7. Rules only in policies, not in CLAUDE.md or any skill: how to write a test (independent expected values, named tolerances, negative controls, fixed seeds), the floor rule and seed_offset, the persistent-worker and coarray invariants (no skill exists), UI_ENVIRONMENT_KEYS/accepts. CLAUDE.md "Routing" does not point to the test, UI, coarray or persistent-worker policies (the skills simple-architecture and simple-main-ui do for the first two).
  8. Rules only in skills/CLAUDE.md, not in any policy: private-program required keys (ui U3), TRACED_DEFAULT_HELPERS obligation (ui U2), "a new exec router goes into the *_exec_api module of its executable" (simple-main-apis), thin-commander flow (now in the layering draft), release-4 no-alias rule (only partly in ui policy), "keep master work in strategies, not commanders" (CLAUDE.md).

Unverified

  • All timings and measurements: compile-time Evidence table, "test code is a fifth of summed compile time", "gate takes about 5 s", card "Cost" lines, profile medians/spreads/worst runs (only 8 constants spot-checked against test sources).
  • Whether the commit-hash .mod change really forces a full rebuild after each commit (mechanism verified in the .mod, cascade not built).
  • Test policy 6.4 (external SIMPLE_data_testing workflow: 50-micrograph subsets, FSC criteria): lives in another repository.
  • Dispatcher internals beyond constants (SIGTERM/SIGKILL ordering, /proc sampling, process-group kill timing, WNOWAIT) and test=profile scaling rules (reservation/deadline scaling).
  • Coarray runtime behaviour (no OpenCoarrays here); persistent-worker mutex discipline and thread-slot lifecycle read but not traced line by line.
  • validate_complete_ui_json.py rule details beyond the forbidden placeholders; the stream-contract review flow was not run.
  • audit_ui_defaults output depends on build/bin/simple_private_exec built 10:12 today from the tree above.
  • The per-file blame dates used for "new since 2026-10-04" counts (git blame -w) can be moved by whitespace-only or rename commits.