Skip to content

Plugin views, metric prefix, naming port (#2324 N1b) - #2357

Merged
neuromechanist merged 7 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-n1b-plugin-views
Nov 24, 2026
Merged

neuromechanist merged 7 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-n1b-plugin-views

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Phase N1b of #2324 (ADR 0137 live views): plugin views, the metric prefix rule, the checkpoints, and the naming port.

What changed

  • shared/contract/plugin-manifest.ts and .schema.json (nemar.plugin-manifest.v1, edited in place per ADR 0137 decision 4):
    • PLUGIN_NAME_RE is ^[A-Za-z][A-Za-z0-9_-]{0,63}, neuroschema 0.6.0 plugin.name. This fixes the failing A.b_c-d agreement case.
    • PLUGIN_METRIC_RE follows metricName (^[A-Za-z][A-Za-z0-9_-]*(:[A-Za-z][A-Za-z0-9_-]*)?, at most 128 characters).
    • outputs.views replaces outputs.figures, per C12. A view has a kind (kindName), a kind_version from 1 to 999, a caption and 1 to 8 roles. A role is either produced ({format, max_bytes <= 4194304, dims: up to 2 unique names, columns?}) or {from: "recipe"}. A manifest holds at most 16 views.
    • PLUGIN_CHECKPOINTS = ["quality"]. The figure formats, caps and constants are removed.
    • Problems, in this order: bounds_reversed, plugin_without_output, metric_not_prefixed (every metric is <plugin>:<name> with the manifest's own name as the prefix).
  • shared/contract/plugin-manifest-vectors.json is regenerated. It has prefixed names and view vectors, and no figures_valid or figures_without_figure.
  • shared/compute-recipes.ts:
    • STANDARD_CHECKPOINTS drops figures.
    • RECIPE_PLUGIN_STEPS = ["nemar-quality", "nemar-spectrum"], and nemar-ica's quality checkpoint lists both.
    • The resultLimits comment is rechecked: about 16 files per recording, so 25,000 admits about 1,560 recordings.
    • compute-progress-vectors.json is regenerated.
  • New shared/compute-naming.ts is a literal port of nemar-process common/naming.py at d090d84e: label, productStem, productPath and datasetPath, including posixpath slash handling. shared/contract/compute-naming-vectors.json is written by the test under NEMAR_WRITE_NAMING_VECTORS=1.
  • Tests:
    • plugin-manifest-{contract,vectors}: the describe block is renamed to agreement with neuroschema 0.6.0, and grammar agreement is added for metric, view key, role, dim, kind, format and column names.
    • compute-recipes.
    • compute-recipes-process-drift: the comment and the figures fixtures in the helper cases change. The comparison logic is untouched.
    • New compute-naming.
  • CHANGELOG.

Tests

  • bun run typecheck, bun run lint
  • Plugin manifest, recipe, naming, checkpoint and contract tests: plugin-manifest-contract, plugin-manifest-vectors, compute-recipes, compute-recipes-process-drift, compute-naming, compute-checkpoints, contract-neuroschema, contract-schemas and adr-index. 354 pass, 3 skip, 0 fail.
  • Every other test file that mentions figures or PLUGIN_: 207 pass and 4 skip in the root suite; 228 pass and 2 skip in the backend suite.
  • Tests that read the checkpoint maps or the progress vectors (contract-derivatives, recipe-progress contract, and the backend pipeline, grid, dispatch, routes, callbacks and metadata tests): 219 + 335 pass, 0 fail.
  • Naming parity: the 24 vectors were replayed against the real naming.py at d090d84e, with 0 mismatches.
  • Full bun test: not run (it runs at epic to dev).
  • Recipe drift test against nemar-process dev: it fails only on RECIPE_VERSION (1.0.0-b1 there, 1.0.0-b2 here). This is expected, because nemar-process dev lacks PZ. The test is not changed to pass.

Mutations (each applied, shown failing, reverted)

Mutation Result
M1 accept figures as a plugin checkpoint (zod) 5 fail
M1b accept figures as a plugin checkpoint (JSON Schema) 3 fail
M2 drop the prefix check 4 fail
M2b prefix check only requires a colon, not the plugin's own name 3 fail
M3 accept nemar-quality:9x (zod) 5 fail
M3b accept nemar-quality:9x (JSON Schema) 2 fail
M4 swap precedence: prefix check before bounds 3 fail
M4b swap precedence: plugin_without_output after the prefix check 0 fail: equivalent mutant (with no metric the prefix loop never fires, so the order cannot be observed)
M5 accept a manifest with no output 5 fail
M6 old plugin-name grammar (zod) 6 fail
M7 view role byte cap 4194305 (JSON Schema) 2 fail
M8 outputs passthrough (a figures key accepted beside views) 4 fail
M9 figures back in STANDARD_CHECKPOINTS 1 fail
M10 nemar-spectrum dropped from RECIPE_PLUGIN_STEPS 1 fail
M11 naming: desc rule drops the existing value 5 fail
M12 naming: label before the existing desc value 5 fail
M13 naming: desc appended even when present 5 fail
M14 naming: root-level recording gets a leading slash 3 fail
M15 naming: dirname keeps trailing slashes 2 fail
M16 naming: label drops only the first hyphen 2 fail

Review round fixes

  • Corpus cases added: 64 and 65 columns; a column unit of 32 and 33 code points; a column with an unknown key; 16- and 17-character formats; role names with a capital or a hyphen (and one with an underscore, accepted).
  • PLUGIN_MAX_VIEW_DIMS (2) and PLUGIN_MAX_VIEW_COLUMNS (64) are pinned in the words-and-numbers test.
  • A new test checks that each JSON Schema pattern string equals its TypeScript regex's source.
  • In test/contract-schemas.test.ts, PROGRESS_REQUEST_NAMES lists the five PluginView* schemas in place of PluginFigureSchema. Every listed name must be a zod schema that shared/contract/index exports. The strict-name count moves from 31 to 35.
  • The drift test's PLUGINS parsing fixture names nemar-spectrum in place of nemar-segment.

The reviewer's mutations, re-applied after the fixes (each now fails, then reverted):

Mutation Failures
R1 columns maxItems 65 (schema) / max 65 (zod) 1 / 2
R2 column unit cap 33 (schema / zod) 1 / 1
R3 format {0,16} (schema / zod) 2 / 3
R4 column additionalProperties: true (schema) / .passthrough() (zod) 1 / 1
R5 roles propertyNames pattern removed (schema) 3
R6 zod roles key a plain z.string() 2

Gates after the fixes:

  • bun run typecheck and bun run lint are clean.
  • Targeted contract tests: 367 pass, 3 skip, 0 fail.

Design choices to check

  • A manifest view carries kind, kind_version and caption beside its roles. C12 names only the roles, but nemar-process P2's loader words (kind_unregistered, format_unwritable) need the kind and the format to be declared. Whether a kind or format is registered is the loader's check, not the schema's: an unregistered namespaced kind is valid neuroschema.
  • A produced role's dims is a list of up to two unique dimension names in row-then-column order, the same shape as the registry's roles.<role>.dims. Units and coordinates go in the record's viewData, which the runner writes.
  • columns reuses neuroschema's column shape. The cap of 64 is NEMAR's own limit, not neuroschema's (neuroschema sets none). Unique column names are not enforced, because JSON Schema cannot state it and Ajv and zod would disagree.
  • recipeLabel in compute-recipes.ts is kept rather than imported from compute-naming.ts, because that module is held import-free by a test. The naming test ties the two together instead (label equals recipeLabel, and datasetPath equals recipeRequiredOutputs).

nemar-process progress pin

The plan moves nemar-process tests/contract/nemar-cli-progress-pin.json to this phase (P2). It re-copies plugin-manifest.schema.json, plugin-manifest-vectors.json, compute-progress-vectors.json (regenerated here) and the new compute-naming-vectors.json. Pin the squash commit this PR becomes on feature/issue-2324-epic-pipeline-progress, not the PR head.

Refs #2324

outputs.views replaces outputs.figures (kind, kind_version, caption, 1-8 roles, produced or from the recipe, max_bytes <= 4194304, at most 16 views); checkpoint quality only; plugin name and metric name follow neuroschema 0.6.0; problems bounds_reversed, plugin_without_output, metric_not_prefixed. Vectors regenerated. Tested: plugin-manifest contract and vectors tests.
STANDARD_CHECKPOINTS loses figures (ADR 0137); RECIPE_PLUGIN_STEPS and nemar-ica's quality checkpoint are nemar-quality then nemar-spectrum; resultLimits comment rechecked at about 16 files per recording. Progress vectors regenerated. Tested: compute-recipes, compute-checkpoints and process-drift tests (drift comparison against nemar-process dev fails only on the expected RECIPE_VERSION).
label, productStem, productPath and datasetPath, a literal port of nemar-process common/naming.py at d090d84e, with compute-naming-vectors.json for nemar-process to replay. Tested: compute-naming unit test; the 24 vectors replayed against naming.py at d090d84e with 0 mismatches.
Corpus cases for 64/65 columns, column unit 32/33, unknown column key, 16/17-character format and role names with a capital or hyphen; pins PLUGIN_MAX_VIEW_DIMS and PLUGIN_MAX_VIEW_COLUMNS; each schema pattern equals its regex source; the 64-column cap is documented as NEMAR's own. Tested: review mutations R1-R6 each fail.
PROGRESS_REQUEST_NAMES drops PluginFigureSchema for the five PluginView* schemas, and every listed name must be a zod schema exported by shared/contract/index. Tested: contract-schemas.
@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2357

Version: 0.10.40-PR2357.04af17f
Commit: 04af17f


🤖 Updated on each push.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review r1 (code+tests+errors+comments+types): 1 Important (corpus limits where zod and the JSON Schema could drift) and 1 Moderate (stale strict-name list) fixed in 04af17f with the reviewer's six mutations now failing; deviations 1-6 accepted; M4b equivalent. Driver verified: plugin-manifest-contract and contract-schemas pass locally (154 tests); CI checks reviewed. P2 question recorded: per-run view parameters (spectrum upper_hz) in PluginResult. Admin-merging into the epic branch.

@neuromechanist
neuromechanist merged commit bc772b5 into feature/issue-2324-epic-pipeline-progress Nov 24, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-2324-n1b-plugin-views branch November 24, 2026 21:02

This branch was previously deployed

1 inactive deployment
npm — 04af17f2 Deployed Nov 24, 2026 by neuromechanist via publish #4851
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.

1 participant