Skip to content

feat: scaffold Week 6 assignment (Deploy to Azure)#1

Merged
lassebenni merged 2 commits into
mainfrom
feat/scaffold-week6-assignment
Jun 3, 2026
Merged

feat: scaffold Week 6 assignment (Deploy to Azure)#1
lassebenni merged 2 commits into
mainfrom
feat/scaffold-week6-assignment

Conversation

@lassebenni
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the empty task-1 / task-2 placeholder stubs with a real scaffold derived from Data Track/Week 6/week_6__8_assignment.md.
  • Students build a Container App Job pipeline that uploads raw JSON to Azure Blob Storage and upserts rows into Azure Database for PostgreSQL, then verify the deployment with an Execution-history screenshot.
  • Auto-grader verified end-to-end against a local working solution: scaffold = 13/100 (pass=false), working solution = 100/100 (pass=true).

Why static analysis (no live Azure check)

The Week 6 assignment requires live Azure resources (Storage Account, Postgres flexible server, ACR, Container Apps environment) that the GitHub Actions runner cannot reach without credentials. The grader therefore verifies code shape, not deployment success: the patterns Chapters 3-5 teach (env-var reads, contextlib.closing(), the ON CONFLICT ... DO UPDATE upsert, sslmode=require, BlobServiceClient usage, the azure SDK logger silencing) plus the artefact deliverables (AI report, Execution-history screenshot, README Verification section).

Scoring ladder (100 pts total, passing 60)

Points Level What the grader checks
10 1 Required files exist (Dockerfile, requirements.txt, src/pipeline.py, AI_ASSIST.md, README.md, docs/)
10 2 requirements.txt pins azure-storage-blob AND psycopg2-binary (5 pts each)
10 3 Dockerfile uses python:3.11 base, copies requirements before src, has a real CMD (3 + 5 + 2)
15 4 pipeline.py reads both env vars (5), wraps with closing() (5), silences azure logger (5)
15 5 pipeline.py has ON CONFLICT ... DO UPDATE (10) and %s placeholders inside execute(...) (5)
10 6 Repo mentions sslmode=require (5) and pipeline imports BlobServiceClient (5)
10 7 AI_ASSIST.md has all 3 sections AND ≥ 1800 chars AND no TODO lines (all-or-nothing)
10 8 README has ## Verification heading AND embeds an image from docs/ (all-or-nothing)
10 9 docs/execution_history.{png,jpg,jpeg} exists and is > 5000 bytes (PNG full, JPG half)

Test plan

  • Scaffold (bare): 13/100, pass=false (Level 1 + Dockerfile base image only)
  • Working solution at ~/Documents/github/hyf/data-assignment-week-6-test: 100/100, pass=true
  • Grader runs cleanly (exit 0) in both cases
  • Scoring ladder is monotonic: every Level the solution passes scores full points
  • No scaffold comment / docstring accidentally pre-satisfies a grep check (verified by the 13-point ceiling)
  • Code patterns verified: os.environ[...], from contextlib import closing, with closing(, logging.getLogger("azure").setLevel, ON CONFLICT, DO UPDATE, %s in multi-line execute(...), sslmode=require, BlobServiceClient

Build workflow followed: .agents/workflows/build_assignment_repo.md.

🤖 Generated with Claude Code

Replaces the empty template stubs with a real scaffold derived from
`Data Track/Week 6/week_6__8_assignment.md`. Students implement a Container
App Job pipeline that uploads raw JSON to Azure Blob Storage and upserts
rows into Azure Database for PostgreSQL.

Layout
- `src/pipeline.py`: `raise NotImplementedError` stubs for the three
  pipeline functions (config, blob upload, Postgres upsert) plus a `run()`
  orchestrator.
- `Dockerfile`: cache-friendly starter with TODO comments for the layer
  order students must complete.
- `requirements.txt`: TODO entries for `azure-storage-blob` and
  `psycopg2-binary` pins.
- `AI_ASSIST.md`: section headers + TODO placeholders for Task 7.
- `.env.example`: connection-string template with placeholders only.
- `docs/`: target folder for the Task 5 Execution-history screenshot.

Autograder (`.hyf/test.sh`)
Static-analysis only. Azure deployment is unverifiable in CI (no
credentials), so the grader checks code shape, not live deployment:
required files, pinned deps, Dockerfile layer order, env-var reads,
`contextlib.closing()`, azure SDK logger silencing, `ON CONFLICT ... DO
UPDATE` upsert with `%s` placeholders, `sslmode=require`,
`BlobServiceClient` import, AI report fill-in, README `## Verification`
heading + embedded `docs/` image, screenshot presence.

Verified locally
- Bare scaffold: 13/100, pass=false.
- Working solution (clone at `~/Documents/github/hyf/data-assignment-week-6-test`):
  100/100, pass=true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

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

Scaffolds the Week 6 “Deploy to Azure” assignment repository, including a starter pipeline module plus an autograder that performs static checks (no live Azure access) for expected implementation patterns and deliverables.

Changes:

  • Added Week 6 starter files: src/pipeline.py stubs, Dockerfile, requirements.txt, .env.example, AI_ASSIST.md, and docs placeholder.
  • Replaced placeholder README with Week 6-specific instructions and local-grading guidance.
  • Implemented a points-based autograder in .hyf/test.sh with shared helpers in .hyf/grader_lib.sh.

Reviewed changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pipeline.py Adds the scaffold pipeline with NotImplemented stubs and logging setup.
src/__init__.py Marks src/ as a package for python -m src.pipeline.
requirements.txt Scaffold for pinned deps students must fill in.
Dockerfile Scaffold for a cache-friendly container image students must complete.
README.md Assignment overview + steps + local grading + verification instructions.
AI_ASSIST.md Template for the required AI usage report.
.env.example Template for required env vars (Postgres + Blob connection strings).
docs/.gitkeep Keeps docs/ tracked for the required screenshot deliverable.
.gitignore Simplifies ignore rules for Python + secrets + grader output.
.devcontainer/devcontainer.json Codespaces/devcontainer baseline with Azure CLI + Docker-in-Docker.
.hyf/test.sh New autograder script implementing the scoring ladder.
.hyf/grader_lib.sh Shared helper functions used by the autograder.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .hyf/test.sh Outdated
Comment thread .hyf/test.sh Outdated
- Level 2 psycopg2 pin check no longer accepts bare `psycopg2==...`.
  The python:3.11-slim base image lacks libpq-dev and gcc, so the
  source dist fails to build; accepting it gave students credit for
  a requirements.txt that immediately broke `docker build`.
- Level 4a env-var check no longer counts matching lines. Two
  independent `grep -q` calls accept any valid read pattern
  (separate lines, one-line tuple read, dict comprehension), so the
  grader stops false-failing correct submissions.
@lassebenni lassebenni merged commit 567d99c into main Jun 3, 2026
@lassebenni lassebenni deleted the feat/scaffold-week6-assignment branch June 3, 2026 20:01
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.

2 participants