Embedded follow-ups: driftPolicy + writer threat-model docs - #21
Merged
Conversation
The two non-blocking follow-ups deferred from the 3.0 review.
driftPolicy: createProjectFromDefinition(def, { driftPolicy }) — default
'report' keeps today's behavior (return the project with an error-severity
diagnostic when a stored `add` now collides with generated output);
'error' throws instead, for callers that want an unreconciled definition
to fail loudly. Version drift alone (a warning) never throws.
Threat model: EMBEDDING.md now states plainly that the writer is safe
against hostile file maps and pre-existing symlinks but is not race-proof
against a concurrent process mutating the destination (the TOCTOU window
between preflight and write), and that the intended use is a private temp
workspace — rather than implying protection we don't provide.
89 tests pass (2 new), lint clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The two non-blocking items deferred from the 3.0 review, now that the structural refactors are in.
driftPolicyforcreateProjectFromDefinitionWhen a file the host originally added now collides with one the current Packkit generates, replay reports an error-severity diagnostic and uses the stored copy. That's the right default (
'report') — a definition is a reproducibility contract. But a consumer treating anyseverity: 'error'as a hard failure would misread it, so'error'makes throwing opt-in. Version drift alone (a warning) never throws — only the unreconciled add-collision does.Writer threat model
EMBEDDING.mdnow says plainly what the writer does and doesn't guarantee:../null-byte paths, and any path resolving through an existing symlink — including the destination and final component — are rejected before writing).Better to state the boundary than imply protection we don't provide.
89 tests pass (2 new), lint clean.
🤖 Generated with Claude Code