Skip to content

test(e2e): scenarios 2 + 3 (#334 step 2) - #363

Merged
robotrocketscience merged 2 commits into
mainfrom
feat/issue-334-step2-scenarios
May 3, 2026
Merged

test(e2e): scenarios 2 + 3 (#334 step 2)#363
robotrocketscience merged 2 commits into
mainfrom
feat/issue-334-step2-scenarios

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Step 2 of #334 rollout: adds scenarios #3 and #2 from the ratified spec.

  • Scenario ci: history-scan should see all branches #3tests/e2e/test_source_type_discrimination.py: exercises the three first-class ingest paths (cli_remember, filesystem/transcript, git) through their real console-script entry points (aelf lock, aelf ingest-transcript, aelf-commit-ingest) and asserts the discriminating identifiers land in ingest_log. Catches the [phantom-prereqs T1] Belief corroboration tracking — sibling table + ingest recorder #190 R1 class — a constant defined in module A but never written by path B.
  • Scenario Add CI workflows, scan config, and align README #2tests/e2e/test_hook_inject_roundtrip.py: exercises store → rebuild → stdout context block (the same code path the UserPromptSubmit/PreCompact hooks call). Asserts a locked belief related to a recent transcript turn reaches the rebuild output, and that empty input exits cleanly (no-op contract).
  • conftest.py — adds installed_console_script fixture for sibling resolution of console scripts (aelf-commit-ingest) across the uv-tool / pipx / venv-pip matrix.

After the corroboration table proved unsuitable for a one-shot test (rows only fire on content-hash hits), the source-discrimination test pivoted to ingest_log.source_kind, which is the v2.0 #205 source-of-truth log written on every record_ingest. The bug class (#190 R1 — constant defined but never written) is caught either way; ingest_log is the durable single-shot signal.

Test plan

  • uv run pytest tests/e2e/ -v — all 6 cases pass locally (3 from step 1 + 3 new)
  • ruff check tests/e2e/ — clean
  • Discretion check — only public-API "Claude Code" platform refs, already public in src/aelfrice/hook_commit_ingest.py
  • CI e2e workflow runs on this PR via the e2e label opt-in (per step 1)
  • At least 2 of {uv-tool, pipx, venv-pip} install methods green

Closes part of #334 step 2; spec gate "4 of 6 seed scenarios pass" advances from 1/4 to 3/4.

Summary by Sourcery

Add new end-to-end coverage for ingest source discrimination and hook-driven rebuild roundtrips.

Tests:

  • Add an e2e test validating that CLI, filesystem transcript, and git commit ingest paths record distinct source kinds and transcript labels in the ingest log.
  • Add an e2e test asserting that locked beliefs surface in rebuild output for recent transcript turns and that rebuild exits cleanly on empty input.
  • Introduce a shared fixture to resolve sibling console scripts across different installation methods for use in e2e tests.

#334)

Adds tests/e2e/test_source_type_discrimination.py covering the three
first-class ingest paths (cli_remember, filesystem/transcript, git)
through their real console-script entry points and asserting their
discriminating identifiers in ingest_log. Catches the #190 R1 class
of regression where an INGEST_SOURCE_* constant is defined but never
written by the path that should use it.

A new conftest fixture installed_console_script resolves siblings of
the installed aelf binary so the test can invoke aelf-commit-ingest
across the uv-tool / pipx / venv-pip matrix.
Adds tests/e2e/test_hook_inject_roundtrip.py covering the seam the
UserPromptSubmit / PreCompact hooks travel: pre-seeded store + recent
transcript -> rebuild_v14 -> stdout context block. Two cases: a
locked belief related to a recent turn must land in the block; an
empty store + empty transcript must exit cleanly (no-op contract for
fresh projects). Catches drift in the transcript reader, retrieval,
or block renderer that would silently inject empty memory.
@robotrocketscience robotrocketscience added the attn:review Needs review (PR open, awaiting reviewer) label May 2, 2026
@sourcery-ai

sourcery-ai Bot commented May 2, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds two new end-to-end scenarios to validate ingest source discrimination across CLI/filesystem/git paths and the hook→ingest→rebuild roundtrip, plus a shared fixture for resolving console scripts across installation methods.

File-Level Changes

Change Details Files
Introduce fixture that resolves sibling console scripts consistently across uv-tool/pipx/venv installs.
  • Add installed_console_script pytest fixture that derives other console scripts from installed_aelf.
  • Implement uv run fallback so console scripts can be invoked via uv run <name> when aelf itself is run under uv.
  • Document fixture behavior and installation-matrix assumptions in the fixture docstring.
tests/e2e/conftest.py
Add E2E test to ensure each first-class ingest path records the correct source_kind and transcript label in ingest_log.
  • Implement helpers to read distinct source_kind and transcript-related source_path values from ingest_log via sqlite3 without importing application code.
  • Exercise cli_remember via aelf lock and transcript ingest via aelf ingest-transcript using a minimal transcript JSONL file.
  • Create a real git commit in the tiny_project repo and drive the aelf-commit-ingest console script with a synthetic Bash tool payload that mimics the host harness.
  • Assert ingest_log contains cli_remember, filesystem, and git source_kind rows and that transcript ingest produces source_path='transcript'.
  • Surface hook stderr on traceback and sanity-check the underlying git commit succeeded.
tests/e2e/test_source_type_discrimination.py
Add E2E tests for the hook-driven rebuild context-block path, including successful locked-belief injection and empty-input no-op behavior.
  • Lock a distinctive belief, synthesize a Claude-style transcript JSONL for a recent user turn, and run aelf rebuild --transcript through the CLI.
  • Assert the rebuild stdout block contains the distinctive token (case-insensitively), without coupling to rendering format.
  • Add a companion test that runs rebuild against an empty store and empty transcript file and asserts clean exit (return code 0) to guard the hook no-op contract.
tests/e2e/test_hook_inject_roundtrip.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@robotrocketscience has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 56 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a87509e9-8318-42c9-95dc-9cd288075813

📥 Commits

Reviewing files that changed from the base of the PR and between f32ce04 and b60d512.

📒 Files selected for processing (3)
  • tests/e2e/conftest.py
  • tests/e2e/test_hook_inject_roundtrip.py
  • tests/e2e/test_source_type_discrimination.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-334-step2-scenarios

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 56 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In installed_console_script, consider importing and using collections.abc.Callable for the return type instead of the string-annotated "callable[[str], Sequence[str]]" plus # type: ignore[name-defined], so the fixture is properly typed without suppressing type checking.
  • The docstring for test_three_paths_record_distinct_source_types still refers to source_type/belief_corroborations, but the implementation asserts on ingest_log.source_kind; updating the wording to match the actual assertion target would make the intent clearer.
  • In test_three_paths_record_distinct_source_types, the assertion short_hash in commit_proc.stdout or commit_proc.returncode == 0 is redundant because check=True already guarantees returncode == 0; you can simplify this check or drop it if only the non-zero exit status is relevant.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `installed_console_script`, consider importing and using `collections.abc.Callable` for the return type instead of the string-annotated `"callable[[str], Sequence[str]]"` plus `# type: ignore[name-defined]`, so the fixture is properly typed without suppressing type checking.
- The docstring for `test_three_paths_record_distinct_source_types` still refers to `source_type`/`belief_corroborations`, but the implementation asserts on `ingest_log.source_kind`; updating the wording to match the actual assertion target would make the intent clearer.
- In `test_three_paths_record_distinct_source_types`, the assertion `short_hash in commit_proc.stdout or commit_proc.returncode == 0` is redundant because `check=True` already guarantees `returncode == 0`; you can simplify this check or drop it if only the non-zero exit status is relevant.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[claim:review:Setr:2026-05-03T03:25:43Z]

@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[claim:review:Toug:2026-05-03T03:25:47Z]

@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[release:review:Toug:2026-05-03T03:25:52Z]

@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[claim:review:Gylf:2026-05-03T03:26:13Z]

@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[release:review:Gylf:2026-05-03T03:26:18Z]

@yoshi280 yoshi280 added the e2e Trigger E2E workflow on this PR label May 3, 2026
@robotrocketscience
robotrocketscience merged commit b60d512 into main May 3, 2026
20 of 26 checks passed
@robotrocketscience
robotrocketscience deleted the feat/issue-334-step2-scenarios branch May 3, 2026 03:28
@yoshi280

yoshi280 commented May 3, 2026

Copy link
Copy Markdown
Collaborator

[release:review:Setr:2026-05-03T03:28:43Z]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:review Needs review (PR open, awaiting reviewer) e2e Trigger E2E workflow on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants