Harden collection templates and quality gates#34
Merged
Conversation
Split the Strata collection-pattern regression tests by behavior surface so helper signatures, helper body matches, return matches, non-concrete dispatch, subset map rules, static template-key checks, and type/capacity validation can be reviewed independently. Split the Mantle artifact value-template implementation into focused modules for typed definitions, parsing, payload handling, projection validation, template evaluation/admission, and value operations while preserving the existing public artifact surface. Keep the Strata and Mantle boundary explicit: Strata test coverage remains source-facing and immutable, Mantle continues to operate on typed artifact values and IDs, map projection modes remain enum-backed, and process-reference payloads stay constrained to typed runtime boundaries. Verification: cargo +stable fmt --all --check; cargo +stable test -p strata source_function_collection_patterns; cargo +stable test -p mantle-artifact; cargo +stable clippy -p mantle-artifact --all-targets -- -D warnings; cargo +stable clippy -p strata --all-targets -- -D warnings; just quality.
There was a problem hiding this comment.
Pull request overview
This PR refactors two areas to make collection-pattern behavior and Mantle value-template handling easier to review and maintain, without changing the public Mantle artifact surface.
Changes:
- Split the Strata
source_function_collection_patternsregression tests into focused modules by behavior surface (helper surfaces, non-concrete dispatch, subset map patterns, template keys, and type/capacity validation). - Split Mantle artifact value-template/value handling into a
value_template/module tree (model, parsing, payload, projection, template evaluation/validation, and value operations), preserving the existing exports. - Minor cleanup in
mantle-artifactimports to reflect the refactor.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/strata/src/language/tests/source_function_collection_patterns/mod.rs | New test module root with shared helper and submodule declarations. |
| crates/strata/src/language/tests/source_function_collection_patterns/helper_surfaces.rs | Exercises “happy path” helper surfaces and lowering for list/map patterns and payload-dependent templates. |
| crates/strata/src/language/tests/source_function_collection_patterns/non_concrete_dispatch.rs | Adds targeted tests ensuring non-concrete collection arguments are rejected across dispatch surfaces. |
| crates/strata/src/language/tests/source_function_collection_patterns/subset_map_patterns.rs | Adds focused tests for subset-map pattern overlap/exactness/emptiness rules. |
| crates/strata/src/language/tests/source_function_collection_patterns/template_keys.rs | Adds focused tests for static-template key requirements and duplicate-key rejection. |
| crates/strata/src/language/tests/source_function_collection_patterns/type_validation.rs | Adds focused tests for type-argument validation, capacity validation, and duplicate key enforcement. |
| crates/strata/src/language/tests/source_function_collection_patterns.rs | Removes the previous monolithic test file in favor of the split modules. |
| crates/mantle-artifact/src/artifact/value_template/mod.rs | New module root re-exporting the same value-template/value public types. |
| crates/mantle-artifact/src/artifact/value_template/model.rs | Extracts value/value-template data structures. |
| crates/mantle-artifact/src/artifact/value_template/parsing.rs | Extracts artifact value label parsing helpers. |
| crates/mantle-artifact/src/artifact/value_template/payload.rs | Extracts typed payload wrapper and process-ref payload handling. |
| crates/mantle-artifact/src/artifact/value_template/projection.rs | Extracts map projection parsing/validation helpers. |
| crates/mantle-artifact/src/artifact/value_template/template.rs | Extracts template evaluation and validation logic. |
| crates/mantle-artifact/src/artifact/value_template/value.rs | Extracts artifact value parsing/validation/labeling/projection methods. |
| crates/mantle-artifact/src/artifact/value_template.rs | Removes the previous monolithic value-template implementation file in favor of the split modules. |
| crates/mantle-artifact/src/artifact.rs | Updates validation imports consistent with the refactor (no behavior change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add a stable source-to-runtime performance smoke test over collection_state that measures checking, lowering, and in-memory Mantle execution with broad regression budgets. Wire the quality gate and CI job label to include the performance smoke path, and document how the gate should be used without treating it as a precise microbenchmark. Add committed fuzz seeds for collection, template, artifact decode, and runtime source paths while routing mutation output into ignored corpus directories. Expand the Miri smoke gate across map projection validation, payload-dependent template rejection, and subset collection pattern checking. Verification: just fuzz-ci; just miri-ci; just quality; git diff --check.
Extend the collection_state performance smoke gate to report wall time, process CPU time, and resident memory for both check/lower and in-memory runtime paths. Require CPU and RSS metrics on Linux and macOS-class local platforms, keep unsupported platforms timing-only, and preserve broad regression budgets to avoid fragile microbenchmark behavior. Document the expanded resource signals and the platform-specific RSS behavior in the development gates guide. Verification: cargo +stable check -p strata-mantle-acceptance --test performance_smoke; just performance-smoke; just quality; git diff --check.
Copy committed fuzz seed fixtures into ignored corpus directories before smoke runs, then run cargo-fuzz only against the ignored corpus paths so mutation output cannot touch tracked seeds. Prefer Linux process CPU accounting from /proc/self/stat for the performance smoke gate, with schedstat retained as a fallback. Update development-gate docs to describe the read-only seed flow and Linux CPU metric source. Verification: cargo +stable check -p strata-mantle-acceptance --test performance_smoke; just performance-smoke; just fuzz-ci; just quality; git diff --check.
Add a git-tracked performance smoke baseline with reviewed reference values and broad budget ceilings for collection_state check/lower and in-memory runtime paths. Load the baseline from the acceptance smoke test instead of hardcoding iterations and budgets, keeping units explicit and parsing strict without adding dependencies. Document that local and CI runs print measurements while git tracks reviewed baseline changes rather than raw noisy run history. Verification: cargo +stable check -p strata-mantle-acceptance --test performance_smoke; just performance-smoke; just quality; git diff --check.
Reject top-level artifact value labels with unmatched closing delimiters before record or enum parsing can select a structured parse path, and cover the fail-closed behavior with a focused artifact-value regression test. Change the performance smoke RSS budget check to enforce current RSS per measured profile while keeping process-lifetime peak RSS as diagnostic output when the platform exposes it. Document the current-RSS budget behavior in the development gates guide. Verification: cargo +stable test -p mantle-artifact artifact_value_parse_rejects_unbalanced_top_level_delimiters; cargo +stable test -p mantle-artifact; cargo +stable check -p strata-mantle-acceptance --test performance_smoke; just performance-smoke; just quality; git diff --check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/collection_state.str, covering repeated Strata check/lower and repeated Mantle in-memory execution with broad regression budgets./proc/self/statand current/peak RSS through/proc, while macOS-class local runs report current RSS throughps.benchmarks/performance-smoke.baselinewith reviewed reference values, enforced budget ceilings, explicit nanosecond/KiB units, and strict test-side parsing.Boundary and correctness notes
StopandContinuereturns, with no assignment-style source updates introduced..mtafuzz seed is an artifact-decode input only; it is not used as milestone proof and remains internally self-identifying with format, schema version, and source language.benchmarks/rather than committing every measured run.Verification
cargo +stable check -p strata-mantle-acceptance --test performance_smokecargo +stable fmt --all --checkcargo +stable test -p strata source_function_collection_patternscargo +stable test -p mantle-artifactcargo +stable clippy -p mantle-artifact --all-targets -- -D warningscargo +stable clippy -p strata --all-targets -- -D warningsjust performance-smokejust fuzz-cijust miri-cijust qualitygit diff --checkci-native