Workspace/Mini projects
Loading progress
All mini projects
MODULE 25 · 7 HOUR BUILD

A patch evidence workbench

Build a local workbench that indexes Python source, proposes impacted tests, and assembles a review packet containing the reproduction, patch, instructions used, and verification results.

Build evidence Record your actual checks, results, and limitations.

Build it in stages

  1. Run the trusted in-memory seed and inspect its symbol inventory and regression result.
  2. Add read-only repository discovery with ignored directories, parse-error reporting, and source revision identifiers.
  3. Extract imports and add explicit configuration for dynamic dependency edges.
  4. Implement a proposed-patch view that preserves the baseline and checks applicability before mutation.
  5. Run meaningful regression checks in an isolated worker and capture bounded, redacted results.
  6. Generate a review packet listing changed behavior, instruction bundle versions, tests run, and unresolved limitations.

Your acceptance criteria

Use these as your project review. Record commands, outputs, and failure cases in your repository.

  • The original regression fails before the patch and passes after it.
  • The workbench preserves existing unrelated workspace changes.
  • Every selected or omitted test has an explainable dependency basis, with documented gaps.
  • No success claim is emitted without corresponding current verification evidence.

A working starting point

The seed runs as supplied. Extend it to satisfy the full brief. It is a teaching starting point, not a finished portfolio submission.

main.py
python
import ast
import hashlib

BEFORE = "def count_at_least(values, threshold):\n    return sum(v > threshold for v in values)\n"
AFTER = "def count_at_least(values, threshold):\n    return sum(v >= threshold for v in values)\n"
CASES = [([4, 5, 6], 5, 2), ([], 5, 0), ([5, 5], 5, 2)]

def symbols(source):
    tree = ast.parse(source)
    return sorted(node.name for node in tree.body
                  if isinstance(node, (ast.FunctionDef, ast.ClassDef)))

def verify_trusted_fixture(source):
    namespace = {}
    exec(compile(source, "<trusted-seed>", "exec"), namespace)
    function = namespace["count_at_least"]
    return [index for index, (values, threshold, expected) in enumerate(CASES)
            if function(values, threshold) != expected]

def review_packet(before, after):
    return {
        "symbols": symbols(after),
        "changed": before != after,
        "before_failures": verify_trusted_fixture(before),
        "after_failures": verify_trusted_fixture(after),
        "source_digest": hashlib.sha256(after.encode()).hexdigest(),
    }

def main():
    packet = review_packet(BEFORE, AFTER)
    print("TRUSTED FIXTURE SIMULATION")
    print("symbols:", packet["symbols"])
    print("changed:", packet["changed"])
    print("before failures:", packet["before_failures"])
    print("after failures:", packet["after_failures"])
    print("verified cases:", len(CASES))

if __name__ == "__main__":
    main()

Push it further

Add an agent that selects navigation tools under a token budget, then evaluate whether its evidence map predicts the files and tests a human reviewer considers relevant.