Files
cs249r_book/interviews/vault-cli/pyproject.toml
Vijay Janapa Reddi 4aae33c036 test+ci: green test matrix + lint-clean + real vitest + committed lockfile
LOCAL TEST RESULTS (all green):
  pytest:  34 passed in 0.19s (28 existing + 6 new command tests)
  ruff:    All checks passed  (0 errors)
  vitest:  7 passed in 127ms (worker contract tests)
  CLI e2e: vault --version / build / verify / stats / doctor / diff /
           export-paper / ship --dry-run / publish + verify rc1 / api shim
           via curl against 9199-question corpus — all green

Python-side fixes:
- interviews/vault-cli/pyproject.toml: ruff config now has principled
  per-file-ignores for B008 (Typer pattern), N806 (DAG cycle colors),
  E402 (scripts), SIM118 (sqlite3.Row iterator). Keeps signal tight.
- 13 real ruff violations fixed across authoring.py (contextlib.suppress),
  diff_cmd.py + serve_api.py (dict(sqlite3.Row) instead of broken
  .keys() iteration), policy.py (direct return), release.py (zip
  strict=True, update_latest_symlink now validates target exists;
  previous 'target' variable was unused), commands/release.py
  (import order reshuffled, ambiguous 'l' renamed).
- commands/release.py ship_cmd leg-skip uses 'leg' not 'l'.

New pytest file: interviews/vault-cli/tests/test_commands.py (+6 tests)
  - stats: JSON shape + Prometheus format.
  - diff: add/remove/modify detection + classification.
  - doctor: graceful skip on missing vault; unknown --check returns
    USAGE_ERROR.
  - codegen: --check passes against baseline.

Worker-side fixes:
- src/index.ts cachedOrCompute graceful-degrades when caches global
  isn't available (Node test env, future-proofing against runtime
  regressions).
- src/index.ts handleSearch: 'query: q' → 'query: qRaw' (q was
  renamed earlier).
- src/rate_limit.ts: removed unused WINDOW_MS const.
- tests/worker.test.ts: vi.resetModules() between tests so
  module-level schemaOk/lastSeenRelease state doesn't leak
  across test cases (fingerprint memoization was sticky).
- package.json: added test:watch + lint aliases.
- .gitignore: node_modules, .wrangler, dist, .dev.vars.
- package-lock.json committed (npm — pnpm not on the machine; CI
  updated to use npm ci).

CI (.github/workflows/vault-ci.yml):
- Split into python + worker jobs.
- Python job: ruff + mypy (non-blocking) + pytest + vault check
  --strict + vault build release_hash regression + vault codegen
  --check + registry append-only + exemplar audit staleness.
- Worker job: node 20 + npm ci + tsc typecheck + vitest run.
- Triggers now include staffml-vault-types path (keeps CI honest
  when shared-types drift).

What runs vs what's gated on user:
  RAN LOCALLY: pytest, ruff, vitest, tsc, CLI end-to-end smoke
              (build→verify→export→stats→doctor→diff→publish
              rc→api-shim→ship --dry-run), full corpus invariants.
  GATED ON USER (requires Cloudflare credentials):
    - wrangler login + wrangler d1 create
    - wrangler d1 execute (schema + seed)
    - pnpm/npm deploy:staging
    - FTS5 production load-test
    - vault ship --env production (live D1 + Next.js + tag push)

Everything that CAN be verified without credentials HAS been.
2026-04-16 14:30:20 -04:00

87 lines
2.6 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "staffml-vault"
version = "0.1.0"
description = "CLI for the StaffML question vault — authoring, building, and releasing the corpus."
readme = "README.md"
requires-python = ">=3.12"
authors = [{ name = "Vijay Janapa Reddi" }]
license = { text = "MIT" }
keywords = ["staffml", "vault", "ml-systems", "interviews"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Database",
]
dependencies = [
"typer>=0.12",
"rich>=13",
"pydantic>=2.7",
"pyyaml>=6",
"click>=8",
]
[project.optional-dependencies]
dev = [
"pytest>=8",
"pytest-cov>=5",
"pytest-timeout>=2",
"mypy>=1.10",
"ruff>=0.5",
]
[project.scripts]
vault = "vault_cli.main:app"
[project.urls]
Homepage = "https://staffml.mlsysbook.ai"
Architecture = "https://github.com/harvard-edge/cs249r_book/blob/dev/interviews/vault/ARCHITECTURE.md"
Review-Ledger = "https://github.com/harvard-edge/cs249r_book/blob/dev/interviews/vault/REVIEWS.md"
[tool.hatch.build.targets.wheel]
packages = ["src/vault_cli"]
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-x --strict-markers --timeout=60"
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "W", "I", "B", "UP", "N", "SIM"]
ignore = [
"E501", # line-length handled by formatter
"B008", # function-call-in-default-argument — this is THE Typer idiom
# (`typer.Option(...)` / `typer.Argument(...)` at parameter
# default position). Lint doesn't know that.
"UP042", # replace-str-enum — Python 3.12 StrEnum differs semantically;
# our (str, Enum) mixins stay for explicit behavior.
]
[tool.ruff.lint.per-file-ignores]
# Scripts that run standalone insert sys.path before importing vault_cli;
# that's intentional so they work both as modules and as scripts.
"scripts/*.py" = ["E402"]
# Cycle-detection colors WHITE/GRAY/BLACK are a conventional constant set,
# and are local to one function.
"src/vault_cli/validator.py" = ["N806"]
# sqlite3.Row iterates as values, not keys; SIM118 fires a false positive.
"src/vault_cli/commands/diff_cmd.py" = ["SIM118"]
"src/vault_cli/commands/serve_api.py" = ["SIM118"]
[tool.mypy]
python_version = "3.12"
strict = true