feat(finops): add bounded usage evidence authority - #315
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Fresh gate refresh (2026-08-28): keep this PR Draft and unchanged at exact contributor head Two control-plane facts have materially changed since the body snapshot:
Fresh pg-side state is otherwise unchanged: #233 remains the earliest repo-wide coverage dependency; this PR has no formal reviews or review threads; current CI is still non-passing at the repository-wide 100% gate while Release Acceptance is success. Do not churn source, duplicate #233, mark Ready, or rerun old evidence as if it used newer central workflow code. Re-evaluate only after material protected-central or #233 change. |
Bounded acquisition slice for #312
This Draft started from exact protected
main@b84f0c94154043a3473939c01bb6471de5a129aeon explicit non-default branchfeat/usage-evidence-authority-b84f0c9. Protected main was not mutated. Current exact contributor head remainsc990318345013ef24a619eff07f9f3bbb5698a2a(tree4ffc56501d7bb6b4f010c752aaa93d7f70e84bf4); the PR changes onlypg_llm_batch/usage_evidence.pyandtests/test_usage_evidence.py. Fresh formal-review and inline-thread inventories remain empty.Contract
The bounded first slice defines a closed usage-authority vocabulary (
LOCAL_MEASURED,PROVIDER_REPORTED,HOST_RATE_ESTIMATE,RECONCILED), trusted caller-supplied tenant scope, bounded opaque identifiers and exact non-negative signed-bigint counts, deterministic canonical JSON plus SHA-256 evidence identity, explicit null optional dimensions, and provenance distinction across authority/source identity. It fails closed on open authority strings, booleans-as-integers, non-integer/negative/oversized counts, behavior-bearing objects, and unbounded/content-bearing identifier forms.No pricing arithmetic, provider call, persistence, filesystem/environment read, logging, telemetry, schema, workflow, package metadata, canonical documentation, migration, or existing runtime module is changed.
Test-first / exact-head product evidence
26b885bbec3aa64579f75ec2a3742540863f59c4changed onlytests/test_usage_evidence.py; production module was absent. CI33066304934failed becausepg_llm_batch.usage_evidencedid not exist.fc80cd5f1095cb77788fc4da6c6fa9cc3339557cadded only the production module; tests passed until the repository's 100% public-docstring contract exposed four undocumented private validators.c990318345013ef24a619eff07f9f3bbb5698a2aadds only those helper docstrings. Exact-head CI33066647287proves lint success, 100% public docstrings,1354 passed, 5 deselected, Python 3.12/3.14 unit success, container/PostgreSQL smoke success, and exact 100% statement/branch coverage forusage_evidence.pyitself (41statements /14branches, zero misses/partials).Repository-wide coverage remains non-passing at 99.96% solely because protected main still carries the two weakref-registry arcs owned by dependency root #233. #315 must not duplicate #233's tests merely to manufacture aggregate 100%.
Release Acceptance
33066647102is genuine exact-source evidence for current headc990318...: exact SHA checkout/verification, Python 3.14.7, uv 0.12.3, two clean builds, and reproducible wheel/sdist identity.Security / SAST exact-source boundary
Historical #315 Security Scan
33066647057and SAST Semgrep33066647163concluded green but their actual jobs checked out syntheticrefs/pull/315/merge@61d6c1c0c68f784b0990508230be2c3468ecc304, not contributor headc990318.... They remain negative-control evidence only. Final acceptance must reacquire Security/SAST whose actual scanner workspace binds the final contributor head after legitimate dependency/base reconciliation.Strix source-bearing RCA — attempts 3 and 4 are historical
Attempt 3 of workflow run
33066645588/ job99167889678bound the exact pg base/head, provisioned contextual-orchestrator, passed loopback gateway/provider-route/chat preflights, installed Strix 1.5.3 and materialized one source file, then failed before authoritative vulnerability analysis because the then-protected wrapper rejected the trusted process-local route:ERROR: LLM_API_BASE must be an https URL when configured.That transport-classification defect was repaired by protected central
.github#1413merge9550c18b52468f4e886fdf6e4e1370ae23313229. Attempt-3 artifactstrix-reports, ID9722240104, SHA-25604f14c12a6ea12d7a1dcab6f4d160202cc0e460995e0d928f60ff995fb32498d, remains RCA evidence only.Attempt 4 of the same workflow run, exact job
99217157204, is terminal failure. Exact target materialization, trusted-source checkout, required-workflow self-test, credential gating, contextual-orchestrator provisioning, health/provider/chat preflight, Strix installation and one-file source scope all succeeded. The actual scan then failed before an authoritative vulnerability verdict because OpenAI Agents sentstream_options.include_usage=trueto/v1/chat/completionsand the vendored gateway returned deterministic400 invalid_stream_optionson all three bounded attempts. The required gate correctly failed closed asSTRIX_PROVIDER_UNAVAILABLE; zero displayed findings and zero tokens are not vulnerability-clearance evidence. Attempt-4 artifactstrix-reports, ID9727781092, SHA-2562ccabb851bffdb857a9f85af88f19793f9cdfd115169b46af185c687abf67c54, is RCA evidence only.The decisive source-identity fact is that attempt 4 remained bound to trusted workflow source
.github@9550c18b52468f4e886fdf6e4e1370ae23313229, whose sidecar vendored contextual-orchestratorb21645116b352967e50fc497b87eb745b9cc8c61. Re-running33066645588again would repeat that stale protocol boundary and is intentionally forbidden as a no-op.Protected central authority has since moved. The protected transition through
.github#1422mergec48859ac3919f1e7d2f24e744e5c551b94e66ac2advanced the vendored contextual-orchestrator lineage to one containing merged contextual-orchestrator #914 (e7618a3f144fcf63b4b9d84e0335ac85f6d24278), which implements the/v1/chat/completionscompatibility contract acceptingstream_options.include_usage=truewhile retaining unsupported-option fail-closed behavior. That historical transition does not by itself prove current end-to-end sidecar/provider availability. Exact current trusted.githubsource, vendored orchestrator pin, live dependency tip, provider discovery state, and review/scan runtime health are mutable control-plane identities and belong only in #244 plus fresh read-only central reads; do not freeze them into this Draft's product contract.Accordingly, attempt 4 is superseded control-plane RCA, not a current pg product finding. A meaningful Strix re-test must be a new workflow invocation under then-current protected central source, not another rerun of the old run. Do not manufacture that event through source/head churn, Draft toggling, close/reopen, or duplicate control-plane activation.
Dependency root #233
#233 remains unchanged at exact
5951b7a4d779903b8924abaef2a387cae50b7f54against protectedmain@b84f0c94154043a3473939c01bb6471de5a129ae. It owns the two aggregate-coverage arcs and has fresh exact-contributor-head CI, Release Acceptance, Trivy, Semgrep, and bounded Strix evidence.It remains non-merge-ready because its active same-head OpenCode formal state is the legacy
CHANGES_REQUESTED, that disposition has not been superseded by a genuinely fresh authenticated semantic review, and no qualifying independent approval exists. Fresh exact-headcoverage-evidencesuccess and a green verifier that confirms the current formal verdict exists do not retroactively turn that verdict into approval. Mutable reviewer/scheduler/control-plane truth belongs in pg #244.Keep #315 Draft and source/head-stable while #233 is unintegrated. After #233 integrates or is genuinely superseded, reconcile #315 non-destructively to then-current protected main. That legitimate synchronization is the correct event boundary for a new Strix execution under current central authority and for reacquiring all invalidated exact-head/current-base evidence.
Writer boundary
Fresh refetch immediately before this metadata repair confirmed branch
feat/usage-evidence-authority-b84f0c9still resolves to exactc990318..., protected main remains exactb84f0c9..., formal reviews and inline threads are empty, and #316 still classifies this branch as the active writer for its two source/test paths. This metadata-only update changes no source, docs, branch ref, workflow, or protected-main tree.Before any future source mutation, repeat the complete open-PR/no-PR path-overlap inventory and freeze if another writer moves onto the same surface.
Draft exit / acquisition acceptance
Do not mark Ready or merge until one unchanged final head freshly proves all of the following:
The usage-evidence primitive is not billing settlement, provider truth, certification, or reconciliation-completeness authority. Mutable central state must be freshly read from #244 and the live read-only central repository.
ContextualWisdomLab/.github#1222is a closed/completed historical exact-source acceptance tracker, not an active prerequisite.Refs #312, #244, #233, #311, #316; protected central transitions
.github#1413,.github#1422; contextual-orchestrator #914.