Skip to content

Repository files navigation

Assignment 7 — Curve fitting and executable skills

Tests

Assignment 6 implemented least squares with NumPy. Here you will use SciPy for the engineering calculation and make an agent's submission workflow executable. The main agent exercise is scripting the existing submission skill. Repairing an inherited instruction is a short prerequisite, not the main deliverable.

1. Audit inherited instructions (brief)

The starter's AGENTS.md deliberately retains Assignment 6's mathematical-method paragraph: normal equations, a ban on curve_fit, and mirrored observations. Those directions conflict with the Assignment 7 specification below. Ask your agent to identify that specific conflict and propose a small diff. Review and explicitly approve the repair before it edits the instructions or fitting code. Do not ask it to silently disregard its instructions or rewrite unrelated rules. The completed instructor reference has this paragraph repaired.

2. Engineering task

The supplied KozenyCarmen.__init__ in assignment7.py reads poro_perm.csv into self.df. Leave this reader and the CSV unchanged. Implement these two methods using scipy.optimize.curve_fit, with a lambda defined inside each method:

  • fit(): fit $k(\phi)=\kappa_0+m\phi^3/(1-\phi)^2$. Return the fitted parameter NumPy array of shape (2,), ordered [intercept, slope], not covariance.
  • fit_through_zero(): fit $k(\phi)=m\phi^3/(1-\phi)^2$ directly. Return the NumPy array of shape (1,), not a scalar. Do not mirror observations or fit an intercept and subsequently discard it.

Use the original porosity and permeability columns without changing the data frame. Course-data results are approximately [10.5933127, 23517.3520] and [26133.9297]. These preserve Assignment 7's original interfaces; Assignment 6's scalar return for its different through-origin implementation is not the contract here.

3. Main exercise: turn a prose skill into a script

You receive .github/skills/submit-assignment/SKILL.md, the existing prose submission procedure, updated to name Assignment 7. You do not receive a completed script. Ask the agent to propose a parameterized Python standard-library script at .github/skills/submit-assignment/scripts/submit.py and a shorter skill that invokes it and interprets its output. Review the interface and failure behavior, then approve implementation. Do not merely add another checklist for the model to follow.

The script owns the mechanical checks, staging, commit and push. The agent explains results and asks you to resolve failures; it does not improvise replacement commands. Use the supplied, protected submission-policy.json for the assignment identifier, exact deliverables, fixed test modules and commit message. Reject an unknown assignment; do not accept arbitrary test commands or a caller-selected file allowlist.

Required interface (run from the repository root):

python .github/skills/submit-assignment/scripts/submit.py --assignment assignment7
python .github/skills/submit-assignment/scripts/submit.py --assignment assignment7 --dry-run
python .github/skills/submit-assignment/scripts/submit.py --assignment assignment7 --execute

Default and --dry-run validate and report a plan but never stage, commit or push. --execute is the explicit submission request. These modes are mutually exclusive. There are no bypass-test, force-push, no-verify, arbitrary-shell-command or allowlist flags.

Required behavior

  1. Inspect staged, unstaged and untracked changes (including both sides of renames). Reject any protected/unexpected path, including one already staged. Reject deleted or symlinked deliverables; do not hide changes or silently reset the index.
  2. Run the fixed public tests and both working-tree and staged whitespace checks. Stop on any failure before staging, committing or pushing. Check the paths again after tests. Failures must produce a nonzero exit status with an actionable reason.
  3. Stage only the four exact deliverables, then recheck the index. Commit with the configured message only if there are staged changes. Never create an empty commit.
  4. Use the current named branch and origin; reject detached HEAD. Push normally (no force) and verify the remote branch SHA equals the local commit. Report commit or push failure honestly. A failed push may leave a valid local commit; rerunning should push that commit without manufacturing another one.
  5. Report the final commit and worktree state. Report GitHub Actions for that exact SHA separately: success only for completed successful checks; distinguish failure, pending/no run yet, and unavailable (for example no authentication/network). A successful push is not proof of CI success. Local tests must need no GitHub access.

The public test_submission.py harness runs the script against disposable repositories and a local bare remote, never your real course repository. The script's inner validation must avoid recursively running this harness: set SUBMISSION_VALIDATION=1 only for its fixed unittest subprocess; the harness skips itself in that subprocess. This is an internal recursion guard, not a security boundary or a user-facing option to skip engineering tests. Unset it for the outer/full test run (as shown below).

Test, review, submit

env -u SUBMISSION_VALIDATION python -m unittest -v
# Instructor environment additionally runs its private suite.
git diff --check

Initially the supplied-reader checks pass. Fitting/method checks fail on the two intentional stubs; script behavior checks fail until you create the script. The instruction/skill artifact checks fail until the approved repair/refactor is complete. Do not weaken tests to change this baseline. Passing tests support the review but do not replace your responsibility to inspect the script and approve instruction changes.

The four student-editable deliverables are:

  • AGENTS.md (approved stale-method repair)
  • assignment7.py (two fitting methods)
  • .github/skills/submit-assignment/SKILL.md (short invocation/result handling)
  • .github/skills/submit-assignment/scripts/submit.py (main agentic deliverable)

Everything else is protected. No conversation transcript or extra evidence report is required. When ready, ask the agent to submit assignment 7. Review its dry-run result, then explicitly authorize execution. The exercise is formative: focus on moving repeatable behavior into code and keeping human review at the decision points.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages