-
Notifications
You must be signed in to change notification settings - Fork 125
adds a attribution test script #115
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
Conversation
Entire-Checkpoint: b8e9234b1b70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new end-to-end shell script to validate attribution tracking by running a full workflow (init repo → enable Entire → run Claude edits + human edits → commit → inspect metadata.json on entire/sessions).
Changes:
- Add
scripts/test-attribution-e2e.shto automate an attribution-focused workflow in a temporary git repo. - Build and PATH-inject a fresh
entirebinary so Claude hooks resolve to the newly built CLI. - Extract checkpoint ID from the commit trailer and inspect sharded
metadata.jsonfor attribution fields.
| # This ensures BOTH our direct calls AND Claude's hook calls use the new binary | ||
| ENTIRE_BIN_DIR=$(mktemp -d) | ||
| ENTIRE_BIN="$ENTIRE_BIN_DIR/entire" | ||
| if ! go build -o "$ENTIRE_BIN" "$CLI_DIR/cmd/entire"; then |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build step runs go build without first switching into the module root. If the script is invoked from outside the repo (or any directory not under the module), go build can fail with “go.mod file not found”. Run the build from $CLI_DIR (e.g., (cd "$CLI_DIR" && go build -o ... ./cmd/entire) or go -C "$CLI_DIR" build ...) so the script works regardless of the caller’s current directory.
| if ! go build -o "$ENTIRE_BIN" "$CLI_DIR/cmd/entire"; then | |
| if ! (cd "$CLI_DIR" && go build -o "$ENTIRE_BIN" ./cmd/entire); then |
| # End-to-end test for attribution tracking with real Claude calls | ||
| # Usage: ./scripts/test-attribution-e2e.sh [--keep] | ||
| # --keep: Don't delete the test repo after running (for inspection) | ||
|
|
||
| set -e |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script depends on external tools (claude, jq, git, go) but doesn’t check for them up front. Add a small preflight section (and/or update the header usage block) that validates required commands are available and prints a clear install/setup hint before doing any work; this avoids confusing “command not found” failures mid-run.
| echo -e "${GREEN}Found metadata.json:${NC}" | ||
| git show "entire/sessions:${METADATA_PATH}" | jq . | ||
|
|
||
| # Extract and display attribution specifically | ||
| echo "" | ||
| echo -e "${BLUE}=== Step 13: Attribution Analysis ===${NC}" | ||
| ATTRIBUTION=$(git show "entire/sessions:${METADATA_PATH}" | jq -r '.initial_attribution // empty') | ||
| if [[ -n "$ATTRIBUTION" && "$ATTRIBUTION" != "null" ]]; then | ||
| echo -e "${GREEN}Attribution data:${NC}" | ||
| echo "$ATTRIBUTION" | jq . |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jq is used unconditionally to pretty-print and to extract fields from metadata.json. With set -e, a missing jq will abort the script even though it could still show raw JSON. Consider guarding jq usage with command -v jq and falling back to cat/raw output (or emitting an explicit error early in the preflight check).
khaong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gtrrz-victor FYI you were looking into some e2e testing...
relatively simple script that:
entire enableNote
Low Risk
Low risk: adds a new test script only, with no changes to runtime code paths; main risk is local side effects (requires
go,git,claude,jqand makes networked Claude calls).Overview
Adds
scripts/test-attribution-e2e.sh, an end-to-end manual test that builds theentireCLI into a temp dir, creates a temporary git repo, enables tracking, and runs two realclaudeprompts interleaved with simulated human edits.After committing, the script extracts the
Entire-Checkpointtrailer, inspectsmetadata.jsonon theentire/sessionsbranch, and prints attribution breakdown plus related debug/rewind info, with an optional--keepflag to retain the repo for inspection.Written by Cursor Bugbot for commit 982fe0a. This will update automatically on new commits. Configure here.