Audit B: 2D, particle I/O, stack indexing, KB interpolation, FSC area score¶
Scope: the seven documents named in the assignment, read in full and checked against the tree at
fd5b5bc8e (HEAD 2026-10-21; working tree has simple_cartft_calc*.f90 modified and the untracked
doc/policies/README.md and doc/policies/layering_and_project_ownership_policy.md, which I read and
treat as the maintainer's draft: its section 8 already records the make_cavgs worker write). Nothing in
the repo was edited. Line numbers in L.. are the policy document's; code is file:line.
Finding IDs are per document (S solve2D, B bootstrap, C cache, R read path, I stack indexing, K KB, F fsc). Cross-cutting items are X1..X8 at the end.
Counts (61 per-document findings + 8 cross-cutting). Severity: H 3, M 27, L 31. Category: STALE 10, DRIFT 11, CONTRADICTS 3, VIOLATED 4, GAP 24, STRUCTURE 9, OLDNAME 0. Cross-cutting: H 1, M 5, L 2. Per document: solve2D 16 (H1 M7 L8), bootstrap 10 (H2 M5 L3), cache 9 (M5 L4), read path 8 (M2 L6), stack indexing 9 (M4 L5), KB 5 (M3 L2), fsc 4 (M1 L3).
doc/policies/2D/solve2D_policy.md (lines 566; last commit 2026-10-20; verdict: minor drift, one large gap, split advised)¶
- [S1][M][STALE] L112-114: "phase 2 stages run
nits_per_stageiterations, more when the sample needs them" -> now:maxits = iter + max(nits_per_stage, coverage_nits) - 1andminits = iter + 1, so a phase-2 stage runs 2..nits_per_stageiterations and stops when converged; only when coverage needs more thannits_per_stageisminits = maxits(fixed count). Evidence:src/main/solve/simple_solve2D_controller.f90:246-254. Fix: "run at most nits_per_stage iterations (at least 2) and end on convergence; a sample that needs more than nits_per_stage iterations to cover every particle fixes the count (minits = maxits)". - [S2][M][STALE] L346-349: "make_cavgs/cavgassemble commanders ... (command-line wrappers; theirs is a full project write)" -> only
commander_cavgassemble(run_cavgassemble) does the fullwrite(simple_cavgassemble_strategy.f90:31). Shared-memorymake_cavgswrites theptcl2D,cls2Dandoutsegments (simple_make_cavgs_strategy.f90:246-255, 291-294); a distributedmake_cavgsworker part 1 writesptcl2Dwhile the other parts read (:253, listed in the layering draft). Fix: say which wrapper writes what. - [S3][M][VIOLATED] L221-228 (and
simple-solve2dskill "master writes only cls2D, cls3D, out and particle segments";simple-main-projectskill "writes it once per iteration"): the distributed refine2D master writesptcl2Dthree times after the workers:merge_algndocs(..., 'ptcl2D', ALGN_FBODY)writes the merged segment by default (simple_refine2D_strategy.f90:404;writedefaults to.true.,simple_sp_project_core.f90:569-592),run_distributed_cavg_assembly(:771) anddistr_finalize_iteration(:449), plus once after sampling inprob_align2D_exec(simple_prob_align_strategy.f90:314): four writes per prob iteration, three otherwise (CORRECTED after the policy edits: the first version of this report missed the merge write). The layering draft rule 5.4 ("one write of a segment per iteration") and red flag 7 name exactly this. Fix in code: skip:449when assembly wrote; or state the second write and its reader in the policy. - [S4][H][GAP] Segment I/O contract of the 2D workflows is not written (who may write
ptcl2D/ptcl3D/cls2D/cls3D/out/projinfo, how often, from where). Observed in code, to be turned into a table in section 3 (a "Project segments" subsection), see the table after this list. The refine3D policy has the equivalent (section 4, lines 161-184); the 2D policy only says what assembly writes. A developer cannot tell that (a)solve2Dholds its ownspprojacross stages and must rereadptcl2D/ptcl3D/outbefore writing them (simple_commanders_solve2D.f90:197-198, 217-224, 701-704), (b) shared-memory refine2D handsptcl2Dtoprob_align2Dthrough the file (writesimple_refine2D_strategy.f90:612, commander rebuilds its own params/builder, reread:622), (c)ensure_field_halvescan writestk+ptcl2D+ptcl3Dfrom any master-side caller (simple_eo_partition.f90:65-76). - [S5][M][DRIFT] L336-343 (and read path L75-86): "In shared memory the probability table fills the particle buffer" -> only when the run is uncached:
if( .not. params%l_distr_worker .and. .not. l_cached )(simple_commanders_prob.f90:371). Withcache=yesthe matcher reads the cache and no buffer is filled. Add "uncached". - [S6][M][GAP] Sampling predicates are in code but not in the policy:
update_frac >= 0.99is treated as no sampling at all (l_update_frac = update_frac < 0.99,simple_solve2D_controller.f90:94: no sample, no carry-over, nofillin, no terminal pass);refine2D_blends_carryover=l_update_frac .and. startit /= 1(non-stream) orwhich_iter > 1 .and. update_frac < 0.99(stream2d) (simple_matcher_smpl_and_lplims.f90:347-355), used by the matcher and the masters;is_fresh_2D_startexcludesfillinandcontinue=yes(simple_strategy2D_alloc.f90:33-38). Proposal: add to section 4 as the single definition of "blends carried sums" and "fresh start". - [S7][M][GAP]
cavg_state.binhas more writers and a different lifecycle than L494-513 say ("written only by the assembly owner"): (a) the distributedmake_cavgsassembler also publishes it, becausecavger_assemble_sums_from_partsalways callscommit_carryover(simple_classaverager_restore.f90:867, 764), so the final full-boxmake_cavgsofsolve2D, the seed references and therandcls/continue reference rebuild overwrite the run's carried set with sums of another geometry (safe,matchesfails and the next iteration is a full update, but unstated; shared-memorymake_cavgsdoes not write it); (b) the stream pool pads it (cavger_pad_carried_sums,simple_stream_pool2D.f90:877); (c) nothing deletes it:qsys_cleanupkeeps 2D sums by default and no caller passeskeep2D=.false.(simple_qsys_funs.f90:16-48). Proposal: list writers and end of life in section 6. - [S8][L][STALE] L536-537 checklist: "Does
inpl_cont=noretain the callback route" contradicts L443-447 (inpl_continternal, not selectable in 2D; set tonoonly byrefine=cont,simple_parameters_phases.f90:1049). Delete or reword the item. - [S9][L][DRIFT] L131-132: "
solve2D_chunksand the stream keepcls_init=rand" is a default: both pass a givencls_initthrough (simple_commanders_solve2D.f90init_chunk_clustering,simple_stream_pool2D.f90:240-243); withpreva chunk fails ("requires a previous 2D clustering") because chunks delete the clustering (generate_chunk_projects).refine2Drejectsprevonly when it makes the references itself (init_standard_refs); withrefs=giveninit_refine2D_refsreturns first (simple_refine2D_strategy.f90:672). - [S10][L][DRIFT] L285 and L381-389: bench files are
BENCH/<FAMILY>_BENCH.txtandBENCH/<FAMILY>_BENCH_PARTppp.txt(src/fileio/simple_bench_io.f90), soREFINE2D_BENCH_PARTppp.txtandPROB_TAB2D_BENCH_PARTppp.txtare insideBENCH/; the strategy file isREFINE2D_STRATEGY_BENCH.txt. - [S11][M][STRUCTURE] 566 lines mixing policy with implementation notes: L262-337 (part-file layouts, dense and sparse assignment algorithms, tie handling, bench record contents), L381-389 (bench inventory, duplicates
refine3D_policy.md11.1), L438-481 (continuous in-plane, duplicatesrefine3D_policy.md528-637), L436 + L494-513 (carried sums, duplicatesimportance_sampling_fractional_update_policy.md195-210, 412-426 and the refactoring note 4.1). Sections 7 and 8 repeat sections 2-4 almost line for line. Proposal: keep stages, seeded restart, ownership, artifacts; move the part-file and assignment algorithm text to an implementation note; point to one home for the carried sums. - [S12][L][STRUCTURE] L10-13, L133, L444: dated history ("called abinitio2D before 2026-10-03", "since release 4 (2026-10-03)", link to
abinitio2D_seeded_restart.md). Allowed by CLAUDE.md as dated history, but a living policy should state the current names only. - [S13][L][VIOLATED]
distr_initializeclearsupdatecnt/sampledin memory only (simple_refine2D_strategy.f90:319-321); in non-probabilistic distributed mode noptcl2Dwrite precedes the workers (they read the file), so a stand-alonerefine2D nparts=N refine=snhc_smpl startit=1starts from the file's stale flags.solve2Dmasks it (writes the cleaned field first,simple_commanders_solve2D.f90:166-170). Confirm before relying on it. - [S14][L][GAP]
solve2D_chunks(stack-bound chunk projects built by hand,generate_chunk_projects,solve2D_chunktype insrc/main/solve/simple_solve2D_chunk.f90) andnrestarts(restarted_exec,simple_exec_refine2D.f90:39-43) have no ownership entry in section 3;solve3D_chunks_policy.mdhas the 3D counterpart. - [S15][L][GAP] The matcher keeps module-level pointers (
b_ptr,p_ptr) and public work arrays (ptcl_imgs, ...) thatset_b_p_ptrs2Dre-aims;prob_align2D_execandexec_prob_tab2Dcall it with builders that are killed on return (simple_strategy2D_matcher.f90:70-75,simple_prob_align_strategy.f90:303,simple_commanders_prob.f90:329). Rule missing: "every entry into the 2D matcher module sets the pointers; they dangle after the owning builder is killed". - [S16][L][GAP] No test is named anywhere in the document. Existing guards to cite: carried sums
unit_reconstructionsuite "class-average carry-over" (simple_cavg_sums_tester.f90), part filesunit_pftc_align2D3D"2D probability table I/O", half-sets and mergeunit_project("eo partition", "project merge"), stack I/Ounit_core. Missing guards: byte identity ofcache=novscache=yes(claimed at L371-374),restore_cavgs_inmemvs distributed assembly parity (L350-358).
Segment table for S4 (observed; proposal for section 3). "own project" = the process's build%spproj:
| Process / routine | Reads | Writes (segment, when) |
|---|---|---|
solve2D commander (own spproj) |
whole project once; cls2D,out after every stage; ptcl2D,ptcl3D at the end |
ptcl2D at start (fresh: after delete_2Dclustering; seeded: after reseed_classes); ptcl3D at the end unless a valid 3D alignment exists; out after the final class averages; ensure_field_halves may write stk,ptcl2D,ptcl3D |
refine2D shared memory (restore_cavgs_inmem, inmem_finalize_run) |
file at start | cls2D+cls3D every iteration; ptcl2D+out once per invocation; prob mode: ptcl2D written twice and reread once per iteration (:612, prob_align2D_exec:314, :622) |
| refine2D distributed master | file at start | ptcl2D after sampling (prob mode); ptcl2D by the default-writing merge of the workers' documents; after assembly cls2D,cls3D,out,ptcl2D; ptcl2D again in finalize_iteration; out at run end |
refine2D worker (refine2D_exec) |
file | none: algndoc_partN, sigma2 part files, cavg_contrib_partN.bin, dist_part*/assignment files |
make_cavgs shared memory |
file | ptcl2D (class remap, halves), cls2D, out |
make_cavgs distributed |
file | worker part 1: ptcl2D; assembler (run_cavgassemble): full project write |
sigma2 rebuild entry (ensure_sigma2_for_iteration) |
- | projinfo (sigma2_state registration); caller rereads projinfo |
doc/policies/2D/class_average_bootstrap_policy.md (lines 373; last commit 2026-10-03 (rename only; last substantive change 2026-06-12); verdict: stale, rewrite)¶
The "four files changed since" of the staleness table are the four files the document names as places the command must NOT live; none of the changes touched bootstrap. The real drift is older: the command was reworked on 2026-06-12 (199b95d38) and the policy never followed.
- [B1][H][STALE] L244-254 and L349-350, L360-365: "If any accepted parent has
Y_cap_i < Y_child, the command stops and reports the limiting parent classes" -> now such parents (and parents with zero population, inactivecls2Dstate, invalideo, a realized anchor below 2, no non-anchor particles left, no parity-complete anchor) are skipped, recorded in the manifest with a reason, and counted in>>> BOOTSTRAP_CAVGS CLASSES INPUT/USED/SKIPPED/OUTPUT; the command stops only when no class is usable. The output size isK_used * osmpl_fac, notK * osmpl_fac. Evidence:simple_commanders_mkcavgs.f90:146-175, 229-268, 507-527; the UI help already says "usable parent classes times osmpl_fac" (simple_ui_refine2D.f90,new_bootstrap_cavgs). Rewrite sections 9, 13, 14. - [B2][H][STALE] L8-12, L110-123, L153-176: "copies the accepted original class averages into the start of the output stack" / required inputs "merged, even, and odd class-average stacks" -> the command reads no class-average stack. It builds a bootstrap project (rows of every parent member as role
original, plus anchor and member rows per child), writes it, and runsmake_cavgson it, so the whole output including the "original block" is re-assembled from particles (:188-192, 207-221). Required inputs are theptcl2D,cls2Dandstksegments (:123-127). - [B3][M][STALE] L224-227: a parent without a parity-complete anchor "is copied only in the original block" -> now the last anchor slot is swapped for the best-ranked particle of the missing half (
select_bootstrap_anchor,:318-329); if that fails the parent is skipped entirely and absent from the original block too. A realized anchor below 2 also skips the parent (:148-153); neither rule is in section 8. - [B4][M][STALE] L276-327: manifest and membership formats. Code writes comment header lines (
ncls_input,ncls_used,ncls_skipped,ncls_expected_if_all_input_valid,ncls_out,osmpl_fac,frac_best,anchor_target, skipped-class lines) then columnsout_cls role parent_cls child_id parent_pop n_anchor n_members; membership columnssynthetic_pind out_cls role parent_cls child_id source_pind source_rank source_corr eo stkind indstk; rolesoriginal|child(manifest) andoriginal|anchor|member(membership), notanchor|variable. Norun_seed/parent_seedexists; the shuffle uses the global generator (:355-362, 501-549). The reproducibility sentence (L324-326) is therefore false as written. - [B5][M][STALE] L176 and L328-334: "The original project ... not modified" / "temporary bootstrap project" ->
boot_proj%write(params%projfile)(:209-210) writes the synthetic project to the command's project file; the original is safe only through themkdir=yescopy (default set at:119); withmkdir=noit is overwritten. - [B6][M][GAP]
unbootstrap_cavgs(exec_unbootstrap_cavgs,simple_commanders_mkcavgs.f90:609-744, UInew_unbootstrap_cavgs) is the return path: it copiescls3Dalignment of thebootstrap_child=0classes to theirbootstrap_parentclasses ofprojfile_orig(or, without thecls2Dkeys, by majority vote onptcl2D:pind_prev) and callsmap2ptcls. Section 10 ("must not perform ... mapping of synthetic child orientations back to original particles") and section 12 never mention it. Proposal: a "Return path" section; state that only the original block is mapped back. - [B7][M][STRUCTURE] L3 "first implementation policy" and section 14 "Before implementation, confirm": plan narrative of a command that has existed since June; the statements "public controls are only
osmpl_facandfrac_best" (alsorefs; all three areUI_VIS_DEVELOPER, so not public in the UI sense) and "should not expose seed" are design intent. Convert to present tense. - [B8][L][DRIFT] L121-123 "accepted =
cls2D%state > 0": code rejectsstate == 0andpop == 0; a missingstatekey is accepted (:246-258). - [B9][L][GAP] One-way link: nothing in
solve3D_cavgsconsumes the package (rg bootstrap src/main/solvefinds no call) andsolve3D_cavgs_policy.mddoes not cite this policy; the "Handoff" section is aspirational. - [B10][L][GAP] The 553-line
exec_bootstrap_cavgs(layering draft section 8) carries the whole logic in the commander, while section 4 says the work belongs "near explicit class-average assembly ... or a new commander": acceptable, but the policy gives no tester; none exists.
doc/policies/2D/particle_cache_policy.md (lines 197; last commit 2026-10-19; verdict: minor drift)¶
- [C1][M][STALE] L108-111: fallback to uncached execution "with no active particles, a denoised primary source, or a non-particle oritype" -> no denoised-source check exists (
ptcl_cache_ensure,simple_ptcl_cache.f90:488-587; the file has no "denois"). Delete the clause; section 7 lists the real eligibility (box_crop >= box, oritype). - [C2][M][CONTRADICTS] L146-148: "The cached class-average restoration path is accepted on statistical parity with uncached execution, not bit equality" vs L53-57 and
solve2D_policy.mdL371-379 and thesimple-solve2dskill ("cache=no equals cache=yes byte for byte"). Sincecrop_particles2D(simple_matcher_ptcl_batch.f90:313-320) makes the same entry in memory, uncached equals cached; parity is against the retired full-box path, or against the stream pool. Reword. - [C3][M][DRIFT] L116-119: "restoring class averages from cropped particles is deliberately not the same preprocessing as from full-size ones, so ranks must never mix modes" -> an uncached rank (outside the stream pool) restores from the in-memory cropped entry, the same bytes. The mandatory uniformity (
ptcl_cache_assert_ready,simple_ptcl_cache.f90:394-408) stays, but its stated reason is out of date; state the actual reason (buffer sizes,l_cachedpaths, stream pool keeps full-size sums). - [C4][L][DRIFT] L15-16: "In probabilistic mode the same particle is read twice per iteration" -> once in shared memory (the table fills the particle buffer, the matcher copies from it); twice in distributed runs.
- [C5][L][CONTRADICTS] L78-80: "(the range-derived fallback is covered by the per-stack
fromp/top)" ->project_stack_indexing_policy.mdL93-100: the range-derivedindstkfallback no longer exists (release 4);map_ptcl_ind2stk_indstops (simple_sp_project_ptcl.f90:72-83). The fingerprint still tolerates an absentindstk(simple_ptcl_cache.f90:293-298); say that it folds what the project holds. - [C6][M][GAP] Consumers (L44-66) list who must not use the cache but not who turns it on: the stream initial analysis
solve2Djob (simple_stream_stage_initial_analysis.f90:1346) and the solve3D state-assignment route'ssolve2D(simple_state_assignment.f90:1159, alsostream_3D_ingestion_policy.mdL379).refine2Dexposescachebut notcache_dirin the UI (simple_ui_refine2D.f90:61-66vs:116-123), while L5 presents the pair for "the 2D matcher workflows". Add a "Known callers" list. - [C7][M][GAP] The cache has its own reader,
ptcl_cache_read_batch(serialdstack_io,simple_ptcl_cache.f90:663-697), timed apart asrt_cache(simple_matcher_ptcl_io.f90:37, 105-108). The read-path policy says every pass reads through the session and that no particle cache exists (R1, R2). Section 3 should say that cache hits bypass the session and that the build itself reads the originals through it (reads%read,:616). - [C8][L][GAP] No tester for
simple_ptcl_cache(key validity, adoption of a leftover, 25 % budget, uniform fallback, ownership cleanup); the contract of sections 4-8 is unguarded. Proposesimple_ptcl_cache_testerinunit_coreor a fast-gate case. - [C9][L][STRUCTURE] Section 10 "Future Extensions" is plan narrative (scavenger, benefit predicate, "consider defaulting cache=yes"); move to a planned note. Skill drift:
simple-solve2dsays the cleanup hook fires fromsimple_exception; the code (and this policy) saysimple_error(simple_error.f90:44).
doc/policies/particle_read_path_policy.md (lines 102; last commit 2026-10-19; verdict: minor drift, two absolute claims wrong)¶
- [R1][M][CONTRADICTS] L5-6: "No particle is rewritten into another file, and no cache of particles exists." vs
particle_cache_policy.md(a disk cache of Fourier-cropped particles,simple_ptcl_cache.f90) andproject_stack_indexing_policy.mdL197-212 (consolidate_particlescopies every active particle into one new stack,simple_commanders_project_ptcl.f90:798-910). Reword to "reading never rewrites ...; the 2D cache andconsolidate_particlesare separate, explicit products". - [R2][M][VIOLATED] L18-23 ("Every pass that reads particles reads them through one read session ... Nothing reads a particle by opening its stack on its own") and
project_stack_indexing_policy.mdL222. Readers outside the session: the cache reader (C7);exec_ctf_correctthroughread_imgbatchwith the module-levelstkio_r(simple_matcher_ptcl_io.f90:182-238,simple_commanders_imgproc.f90:64, 132);exec_write_classes(simple_commanders_mkcavgs.f90:847);cls_init=ptcl/tseries reference selection (simple_procimgstk.f90:825, 891, 947); project thumbnails (simple_sp_project_ptcl.f90:634). Scope the rule to the passes it names, list the exceptions, or route them through a one-shot session. - [R3][L][DRIFT] L21-22 "In the matchers the session is wrapped by
ptcl_read_session": every pass kind uses the wrapper, including class sums (simple_classaverager_restore.f90:381), power spectra (simple_calc_pspec_strategy.f90:272), FLEX (simple_flex_pca_embed.f90:72,simple_flex_probe_fit_estep.f90:439), the offload reconstructor andsingle_commanders_experimental. The wrapper lives instrategies/search, soclass/,volume/andflex/import a strategy-layer module. State it, or move the wrapper next tostack_read_session. - [R4][L][DRIFT] L31-33: a span bridges a gap of at most 2 MiB only while its over-read stays at most the bytes it needs, and within the per-stream cap
SPAN_SCRATCH_CAP/(nstreams*image_bytes)(plan_spans,simple_stack_read_session.f90:605-606;span_cap:108). - [R5][L][DRIFT] L94-101: the bench context also reports "particle bytes advised" (
simple_matcher_ptcl_io.f90:121). - [R6][L][DRIFT] L58:
separate_alignment_and_reconstruction_for_multistate_peak_mem_reduction.mdis named without its path (3D/), and that document restates the buffer and its budget (its table row and lines 74-78); the budget rule is stated in two policies. - [R7][L][GAP] Who resolves (stack file, image index) is only pointed at. State the owner in one line:
sp_project%get_stkname_and_ind(simple_sp_project_stk.f90:749-765, wrapsmap_ptcl_ind2stk_ind), called per particle byptcl_read_session(simple_matcher_ptcl_io.f90:318-320); the session itself only sees (name, index) pairs. - [R8][L][STRUCTURE] The code names the implementation note as "Policy" (
simple_stack_read_session.f90:6,simple_matcher_ptcl_io.f90:54); point both at this document. The opening lacks a scope line and a "read before editing" pointer (the newdoc/policies/README.mdsupplies the latter).
doc/policies/project_stack_indexing_policy.md (lines 294; last commit 2026-10-15; verdict: current for what it states; four contract gaps)¶
Spot checks that hold: map_ptcl_ind2stk_ind stops on missing nptcls_stk/indstk and range errors (simple_sp_project_ptcl.f90:60-83); prune_particles is metadata-only and drops a particle with its state-0 stack (:428-548); consolidate_particles sets indstk = project row and a common nptcls_stk (simple_commanders_project_ptcl.f90:891-903); fix_projfile behaves as L243-262 (simple_projfile_utils.f90:1275-1349); the merge rules of L114-142 hold for merge_selected_project_files.
- [I1][M][VIOLATED] L222: "Every particle reader goes through the pass-scoped read session" (same exceptions as R2).
- [I2][M][GAP] No list of who may write
stk,nptcls_stk,fromp/top/nptcls,stkind,indstk. At least 15 independent sites compute them by hand:sp_project_stk(add_stkand the stack-table adders,:52-556),prune_particles,exec_prune_project(simple_commanders_project_ptcl.f90:766),consolidate_particles(:902), reimport_particles (:371-376),exec_...insimple_commanders_imgproc.f90:257,ptcl_subset,mic_subset,project_superset,merge_chunk_projfiles(_without_sigma2),merge_selected_project_files, extract and reextract (simple_extract_strategy.f90:401,simple_reextract_strategy.f90:343),refine_motion_model_strategy:291, the stream pool publication (simple_stream_refine2D_utils.f90:197, 371),solve2D_chunks,bootstrap_cavgs, STAR import (simple_starproject.f90:404),single_commanders_trajectory:417, and the path rewrite ofupdate_project(doc/relocating_project_data.md,absolutize_project_stack_paths). Proposal: a "Writers" section listing the sanctioned ones and requiringstk,nptcls_stk, ranges,stkindandindstkto be set together (ideally by one helper), validated by thefix_projfilechecks in a tester. - [I3][M][GAP] The (stack path,
stkind,indstk) triple is an identity that others hash:ptcl_layout_digestties the sigma2 state and the state weight set to it (src/main/project/simple_ptcl_layout.f90), the particle cache key folds path, range,nptcls_stk, size, mtime,stkindandindstk(simple_ptcl_cache.f90:265-302). Seven sites dropsigma2_stateafter a layout change (consolidate_particles:906,ptcl_subset:176,mic_subset:281, ...), whileprune_particlesdoes not (the digest rejects it later). Rule missing: any operation that changes those fields must invalidate dependents (dropsigma2_state, treat caches as stale). - [I4][M][GAP] Merge Policy covers
merge_projectsonly. Two further mergers exist,merge_chunk_projfilesandmerge_chunk_projfiles_without_sigma2(simple_projfile_utils.f90:18, 323; callerssimple_ptcl_sieve.f90:1325, 2317, stream and chunk code): they concatenatecls2D/out, renumber particleclass(origclass/chunkkeys), carryindstkthroughtransfer_oriand run none of thenptcls_stk/indstkchecks of L124-126. Say whether they are bound by the same contract (they should be), or name the difference. - [I5][L][GAP] Class averages as "particles":
map_ptcl_ind2stk_ind('cls3D', ...)returns stack 1 and index = class, andget_stkname_and_indtakes the name from theoutcavg stack (simple_sp_project_ptcl.f90:20-29,simple_sp_project_stk.f90:760-761); the initial analysis writesindstkoncls2D(simple_stream_stage_initial_analysis.f90:1686); the cache refusescls3D. Not in the policy. - [I6][L][GAP] Stack rows also carry the half-set provenance markers (
eo_group/eo_byindex,simple_eo_partition.f90:22), andensure_field_halveswritesstk,ptcl2Dandptcl3Dinside the file when it labels (:65-76). Field Semantics lists neither; the only description isrefine3D_policy.mdsection 5. - [I7][L][DRIFT] L216-218 names
map_ptcl_ind2stk_ind; readers callget_stkname_and_ind, which adds the path. Name both. - [I8][L][STRUCTURE] Test Policy (L264-294) names no test. The guards exist:
simple_project_merge_tester.f90(pruned-style and earlier-release cases,:169, :242),simple_ptcl_subset_tester.f90,simple_eo_partition_tester.f90, all inunit_project; cite them. - [I9][L][GAP] Dead duplicate resolution on a hot path:
cavger_transf_oridatcallsmap_ptcl_ind2stk_indfor every particle of every batch and storesprecs(i)%ind_in_stk, which nothing reads (simple_classaverager_restore.f90:93, fieldsimple_classaverager.f90:103). Remove; the session resolves again anyway.
doc/policies/KB_Interpolation_Policy.md (lines 113; last commit 2026-10-21; verdict: content current, form is a memorandum, not a policy)¶
Spot checks that hold: OSMPL_PAD_FAC = 2 (simple_defs.f90:95), pf^2 in simple_image_polar.f90:170 and simple_reconstructor.f90:1025, pf^3 in simple_projector.f90:198 and simple_projector_pft_batch.f90:133, plane storage on the native lattice (simple_type_defs.f90:93-94), and the 6a B-spline gather (gather_packed_bspline3_window_grad, ref_weight in set_ref, test_stencil_switch).
- [K1][M][STRUCTURE] Not in policy form: title "Internal Technical Memorandum", "Subject/Purpose", no scope statement; section 8 "Summary of Policy Change" (L112-113) is history; the markdown is damaged by a conversion (
F(x*pd) = Σ*{k_pd ∈ W}, escaped\[h,k,0\],1\.headings); the file name is the only title-case one indoc/policies/. Rewrite as a policy: scope, rules, implementation map; drop section 8. - [K2][M][GAP] The constants and where they live are not stated:
OSMPL_PAD_FAC = 2,KBALPHA = 2,KBWINSZ = 1.5(half width; W = 2*Whalf, the "three taps"), beta fromKB_BETA_KB15_A2orpi*sqrt(W^2/alpha^2*(alpha-0.5)^2 - 0.8)(simple_defs.f90:94-98,simple_kbinterpol.f90:new). L25 "pf = 2 (current configuration)" does not name the compile-time constant that some twenty modules use; say whether changing it is supported. - [K3][M][GAP] Cropped class sums: sums at
box_cropinterpolate onbox_croppd = 2*round2even(KBALPHA*box_crop/2)(simple_parameters_phases.f90:552,simple_classaverager_restore.f90:232-245), which spans the same physical extent asboxpd, so index h is the same frequency in both; sigma2 and PCG shells sit atOSMPL_PAD_FAC*n(simple_rec3D_pcg_strategy.f90:414-420). Section 6 ("Class Average Restoration", two sentences) states neither. - [K4][L][STRUCTURE] 6a cites plan identifiers, "O5 of the pose_cont refactoring" (L101) and "(E10)" (L103); E10 in that note is "gather equals
interp_fcomp_oversamp" (pose_cont_refactoring.md:1095), not "interpolation errors". Cite the testers (simple_cartesian_fourier_tester.f90:test_fused_bspline3_gather_oracle,test_stencil_switch;simple_cartft_calc_tester.f90). - [K5][L][GAP] No implementation or test map:
simple_kbinterpol.f90,simple_gridding.f90,simple_cartesian_fourier.f90, testsunit_numerics"Kaiser-Bessel kernel" andunit_cart_align3D"Cartesian Fourier" (named only in the skill).
doc/policies/fsc_area_score_policy.md (lines 205; last commit 2026-09-09; verdict: standalone part current, refinement part partly stale)¶
Spot checks that hold: Fibonacci axes, antipodal double cone, shell = nint(sqrt(h^2+k^2+l^2)) with DC skipped (simple_image_freq_anal.f90:303-368), wAuC with weight shell^2 and the crossing excluded, cFAR = min/max (simple_fsc.f90:556-679), outputs and plot names, min_count=1 (simple_commanders_resolest.f90:111-150), the 0.8 onset and the +2-shell start (phase_rand_fsc, simple_fsc.f90:60-113; ENVMSK_FSC_THRESH = 0.8).
- [F1][M][STALE] L51-56 and L63-77 (and
refine3D_policy.md893-897): "envfsc=yes: the on-the-fly density envelope ... is applied to both half-maps before conical FSC and cFAR" holds for the gridding backend only. Withrec_backend=pcg,evaluate_halfmap_pairbuilds the density mask solely to writeautomask3D_stateNN.mrc; the half maps are not masked, there is no phase randomization, andfscu/fsct/fscn_stateNN.binare not written (l_phase_randomization = gridding .and. mask_kind /= none,simple_halfmap_diagnostics.f90:96-103; PCG callsimple_rec3D_pcg_strategy.f90:86-95;refine3D_policy.md~line 990: "PCG reports FSC on the constrained pair without post-hoc masking or phase randomization"). Theautomsk=numask path (lag-one NU envelope with density fallback,simple_volassemble_strategy.f90:745-770) and the rule thatautomsk=yes|nuimpliesenvfsc=yes(simple_parameters_phases.f90:818-831) are missing. Fix: scope the paragraph to gridding and point torefine3D_policy.mdsection 9 and the NU policy for the masks, or add one sentence per backend. - [F2][L][STRUCTURE] L58 "since 2026-09-09" is dated history; the refinement-time masking text duplicates
refine3D_policy.md893-902 andNU/nonuniform_filtering_policy.md141, 291. Keep the calculation here, the mask routing in one place. - [F3][L][GAP] Refinement uses fixed constants, not the program keys:
CFAR_NDIRS = 256,CFAR_CONE_HALF_ANGLE_DEG = 20,CFAR_FSC_THRESHOLD = 0.143,CFAR_MIN_COUNT = 1(simple_halfmap_diagnostics.f90:17-20). Also unstated: where the value goes (particle fieldcfar, slot 53,refine3D_policy.md923; theRESOLUTIONstats and GUI metadata). - [F4][L][GAP] No unit test of the numerics (
conical_fsc,score_cfsc_curve,calc_fsc_area_score):rgfindscfaronly in the ori and binoris record testers; the high-level suites use it as a floor (test_environment_policy.md1150). Name the guard or add a tester.
Cross-cutting gaps in this cluster¶
- X1 [H] Project-segment ownership for 2D has no home. The layering draft (section 5) states the general rules;
solve2D_policy.mdmust carry the per-workflow table (S4), the write budget (S3) and the file handoffs of the stage controller (solve2Dwrites, child rebuilds from the file,solve2Drereadscls2D/outand writes only what it owns). The draft already notes the make_cavgs worker write; its "confirm before removing" should be settled (a worker only verifies the halves:ensure_field_halvesreturns early forl_distr_worker_glob,simple_eo_partition.f90:41-47; so the part-1 write persists whatgenerate_cluster_centersand, for time series,partition_eochange in every worker's copy (remap_cls,expand_classes,ini_tseries,proj2class), which the assembler later reads from the file. That is the contract to write down, or to move to the master). - X2 [M] "Which stack file and index does a particle live at": the owner of the lookup is
sp_project(map_ptcl_ind2stk_ind,get_stkname_and_ind), but the data are written by about fifteen independent routines and read by one session plus about five bypasses. Needed inproject_stack_indexing_policy.md: a writers list (I2), the layout-identity rule (I3), the merger scope (I4), and the readers outside the session (R2). The three policies agree on the reader rule and onindstksemantics but each makes an absolute statement the code does not keep (R1, R2, C5). - X3 [M] Three-way consistency of read path, cache and indexing: the read path says no particle cache exists (R1), the cache policy has its own reader (C7), and the indexing policy says every reader uses the session (I1). One paragraph in the read-path policy listing "session readers" and "other readers" (cache hits, single-image utilities,
consolidate_particlesbyte copy) fixes all three. - X4 [M] The carried class sums are described in three policies (
solve2D_policy.mdL436 and 494-513,importance_sampling_fractional_update_policy.md195-210 and 412-426, the refactoring note 4.1) and bycavg_sums.f90's header, which points back at the solve2D policy. Pick one home; add the writer list and lifecycle (S7) there. - X5 [M] The predicates "blends carried sums" and "fresh start" (S6) are shared by the matcher, both masters and the stream; they belong in the sampling policy and are cited from solve2D.
- X6 [M]
ptcl_read_sessionsits instrategies/search/simple_matcher_ptcl_io.f90but is imported byclass/,volume/,flex/andstrategies/parallelization(R3): a domain-to-strategy import againstlayering_and_project_ownership_policy.mdsection 2. Move it besidestack_read_session(src/fileio) or declare it an exception. - X7 [L] Test pointers are missing in all seven documents except one file name (R-level). Map: stack I/O and spans
unit_core"stack I/O"; carry-overunit_reconstruction; 2D table I/Ounit_pftc_align2D3D; merge, half-sets, subsetsunit_project; KBunit_numerics. No guard exists for the particle cache, cache==no-cache identity, cFAR numerics, or bootstrap. - X8 [L] Skills versus policy:
simple-main-project("a workflow that owns its project in memory writes it once per iteration") is contradicted by the distributed refine2D master (S3);simple-solve2dnamessimple_exceptionfor the cache hook (code:simple_error);simple-solve2dandsimple-main-classagree with the solve2D policy on the cropped sums and buckets.
Unverified¶
- Numerical and bit-identity claims (cache==no cache byte for byte, restore parity between shared memory and distributed, "bit for bit" buffer records,
(box/box_crop)^2gains): need runs; I read the code paths only. - solve2D L438-481 (continuous in-plane: single all-angle evaluation, plus-minus two cells, acceptance guards, rounded probability artifacts): read the dispatch (
simple_strategy2D_srch.f90:100-105, matcher:105, :198) but did not trace the optimizer. - solve2D L262-337: checked formats -4/-5, header words, entry sizes, dynamic schedules, atomic capture and bench names; did not trace the frontier assignment, the tie-handling statements or the "same unstable hpsort" claim.
- solve2D L282-283
gen_likelihood_val_bank,memoize_shifted_ptcl,record_seed_shiftinternals (names exist). - particle_read_path "bit-exact" and prefetch counters under load;
SIMPLE_IO_NSTREAMSper-device probe beyond the code read; Windows stubs. - Seed-restart bullet L136-176 beyond the commander's flow (reseed partition proportions,
MINCLSPOPLIMvalue, lineage file columns). - fsc_area_score: Otsu/largest-component/cosine-edge density-envelope construction (
automask3Dwithlp_override) not read. - KB policy section 1-5 formulas checked for names and scale factors only, not derived.