Repository navigation
feat(v0.6): content facts + file-matches-pattern, and CreateFile fix action - #53
Merged
Merged
Conversation
…action Two v0.5-depth increments (1 then 2 from the roadmap). CreateFile action: - a required file at a CONCRETE path (not a glob) that is missing is now created with obvious placeholder content, never overwriting an existing file; glob-named required files (LICENSE*, README*) stay manual since no single filename can be derived. Idempotent. Content facts + file-matches-pattern: - FactSet gains an opt-in file_contents map (collect_opts, valid-UTF-8 files <= 1 MiB). It is omitted from serialized output when empty, so the default `plasma facts` snapshot is byte-identical to v0.4/v0.5 — the frozen wire contract is preserved (additive field only). - file-matches-pattern is now evaluable: its regex is validated at load (InvalidRegex) so evaluation stays total; it is false when a file's content was not collected (binary/oversized/contents off). - plasma check/fix collect content automatically iff the policy uses file-matches-pattern (Policy::needs_content); plasma facts --with-contents forces it. Purity/determinism preserved: eval still operates only on the FactSet it is given. 100 tests (8 new); docs updated (engine-v0-design, interchange-contracts, cli-design); versions unified at 0.6.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
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.
What & why
The two v0.5 engine-depth items you asked for — "1 then 2":
CreateFilefix action (mechanical) — the missing-file half ofplasma fix.file-matches-pattern(the one with a real design decision) — content-aware policy conditions.1 — CreateFile
A required file at a concrete path (not a glob) that's missing is now created with obvious placeholder content, never overwriting an existing file. A required file named by a glob (
LICENSE*,README*— no single filename to derive) stays manual. Idempotent.2 — Content facts + file-matches-pattern
The design decision I flagged, and how I resolved it so the v0.4 wire contracts stay frozen:
FactSetgains an opt-in, additivefile_contentsmap (collect_opts, valid-UTF-8 files ≤ 1 MiB). It'sskip_serializing_ifempty, so the defaultplasma factssnapshot is byte-identical to before — verified by test.plasma check/fixturn it on automatically iff the policy usesfile-matches-pattern(Policy::needs_content);plasma facts --with-contentsforces it. The evaluator stays pure — it only ever reads theFactSetit's handed.file-matches-pattern's regex is validated at load (InvalidRegex), so evaluation stays total; the condition is false when a file's content wasn't collected (binary/oversized/off) — a defined semantics, documented.Verification
cargo test --workspace— 100 tests (8 new: CreateFile plan+apply, file-matches-pattern match/no-match/no-content, invalid-regex load rejection, content opt-in serialization, oversized-content skip)cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkcleanfile-matches-patternflags a TODO inmain.rs;CreateFilegenerates a missingSECURITY.md; defaultplasma factsstill omitsfile_contentsplasma check .self-check: 0 violations, 110 rules satisfiedNotes
regex(MIT/Apache) inplasma-engine.docs/interchange-contracts.adocdocumentsfile_contentsas opt-in/additive.UpdateFieldfix action; integration surfaces (git hooks, CI action,.plasma.tomlpinning); release facts;modify-rulesstays reserved.🤖 Generated with Claude Code
https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
Generated by Claude Code