Skip to content

v0.2.0: settings (Spec ADR 0011) and the entry on a feature output (ADR 0007 E8) - #667

Merged
guijacquemet merged 8 commits into
mainfrom
feat/wave-v0.10.0
Dec 3, 2026
Merged

guijacquemet merged 8 commits into
mainfrom
feat/wave-v0.10.0

Conversation

@guijacquemet

@guijacquemet guijacquemet commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Release v0.2.0 (3 December 2026)

Release commit 5dbdfe9 dates the CHANGELOG. MorphoCoverage depends on no MorphoBricks package, so nothing is re-pinned. Local gate b25rel (all bricks together, every suite, smoke and the Formin end-to-end run) on fb3e52e, the same code: no new failure. Merged and tagged v0.2.0 with the owner's approval.


MorphoCoverage's part of the MorphoBricks v0.10.0 wave: the ADR 0011 settings (migration row 7), the ADR 0007 entry on a feature output (J2, conformance row E8), and version 0.1.0 -> 0.2.0. Draft. Do not merge or tag until the wave is released.

1. Settings (Spec ADR 0011, row 7)

  • src/morphocoverage/_brick_settings.py is vendored byte for byte from Spec tools/brick_settings.py, with _brick_settings.PIN (Spec a86653b) and the template pin test.
  • defaults.toml (package data) has these sections:
    • [common]: the entry's settings. These are the object set, the guided session's answers (aim, features, readout, observation_unit, the controls, positive, fingerprint_tolerance, rare_label, scales, experiment, targets) and n_jobs.
    • [objective] and [rare]: ObjectiveConfig and its RareTarget; in the entry, Setup.sampling_objective and Setup.rare.
    • [calibration]: CalibrationSettings; in the entry, Setup.calibration.
    • Every key of these three is off by default (no default).
  • morphocoverage.settings provides the usual functions: load_settings, update_settings, save_settings (TOML or JSON), request_parameters and declared. It also provides objective_config(settings) and calibration_settings(settings). A value that the configuration objects refuse is refused when the file is read, with SettingsError naming the setting.
  • Tests check that the defaults file equals the dataclass defaults (the objective is off by default, and objective_config then gives ObjectiveConfig()), the load, save and load round trip, and the refusals.

2. The entry on a feature output (Spec ADR 0007 "MorphoCoverage", J2, E8)

  • Python entry: morphocoverage.run_folder(feature_output, output=None, *, check=False, settings=None). It is loaded lazily, so import morphocoverage still loads no plotting library.
  • Console script: morphocoverage run|check <feature_output> [--output] [--settings FILE|OUTPUT] [--set section.key=TOML] and morphocoverage settings -o FILE [--feature-output FEATURE_OUTPUT] (--run-folder is its other name; both given is refused).
    • Exit status is 0 when the run is done or reused, with a JSON object on stdout.
    • Exit status is 1 when the run is refused, with one JSON object on stderr (code, message, fix, subjects).
  • Input: a feature output, meaning MorphoFeature's run folder holding coverage/<set>/coverage.json (schema 3) plus objects, fovs and the feature tables, in CSV or Parquet.
    • No preprocessing run folder or image is opened. MorphoFeature's run_manifest.json is read for its file digests only: every file read is verified against them first (round 5).
    • No MorphoBricks package is imported or declared; the dependencies are unchanged.
    • The test fixture is a synthetic feature output built from the golden v03 export already in tests/morphofeature_exports. Nothing imports MorphoFeature at test time.
  • Structure checks: these are the existing refusals, made before anything is computed:
    • DescriptionRefused: version, not exported, malformed block, DISAGREES;
    • the data check.
    • Three new codes of the same family:
      • coverage_export_missing: no export at the path (which also covers a run folder given in its place), or a table is missing;
      • coverage_export_malformed (including a file whose digest does not match run_manifest.json or is missing there);
      • coverage_tables_refused.
  • Settings: the declaration is defaults.toml plus entry_settings.json.
    • The allowed values come from the export: its object sets, its feature columns and its observation unit.
    • The sources are given, record, fixed and execution_default (only for n_jobs, which RE7 allows; tests/test_parallel.py shows the results do not depend on it).
    • defaults.toml defaults are never applied.
    • ENTRY_SETTING_INVALID lists every problem; ENTRY_SETTING_MISSING lists every missing setting with its allowed values.
    • --settings <earlier output> takes the recorded settings again.
    • Every Setup field, run_folder parameter and CLI flag is in the E5 inventory (workflows/_entry_inventory.py, round 5).
  • Output: written to <feature output name>__morphocoverage. It holds the guided report (report.html, figures/, report_short.txt, report_full.txt, scan.txt), morphocoverage_answers.json (the saved answers, which are the recorded [common] settings), settings_used.toml and, written last, morphobricks_entry.json. It is published by one exclusive rename.
  • Reuse or refusal (RE10):
    • The identity is the SHA-256 of every table read, plus the code and the settings with affects_values. A moved feature output with the same tables is therefore reused.
    • A changed table, setting or library gives ENTRY_OUTPUT_EXISTS, naming the field.
    • An edited file, an extra file, a link or a missing record gives ENTRY_OUTPUT_INCOMPLETE.
    • An uncertain code identity (an editable install or a source tree) gives ENTRY_IDENTITY_UNCERTAIN.
    • The entry never overwrites an output.
  • Conformance with preprocessing (question 11, test environment only):

