Add worker attribution and independent operating records - #11
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour. 📝 WalkthroughWalkthroughThe change adds the PAA Operating Record schema, runtime decoder, append-only SQLite store, conformance fixtures, validation cases, public exports, and documentation. Evidence records gain optional worker attribution with compatibility for the previous schema version. ChangesOperating record contract and conformance
Runtime decoding
Persistence
Documentation and release metadata
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The change adds validated operating records and append-only storage while retaining evidence-record compatibility. No current merge-blocking risk is identified. Sequence Diagram(s)sequenceDiagram
participant Application
participant Decoder
participant OperatingStore
participant SQLite
Application->>Decoder: Decode operating-record JSON
Application->>OperatingStore: Append validated record
OperatingStore->>SQLite: Store immutable record
Application->>OperatingStore: Query by exact subject
OperatingStore->>SQLite: Read records in insertion order
OperatingStore->>Decoder: Validate stored JSON
OperatingStore-->>Application: Return operating records
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🟡 Changes recommended
The operating-record decoder has contract/behavior mismatches (timestamp error path context and integer-vs-float handling) that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends the PAA contract and runtime to support optional worker attribution on evidence records and introduces an independent, append-only operating-record mechanism for subject-linked usage and pricing data that explicitly remains outside authority/motion policy.
Changes:
- Add
paa-operating-record/0.1.0-draftschema + fixtures/invalid-case corpus and runtime decoding + SQLite append-only store. - Extend
paa-evidence-recordto0.2.0-draftwith optionalworker {id, version, configuration_ref}while preserving validity of0.1.0-draftrecords. - Bump package versions / exports and expand conformance + contract-package tests for new artifacts and corpus counts.
File summaries
| File | Description |
|---|---|
| uv.lock | Updates workspace package versions for runtime/contracts. |
| tests/test_operating_store.py | Adds unit tests for append-only SQLite operating-record store behavior. |
| src/paa_runtime/operating.py | Introduces typed wire shapes and a structural JSON decoder for operating records. |
| src/paa_runtime/operating_store.py | Adds SqliteOperatingRecordStore with append-only enforcement via SQLite triggers. |
| src/paa_runtime/init.py | Exposes operating record/store APIs from the runtime top-level and bumps runtime version. |
| schemas/paa-operating-record.schema.json | Adds the new operating-record JSON Schema. |
| schemas/paa-evidence-record.schema.json | Adds evidence schema v0.2.0 with optional worker attribution and backward compatibility. |
| README.md | Documents operating records and clarifies worker/cost boundaries. |
| pyproject.toml | Bumps runtime version and pins paa-contracts>=0.2.0 for conformance extra. |
| packages/paa-contracts/uv.lock | Bumps contract package version to 0.2.0. |
| packages/paa-contracts/tests/test_contracts.py | Updates schema/fixture/case-count assertions to include operating records and worker negatives. |
| packages/paa-contracts/src/paa_contracts/init.py | Adds operating schema ID, fixtures accessor, case-kind, and bumps contract package version. |
| packages/paa-contracts/README.md | Updates contract package docs for the new schema and revised evidence record. |
| packages/paa-contracts/pyproject.toml | Bumps contracts version/description to reflect five schemas. |
| package.json | Bumps npm contracts package version/description to 0.2.0. |
| PAA.md | Updates architecture doc to include operating accounting and worker attribution context. |
| examples/runtime-conformance/operating-records/zero-price.json | Adds an operating-record positive fixture (explicit zero price). |
| examples/runtime-conformance/operating-records/task-priced.json | Adds an operating-record positive fixture (task attempt). |
| examples/runtime-conformance/operating-records/pipeline-summary.json | Adds an operating-record positive fixture (summary + components). |
| examples/runtime-conformance/operating-records/failed-unavailable.json | Adds an operating-record positive fixture (unavailable usage/price). |
| examples/runtime-conformance/invalid/operating-cases.json | Adds operating-record structural invalid-case table. |
| examples/runtime-conformance/invalid/evidence-cases.json | Extends evidence invalid-case table with worker-related negatives and formatting updates. |
| examples/runtime-conformance/evidence-records/evidence/paa/421d1e7672aa1fa96ff2426a4b242d711a25cf23f27160accabcca25abc515fa/evidence.json | Adds a worker-attributed evidence fixture under v0.2.0-draft. |
| conformance/test_operating_records.py | Adds conformance checks for operating records + worker schema alignment + motion independence. |
| conformance/test_evidence_integrity.py | Updates evidence fixture discovery count. |
| conformance/test_corpus_integrity.py | Updates corpus enumeration and pinned counts to include operating cases/fixtures. |
| conformance/_corpus.py | Registers operating invalid-case kind -> schema mapping. |
Review details
Suppressed comments (1)
src/paa_runtime/operating.py:168
declaration_versionis defined as anintegerin the JSON Schema, but the decoder currently accepts floats like1.0and silently coerces them toint. This diverges from the contract and can make the decoder/store behavior non-lossless (e.g., storing1.0but returning1). Require an actual JSON integer (Pythonint, excludingbool) instead of acceptingfloat.
version = record["declaration_version"]
_quantity(version, "/declaration_version")
if not isinstance(version, (int, float)) or version < 1 or int(version) != version:
_fail("/declaration_version", "expected a positive integer")
record["declaration_version"] = int(version)
- Files reviewed: 25/27 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def _timestamp(value: object, path: str) -> None: | ||
| stamp = _text(value, path) | ||
| pattern = ( | ||
| r"[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt](?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]" | ||
| r"(?:\.[0-9]+)?(?:[Zz]|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])" | ||
| ) | ||
| if re.fullmatch(pattern, stamp) is None: | ||
| _fail(path, "expected an RFC 3339 date-time with timezone") | ||
| datetime.fromisoformat(stamp.upper().replace("Z", "+00:00")) |
There was a problem hiding this comment.
Fixed in 22e63ac. Calendar-date parsing errors now retain the exact /timestamps/ path. Regression coverage checks malformed offsets, invalid times, and impossible calendar dates across started_at, completed_at, and recorded_at. All 811 tests, Ruff, and strict mypy pass locally.
Summary
Second PR in the economic-fitness work following https://github.com/RankOneLabs/paa_site/pull/115.
worker {id, version, configuration_ref}topaa-evidence-record/0.2.0-draft. Existing 0.1.0 records remain valid without worker attribution and retain their exact content addresses.paa-operating-record/0.1.0-draftcontract, with open usage/component vocabulary, explicit unavailable measurements, price bases, exact subject/task/scope/configuration attribution, and retained constituent source references.OperatingRecordStore/SqliteOperatingRecordStore, retrievable by exact subject kind and ID. Duplicate record IDs and storage-level mutation are rejected.Confirmed storage decision
The runtime currently retains evidence as content-addressed files, not a database evidence-record log. This PR therefore adds a separate operating-record store, which may use a sibling table in the existing database or a separate database. The existing evidence storage, EventStore protocol, and motion service remain unchanged.
Boundaries
Verification
uv sync --locked --extra conformancesucceeds.git diff --checkpasses.Summary by CodeRabbit
New Features
Documentation
0.4.0/0.2.0.