Skip to content

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Jan 28, 2026

relatively simple script that:

  • creates a repo in a tmp folder
  • runs entire enable
  • commits the initial setup
  • runs claude to create a file
  • simulates user edits
  • runs claude again
  • simulates user edits again
  • commits everything
  • outputs the metadata.json showing line attribution and everything else worked

Note

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, jq and makes networked Claude calls).

Overview
Adds scripts/test-attribution-e2e.sh, an end-to-end manual test that builds the entire CLI into a temp dir, creates a temporary git repo, enables tracking, and runs two real claude prompts interleaved with simulated human edits.

After committing, the script extracts the Entire-Checkpoint trailer, inspects metadata.json on the entire/sessions branch, and prints attribution breakdown plus related debug/rewind info, with an optional --keep flag to retain the repo for inspection.

Written by Cursor Bugbot for commit 982fe0a. This will update automatically on new commits. Configure here.

Entire-Checkpoint: b8e9234b1b70
@Soph Soph requested a review from a team as a code owner January 28, 2026 11:02
Copilot AI review requested due to automatic review settings January 28, 2026 11:02
Copy link
Contributor

Copilot AI left a 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.sh to automate an attribution-focused workflow in a temporary git repo.
  • Build and PATH-inject a fresh entire binary so Claude hooks resolve to the newly built CLI.
  • Extract checkpoint ID from the commit trailer and inspect sharded metadata.json for 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
Copy link

Copilot AI Jan 28, 2026

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.

Suggested change
if ! go build -o "$ENTIRE_BIN" "$CLI_DIR/cmd/entire"; then
if ! (cd "$CLI_DIR" && go build -o "$ENTIRE_BIN" ./cmd/entire); then

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +6
# 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
Copy link

Copilot AI Jan 28, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +198 to +207
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 .
Copy link

Copilot AI Jan 28, 2026

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).

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@khaong khaong left a 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...

@gtrrz-victor gtrrz-victor merged commit de8fc93 into main Jan 28, 2026
4 checks passed
@gtrrz-victor gtrrz-victor deleted the soph/test-attribution-flow-script branch January 28, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants