diff --git a/no-ambient-authority/SKILL.md b/no-ambient-authority/SKILL.md index 3384acc..c0acd44 100644 --- a/no-ambient-authority/SKILL.md +++ b/no-ambient-authority/SKILL.md @@ -1,7 +1,7 @@ --- name: no-ambient-authority description: >- - Use when writing or reviewing code whose functions touch I/O, clocks, random number generators, process.env, fetch, or filesystem; before writing or refactoring any Python script (DisciplinedPython style guide and checker); when someone says "ambient authority", "wash your mouth out", or "that function shouldn't reach for that"; when debating dependency injection or default-arg seams; when asked what OCap discipline is. Source: the Agoric wiki's OCap Discipline page. + Use when writing or reviewing code whose functions touch I/O, clocks, random number generators, process.env, fetch, or filesystem; before writing or refactoring any Python script (DisciplinedPython style guide and checker); when someone says "ambient authority", "wash your mouth out", or "that function shouldn't reach for that"; when debating dependency injection or default-arg seams; when tempted to inject a logger or assert on log output; when asked what OCap discipline is. Source: the Agoric wiki's OCap Discipline page. --- # OCap Discipline @@ -53,12 +53,17 @@ before writing or refactoring a Python script; don't invent conventions. guard, authorities passed by name), standard authority names (`argv`, `cwd`, `stdout`, `connect`, `run`, `urlopen`, `now`), prompt attenuation in `main`, and **status goes through `logging.info(...)` directly**: not - `print`, not `stderr` writes, not an injected logger. + `print`, not `stderr` writes, not an injected logger. Logging is an + operational side effect, not output: tests check `stdout` and return + values, never log records, since correctness doesn't depend on logging. - [disciplined-python-attenuation.md](https://codeberg.org/dckc/awesome-ocap/src/branch/master/style-guide/disciplined-python-attenuation.md): narrowing authority function by function. - Checker: run `~/projects/awesome-ocap/tools/disciplined_python_check.py path/to/script.py` and treat each finding as a bug. It points at matching before/after examples in `tests/fixtures/disciplined_python/{errors,fixed}/`. + Known checker bug: it flags `sqlite3.connect(':memory:')` as DPY010, + but an in-memory database is private to the process, not I/O; leave + that call in place. - Calibration: Python can't enforce a capability boundary (name mangling and introspection get around any wrapper), so for a small script, attenuation that lives mostly in names is fine. An example: a read-only