-
Notifications
You must be signed in to change notification settings - Fork 343
feat(redact): move OPF to pre-push, add prompt + shadow cleanup #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
42a0927
feat(redact): OPF runs at pre-push, not commit time
peyton-alt 36ced06
feat(redact): interactive prompt + ENTIRE_OPF env var before pre-push…
peyton-alt 6d54ea4
perf(redact): scope OPF rewrite to the commit's own shard
peyton-alt e1a0ce0
feat(strategy): delete shadow branches once their checkpoints are pushed
peyton-alt 337f1e1
refactor(redact): remove dead OPF abstractions
peyton-alt e4a8e46
fix(redact): address PR 1236 review comments
peyton-alt 8151b3b
fix(redact): address remaining PR 1236 review feedback
peyton-alt 83b589d
fix(redact): close privacy holes flagged in PR 1236 final review
peyton-alt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| package checkpoint | ||
|
|
||
| import ( | ||
| "context" | ||
| "os" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/entireio/cli/cmd/entire/cli/checkpoint/id" | ||
| "github.com/entireio/cli/cmd/entire/cli/testutil" | ||
| "github.com/entireio/cli/cmd/entire/cli/trailers" | ||
| "github.com/entireio/cli/redact" | ||
| "github.com/go-git/go-git/v6" | ||
| "github.com/go-git/go-git/v6/plumbing" | ||
| "github.com/go-git/go-git/v6/plumbing/object" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestWriteCommitted_DoesNotEmitOPFAppliedTrailer is the regression guard | ||
| // for the architectural promise: standard post-commit condensation writes | ||
| // 7-layer-only blobs and MUST NOT mark them with the Entire-OPF-Applied | ||
| // trailer. The trailer is emitted exclusively by the pre-push rewrite | ||
| // path; if a future change accidentally added it to the standard writer, | ||
| // the pre-push rewrite would skip those commits (HasOPFApplied true → | ||
| // reparent-only, no actual OPF run) and ship 7-layer content as if it | ||
| // were 8-layer. This test pins down that contract. | ||
| func TestWriteCommitted_DoesNotEmitOPFAppliedTrailer(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| tempDir := t.TempDir() | ||
| testutil.InitRepo(t, tempDir) | ||
| repo, err := git.PlainOpen(tempDir) | ||
| require.NoError(t, err) | ||
|
|
||
| wt, err := repo.Worktree() | ||
| require.NoError(t, err) | ||
| readmeFile := filepath.Join(tempDir, "README.md") | ||
| require.NoError(t, os.WriteFile(readmeFile, []byte("# Test"), 0o644)) | ||
| _, err = wt.Add("README.md") | ||
| require.NoError(t, err) | ||
| _, err = wt.Commit("Initial commit", &git.CommitOptions{ | ||
| Author: &object.Signature{Name: "Test", Email: "test@test.com"}, | ||
| }) | ||
| require.NoError(t, err) | ||
|
|
||
| store := NewGitStore(repo) | ||
| cpID := id.MustCheckpointID("a1b2c3d4e5f6") | ||
|
|
||
| err = store.WriteCommitted(context.Background(), WriteCommittedOptions{ | ||
| CheckpointID: cpID, | ||
| SessionID: "regression-no-opf-trailer", | ||
| Strategy: "manual-commit", | ||
| Transcript: redact.AlreadyRedacted([]byte(`{"role":"user","content":"hello"}` + "\n")), | ||
| AuthorName: "Test", | ||
| AuthorEmail: "test@test.com", | ||
| }) | ||
| require.NoError(t, err) | ||
|
|
||
| // Read the latest commit message on entire/checkpoints/v1 and assert | ||
| // HasOPFApplied is false. We resolve via the ref then walk back the | ||
| // single commit the writer just produced. | ||
| ref, err := repo.Reference(plumbing.NewBranchReferenceName("entire/checkpoints/v1"), true) | ||
| require.NoError(t, err, "writer should have created entire/checkpoints/v1") | ||
| commit, err := repo.CommitObject(ref.Hash()) | ||
| require.NoError(t, err) | ||
|
|
||
| if trailers.HasOPFApplied(commit.Message) { | ||
| t.Errorf("standard WriteCommitted emitted Entire-OPF-Applied trailer; commit message:\n%s", commit.Message) | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.