3. Version and documents

  • Version 0.2.0, a CHANGELOG entry (0.2.0, with an Added section) and a README section "Run on a feature output".
  • AGENTS.md changes:
    • §3 no longer says the package has no command line; it names the ADR 0007 console script.
    • §5 describes the entry's output and record.
    • §7 lists the new modules.
    • §18 is updated.
  • tools/baselines/layers.json admits one recorded edge: __init__ -> workflows.entry (local), which is the lazy run_folder.

Owner questions: answered (2 December 2026)

  1. Record and reuse implemented locally. Accepted as built.
  2. run_folder.plane_histograms is {}. Answered: records keep it, and preprocessing now pins that its checker accepts it (Plane histograms schema version 6 for preprocessing (Spec ADR 0008); v0.10.0 morphobricks-preprocessing#612 at 580ef54). The conformance tests pass against that head (below).
  3. Identity split (source vs run_folder). Accepted as built.
  4. The three coverage_* codes. Accepted as built.
  5. [objective], [rare], [calibration] (Q4). Answered: "become normal entry settings: declared, settable, recorded, in the identity." Done (round 5, below).
  6. --run-folder / --feature-output (Q5). Answered: "--feature-output alias of --run-folder, documented first in help and README; both accepted; both given is refused." Done (round 5, below).
  7. Full Setup inventory (Q6). Answered: "every config field, option and parameter is declared or refused." Done (round 5, below).
  8. Notebook card. Answered for the wave: cards are a follow-up, not built.
  9. Integrity check of the export (Q7). Answered: "verify the export against MorphoFeature's run_manifest.json digests." Done (round 5, below).
  10. One acquisition per run. Unchanged.

Also unchanged (wave decisions): settings sections as built, entry outputs in CSV/text as built, fov_subset waits for resolver contract 4. MorphoCoverage still pins no MorphoBricks package (its dependencies are unchanged).

Round 5 changes (owner decisions of 2 December 2026)

  • Export verified against run_manifest.json (Q7) (11810c4). Every file the entry reads (coverage.json, objects, fovs, each feature table) is hashed and compared with the SHA-256 that MorphoFeature's run_manifest.json (its files, keyed by the path relative to the feature output) records for it, before any of its values is read (coverage.json before it is parsed, each table before it is opened). A changed byte, a file the manifest has no digest for, or no readable manifest with files is refused with coverage_export_malformed, naming the file. Tests: a changed byte in each of the four files, a spy showing the changed table is never parsed, and a missing entry, digest, files and manifest. Checked by hand on a real MorphoFeature run (its own test_coverage_morphocoverage workflow on claude/vigilant-gauss-9m0e6o, Parquet and CSV): the check passes, and one appended byte gives coverage_export_malformed naming coverage/Cells/objects.<fmt>.
  • --feature-output (Q5) (2edee8e). morphocoverage settings -o FILE --feature-output FEATURE_OUTPUT, first in the help and README; --run-folder is still accepted as its other name; both given is ENTRY_SETTING_INVALID (exit 1, one JSON on stderr). The copied ENTRY_SETTING_MISSING text keeps naming --run-folder (it is preprocessing's text, which still works).
  • [objective], [rare], [calibration] are entry settings (Q4) (5489899). Declared in entry_settings.json with affects_values: true (the outside_entry mechanism is gone), optional and off unless given, recorded with their source, part of the identity. Given, they become:
    • objective.objective -> new Setup.sampling_objective: the objective a stop must cover, in place of the one the declared targets make (Setup.objective() returns it, its rare component Setup.rare). The declaration says "a stop needs the targets of the declared objective, ..." instead of "every declared target".
    • [rare] -> Setup.rare, a whole RareTarget, in place of the guided preset that common.rare_label makes.
    • [calibration] -> new Setup.calibration: CalibrationSettings passed to the report's sufficiency_report; it needs a definition of new, and fov_counts below the definition's min_fovs is refused up front (new calibration.check_calibration), not when the report runs.
    • A value these refuse is ENTRY_SETTING_INVALID before anything is computed.
    • Tests: the record and settings_used.toml; the Setup the entry builds equals what the library takes (RareTarget(**...), calibration_settings(...), ObjectiveConfig("balanced", rare=...)); E3: the report shows the rare target, the objective and the calibration check, and the plain run does not; E6: a rerun reuses and a changed value in each section is ENTRY_OUTPUT_EXISTS naming settings.<section>.<key>; refusals.
    • objective.objective loses its defaults.toml default "population", so that an entry file filled from settings -o does not override the targets' objective. objective_config without [objective] still gives ObjectiveConfig() (population). The file to fill now names every optional setting in a comment.
  • E5 inventory of the full Setup (Q6) (fb3e52e). workflows/_entry_inventory.py lists every Setup field as a setting, made from settings (tolerances, fingerprint, novelty from the aim, features and positive control), a fact of the export (fov_col, group_cols, feature_tables, explainable_tables, described) or fixed at Setup's default (normalize, novelty_target, few_fovs, hierarchy, effort_strata, acquisition_order_col, stage_cols, rules, random_state, minimum_detection, fields_independent, contrasts, intensity_features), with run_folder's parameters and the CLI flags. Tests pin it against dataclasses.fields(Setup) and the declaration, check every fixed field's value in entry runs, and refuse every Setup field that is no [common] setting when a settings file names it (ENTRY_SETTING_INVALID, never ignored).

New owner questions

  1. objective.objective lost its defaults.toml default. Kept, settings -o would write objective = "population" and an entry run filled from it would judge a fingerprint aim under the population objective. objective_config keeps the library's behaviour (population when absent). OK?
  2. New public Setup fields sampling_objective and calibration (both default None, so nothing changes for existing callers), and the public calibration.check_calibration. They are how the entry passes [objective] and [calibration] to the report. Alternatively, report() could take them as arguments.
  3. [rare] is all or nothing. Given, it must be a whole RareTarget and replaces the guided preset of common.rare_label. It never fills in the missing fields from the preset. Field-by-field override of the preset is the alternative.
  4. A given [objective] equal to the targets' objective is still identity. For example, population with aim = "population" is another output than leaving it out (R2: a given setting is recorded and identity). OK?
  5. The fixed Setup fields are fixed because the guided answers never offered them, for example random_state (0), rules, normalize, stage_cols and acquisition_order_col (the export carries no order or stage columns). Should any of them become an entry setting now?

For MorphoFeature's wave PR (CellMigrationLab/MorphoFeature#297)

  • Keep the export layout coverage/<set>/{coverage.json, objects.<fmt>, fovs.<fmt>, <tables[*].file>}, with table_format, identity_columns, observation_unit and tables.{file, tag, units} in coverage.json (schema 3, with its experiment block).
  • Keep run_manifest.json at the run folder's root with files[<path relative to the root>].sha256 for every file of the export, coverage.json included, as it does today: MorphoCoverage now verifies each file it reads against it and refuses an export without it (coverage_export_malformed).
  • When it writes its own morphobricks_entry.json at the run folder's root, MorphoCoverage records that identity (information).
  • The entry output must not move the export elsewhere. If it does, MorphoCoverage's open_feature_output must follow.

Checks (on this branch's last commit, fb3e52e)

  • python -m ruff check src tests data and python -m ruff format --check src tests data pass (ruff 0.17.2 in the environment; the pin is 0.16.8).
  • python tools/audit.py --check-against origin/main: baselines only tightened; the one admitted layer edge is the lazy run_folder above. The function index is regenerated.
  • Whole suite (pytest, every CPU), with this branch's src, preprocessing 580ef54 and normalization 62eb84e first on PYTHONPATH, in the shared gate environment:
    • this branch: 4940 passed, 2 skipped, 6 xfailed;
    • the previous head fdf0ca7, same environment and path: 4890 passed, 2 skipped, 6 xfailed.
    • No failure on either. The preprocessing conformance tests now run and pass, because preprocessing is on the path. The 2 skips on both are tests/test_morphobricks_constants.py, which reads the installed preprocessing's metadata (0.9.1) and needs 0.3.4. That is an environment effect.

🤖 Generated with Claude Code

…coverage.settings

ObjectiveConfig (with its RareTarget) and CalibrationSettings as the sections
[objective], [rare] and [calibration]; [common] holds the entry's settings.
The ADR 0011 module is vendored byte for byte with its own PIN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
morphocoverage.run_folder(feature_output, ...) and the console script
morphocoverage run|check|settings. The one path is a feature brick's output
(MorphoFeature's run folder with its MorphoCoverage export), read by its tables'
structure; no run folder is opened and no MorphoBricks library is imported.
The guided session's answers are the settings of [common], recorded in
morphobricks_entry.json (the shared schema, written with MorphoCoverage's own
code), with reuse or refusal by identity. The ENTRY_* texts are copied from
preprocessing's constructors and tested against them, and the record against its
checker, when preprocessing's entry pieces are installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entry

AGENTS section 3 now names the morphocoverage console script of ADR 0007 J2
beside the guided session; section 5 describes the entry's output and record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…B7 Q7)

Owner decision of 2 December 2026: every file the entry reads (coverage.json,
objects, fovs, each feature table) is hashed and compared with the SHA-256
that run_manifest.json records for it before any of its values is read. A
changed byte, a file without a digest, or no readable manifest is refused
with coverage_export_malformed, naming the file. The test fixture writes the
manifest as MorphoFeature does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision of 2 December 2026: `morphocoverage settings -o FILE
--feature-output FEATURE_OUTPUT` is the documented form (first in the help
and the README); `--run-folder`, every brick's name for the input, is still
accepted; giving both is refused with ENTRY_SETTING_INVALID (exit 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision of 2 December 2026: the three sections are declared,
settable, recorded and in the identity like [common]'s, no longer accepted
only at their default. Off unless given (objective.objective loses its
defaults.toml default; objective_config still gives ObjectiveConfig's
population when absent). Given, they are Setup's new fields
sampling_objective (the objective a stop must cover, in place of the one the
declared targets make; the declaration says so) and calibration
(CalibrationSettings, passed to the report's sufficiency_report; it needs a
definition of new, and fov_counts below its min_fovs is refused up front by
calibration.check_calibration), and Setup.rare (a whole RareTarget, in place
of the guided preset). E3 and E6 tests: the values reach the Setup and the
report, a rerun reuses, a changed value is ENTRY_OUTPUT_EXISTS naming it.
The file to fill names every optional setting in a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision of 2 December 2026: workflows/_entry_inventory.py lists every
Setup field as a setting, made from settings, a fact of the export, or fixed
at Setup's default (refused as a setting, never ignored), with run_folder's
parameters and the command line's flags. Tests pin it against
dataclasses.fields(Setup), the declaration, and the Setup of entry runs, and
refuse every Setup field that is no setting when a settings file names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MorphoCoverage 0.2.0, the MorphoBricks v0.10.0 release. It depends on no
MorphoBricks package, so nothing is re-pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@guijacquemet
guijacquemet marked this pull request as ready for review December 3, 2026 10:01
@guijacquemet
guijacquemet merged commit 3173588 into main Dec 3, 2026
2 checks passed
@guijacquemet
guijacquemet deleted the feat/wave-v0.10.0 branch December 3, 2026 10:02
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.

2 participants