Skip to content

Add comprehensive missing attribution test suite#915

Closed
jwiegley wants to merge 10 commits intomainfrom
johnw/missing-notes
Closed

Add comprehensive missing attribution test suite#915
jwiegley wants to merge 10 commits intomainfrom
johnw/missing-notes

Conversation

@jwiegley
Copy link
Copy Markdown
Collaborator

@jwiegley jwiegley commented Apr 1, 2026

Summary

  • 27 new integration tests covering 18 failure hypotheses (H1-H18) for silent AI attribution loss
  • Exercises JSONL corruption, SHA mismatches, partial checkpoints, binary files, merge commits, INITIAL file corruption, multi-agent conflicts, and forward-compatibility edge cases
  • All tests pass (26 ok, 1 ignored observational)

Test plan

  • cargo test --test integration missing_attribution -- --test-threads=1 passes (26 ok, 1 ignored)
  • cargo fmt -- --check passes
  • cargo clippy --all-targets -- -D warnings passes

🤖 Generated with Claude Code


Open with Devin

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@jwiegley jwiegley force-pushed the johnw/missing-notes branch from f315e33 to 4dbbd4b Compare April 1, 2026 20:36
@jwiegley jwiegley changed the base branch from main to johnw/bug-fix April 1, 2026 20:36
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 10 additional findings in Devin Review.

Open in Devin Review

Base automatically changed from johnw/bug-fix to main April 1, 2026 22:10
devin-ai-integration[bot]

This comment was marked as resolved.

@jwiegley jwiegley force-pushed the johnw/missing-notes branch from dd94f99 to b274ec6 Compare April 2, 2026 06:38
@jwiegley
Copy link
Copy Markdown
Collaborator Author

jwiegley commented Apr 2, 2026

Addressed Devin Review's finding about sanitize_git_env_for_daemon() and disable_trace2_for_daemon_process() being called with tokio worker threads already alive (UB on POSIX).

Fixed in 7a37d84: moved both calls from run_daemon() (inside runtime.block_on()) to handle_run() before Builder::new_multi_thread().build(), ensuring no other threads exist when env::remove_var/env::set_var execute.

devin-ai-integration[bot]

This comment was marked as resolved.

@jwiegley jwiegley force-pushed the johnw/missing-notes branch from 5c1556e to 0d323e1 Compare April 3, 2026 01:00
Copy link
Copy Markdown
Collaborator Author

jwiegley commented Apr 3, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jwiegley jwiegley force-pushed the johnw/missing-notes branch from 0d323e1 to 0120724 Compare April 3, 2026 20:22
@jwiegley jwiegley force-pushed the johnw/missing-notes branch 2 times, most recently from 9534ff5 to 989e890 Compare April 8, 2026 00:39
jwiegley and others added 10 commits April 8, 2026 15:25
Document 18 failure hypotheses (H1-H18) covering every identified
scenario where AI attribution can be silently lost: JSONL corruption,
SHA mismatches, partial checkpoints, binary files, merge commits,
INITIAL file corruption, and multi-agent conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 integration tests covering 18 failure hypotheses for silent AI
attribution loss. Tests exercise JSONL corruption, SHA mismatches,
partial checkpoints, binary files, merge commits, INITIAL file
corruption, multi-agent conflicts, and forward-compatibility edge
cases. All tests pass (26 ok, 1 ignored observational).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three missing_attribution tests (H6d, H7a, H18) intentionally create corrupt
checkpoint data to document failure modes. In daemon mode, the daemon reports
errors when processing these, causing wait_for_daemon_completion_sessions to
panic before the test can check the outcome. Add allow_daemon_errors flag to
TestRepo so these tests can indicate that daemon errors are expected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The allow_daemon_errors flag was only checked in
wait_for_daemon_completion_sessions but not in the structurally
identical wait_for_daemon_completion_count or
wait_for_daemon_total_completion_count. This could cause tests
that set allow_daemon_errors(true) to still panic if their
execution path went through the other wait functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sanitize_git_env_for_daemon() and disable_trace2_for_daemon_process()
use unsafe env::remove_var/set_var which are not thread-safe on POSIX.
They were being called from run_daemon() inside runtime.block_on(),
but Builder::new_multi_thread().build() already spawns worker threads.
Move these calls to handle_run() before the runtime is constructed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…h analysis

Make run_daemon pub(crate) since it's only called from handle_run
internally. Add CodeQL config to exclude test directory from analysis,
suppressing 51 false-positive rust/path-injection alerts from TempDir
paths in integration tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…etup)

The paths-ignore option in codeql-config.yml is only supported with
advanced setup (workflow file), not GitHub's default CodeQL setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erification

Replace set_contents_no_stage() with direct fs::write() + explicit
git-ai checkpoint calls across all 27 test scenarios (H1-H18). Add
assert_lines_and_blame() assertions to every test, verifying per-line
authorship attribution rather than merely checking that attestation
maps are non-empty. This catches subtle attribution bugs that the
previous existence-only checks would miss.

Tests that use custom agent names not in AI_AUTHOR_NAMES (H11, H13)
use direct blame output verification instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jwiegley jwiegley force-pushed the johnw/missing-notes branch from 989e890 to 17d10f5 Compare April 8, 2026 22:48
@jwiegley jwiegley closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants