Skip to content

perf: declare workload receipt adapters for every named measurement path - #4366

Merged
Sinity merged 5 commits into
masterfrom
feature/packet/polylogue-1xc.14
Aug 27, 2026
Merged

Sinity merged 5 commits into
masterfrom
feature/packet/polylogue-1xc.14

Conversation

@Sinity

@Sinity Sinity commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an explicit, exhaustive inventory of the six named measurement paths from this bead's AC #2, each declaring whether it emits the shared WorkloadReceipt or carries an explicit adapter, plus the evidence symbol that proves it. Also makes the pipeline-probe and verify receipts lossless.

Problem

AC #2 required that every named measurement path — query-memory, pipeline-probe, scenario-execution, ingest/source-observation, verify-run, SLO-catalog — either emit the shared receipt or have an explicit adapter/exemption. The adapters existed but the enumeration lived only in bead comments, so adding a seventh measurement path could silently skip receipt emission with nothing to fail.

Separately, tests/unit/scenarios/test_workload_receipts.py imported polylogue.scenarios.workload_adapters, a module that exists on neither this branch nor master. Collection failed with ModuleNotFoundError, so nothing in that file — including the two named incident canaries — had ever run.

Solution

  • WorkloadAdapterDeclaration and the frozen WORKLOAD_ADAPTER_DECLARATIONS tuple in polylogue/scenarios/workload.py, re-exported from polylogue.scenarios; construction rejects incomplete identity or an undeclared disposition.
  • test_named_measurement_paths_have_receipt_or_explicit_adapter pins the exact name set, so a new measurement path without a declaration fails.
  • The test's import pointed at a module name that was never written; the symbols are in workload.py, and the import now names it. This restores collection of the whole file.
  • devtools/verify.py and devtools/pipeline_probe/result.py: receipt emission made explicit and lossless.

Verification

nix develop --accept-flake-config --command devtools test tests/unit/scenarios/test_workload_receipts.py tests/unit/devtools/test_verify.py
  → 32 passed  (was: collection error, 0 run)
nix develop --accept-flake-config --command devtools verify --quick
  → all 17 gates ok

Residual risk

The declaration is an assertion checked against a hand-maintained name set, not derived from the consumers — it proves the six paths are declared, not that each consumer still calls its receipt route. Deriving it from the kernel in polylogue-o21 is the direction; this is the interim form.

AC #5/#6 residuals (anti-vacuity mutations for omitted child RSS, cgroup file cache, cancellation latency, cleanup; bounded-collector non-perturbation) are unchanged by this PR and the bead stays open.

@Sinity
Sinity enabled auto-merge (squash) August 27, 2026 22:40
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 415b24b4-c9b3-4453-84c9-582d409413e9


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c07db927c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/scenarios/workload.py Resolved
Comment thread devtools/pipeline_probe/result.py Resolved
Comment thread polylogue/scenarios/workload.py Resolved
Comment thread polylogue/scenarios/workload.py Resolved
@Sinity
Sinity merged commit ca50749 into master Aug 27, 2026
1 of 2 checks passed
@Sinity
Sinity deleted the feature/packet/polylogue-1xc.14 branch August 27, 2026 22:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c23948a10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/scenarios/workload.py Resolved
Sinity added a commit that referenced this pull request Aug 28, 2026
…ath (#4366)

## Summary

Adds an explicit, exhaustive inventory of the six named measurement
paths from this bead's AC #2, each declaring whether it emits the shared
`WorkloadReceipt` or carries an explicit adapter, plus the evidence
symbol that proves it. Also makes the pipeline-probe and verify receipts
lossless.

## Problem

AC #2 required that every named measurement path — query-memory,
pipeline-probe, scenario-execution, ingest/source-observation,
verify-run, SLO-catalog — either emit the shared receipt or have an
explicit adapter/exemption. The adapters existed but the enumeration
lived only in bead comments, so adding a seventh measurement path could
silently skip receipt emission with nothing to fail.

Separately, `tests/unit/scenarios/test_workload_receipts.py` imported
`polylogue.scenarios.workload_adapters`, a module that exists on neither
this branch nor master. Collection failed with `ModuleNotFoundError`, so
nothing in that file — including the two named incident canaries — had
ever run.

## Solution

- `WorkloadAdapterDeclaration` and the frozen
`WORKLOAD_ADAPTER_DECLARATIONS` tuple in
`polylogue/scenarios/workload.py`, re-exported from
`polylogue.scenarios`; construction rejects incomplete identity or an
undeclared disposition.
- `test_named_measurement_paths_have_receipt_or_explicit_adapter` pins
the exact name set, so a new measurement path without a declaration
fails.
- The test's import pointed at a module name that was never written; the
symbols are in `workload.py`, and the import now names it. This restores
collection of the whole file.
- `devtools/verify.py` and `devtools/pipeline_probe/result.py`: receipt
emission made explicit and lossless.

## Verification

```
nix develop --accept-flake-config --command devtools test tests/unit/scenarios/test_workload_receipts.py tests/unit/devtools/test_verify.py
  → 32 passed  (was: collection error, 0 run)
nix develop --accept-flake-config --command devtools verify --quick
  → all 17 gates ok
```

## Residual risk

The declaration is an assertion checked against a hand-maintained name
set, not derived from the consumers — it proves the six paths are
*declared*, not that each consumer still calls its receipt route.
Deriving it from the kernel in polylogue-o21 is the direction; this is
the interim form.

AC #5/#6 residuals (anti-vacuity mutations for omitted child RSS, cgroup
file cache, cancellation latency, cleanup; bounded-collector
non-perturbation) are unchanged by this PR and the bead stays open.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 1, 2026
…ath (#4366)

## Summary

Adds an explicit, exhaustive inventory of the six named measurement
paths from this bead's AC #2, each declaring whether it emits the shared
`WorkloadReceipt` or carries an explicit adapter, plus the evidence
symbol that proves it. Also makes the pipeline-probe and verify receipts
lossless.

## Problem

AC #2 required that every named measurement path — query-memory,
pipeline-probe, scenario-execution, ingest/source-observation,
verify-run, SLO-catalog — either emit the shared receipt or have an
explicit adapter/exemption. The adapters existed but the enumeration
lived only in bead comments, so adding a seventh measurement path could
silently skip receipt emission with nothing to fail.

Separately, `tests/unit/scenarios/test_workload_receipts.py` imported
`polylogue.scenarios.workload_adapters`, a module that exists on neither
this branch nor master. Collection failed with `ModuleNotFoundError`, so
nothing in that file — including the two named incident canaries — had
ever run.

## Solution

- `WorkloadAdapterDeclaration` and the frozen
`WORKLOAD_ADAPTER_DECLARATIONS` tuple in
`polylogue/scenarios/workload.py`, re-exported from
`polylogue.scenarios`; construction rejects incomplete identity or an
undeclared disposition.
- `test_named_measurement_paths_have_receipt_or_explicit_adapter` pins
the exact name set, so a new measurement path without a declaration
fails.
- The test's import pointed at a module name that was never written; the
symbols are in `workload.py`, and the import now names it. This restores
collection of the whole file.
- `devtools/verify.py` and `devtools/pipeline_probe/result.py`: receipt
emission made explicit and lossless.

## Verification

```
nix develop --accept-flake-config --command devtools test tests/unit/scenarios/test_workload_receipts.py tests/unit/devtools/test_verify.py
  → 32 passed  (was: collection error, 0 run)
nix develop --accept-flake-config --command devtools verify --quick
  → all 17 gates ok
```

## Residual risk

The declaration is an assertion checked against a hand-maintained name
set, not derived from the consumers — it proves the six paths are
*declared*, not that each consumer still calls its receipt route.
Deriving it from the kernel in polylogue-o21 is the direction; this is
the interim form.

AC #5/#6 residuals (anti-vacuity mutations for omitted child RSS, cgroup
file cache, cancellation latency, cleanup; bounded-collector
non-perturbation) are unchanged by this PR and the bead stays open.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 29, 2026
…aps (#5783)

## Summary

Worker 14 of the Codex review-debt batch (devtools parts 1–3: beads
polylogue-1tyq5.42, .43, .44; 75 findings). Five findings are real on
current master and fixed here. A sixth defect, in the same
pipeline-probe function as #4366, is fixed as a sibling. 68 findings are
already fixed on master, 1 is stale, and 1 was not reached.

## Problem

- **#5431 campaign closure (`campaign_closure.py:128`):** closure
membership used the global prerequisite index, but readiness used
`blocks_prerequisites(record)`, which kept only edges stored on the
record whose `issue_id` they name. An edge exported under the
prerequisite's record was dropped, so the dependent task read as
unblocked while its prerequisite was open.
- **#4228 continuity (`continuity_scenarios.py:684`):** the
self-inspection scenario claimed to cover the read-view catalog but
recorded only `capability_declaration_count`. Removing a shipped
viewport profile left the scenario green.
- **#5380 sweep census (`derived_sweep_census.py:436`):**
`sites.setdefault(key, …)` kept the first site under a key. A later
archive-wide `no_where` rewrite of the same table in the same function
was therefore hidden behind an earlier `state_predicate` site.
- **#5315 measurement receipts (`measurement_receipts.py:96`):** empty
keys were not escaped, so `{"": {"latency": 10}}` and `{"latency": 10}`
flattened to the same path and an unexplained shape change was recorded
as `unchanged`.
- **#4366 pipeline probe (`pipeline_probe/result.py:324`):** with only
one RSS component measured, that component was still supplied while both
were declared unavailable, and `WorkloadPhaseObservation` raised.
- **Sibling in the same function:** an unbudgeted probe passed no
aggregate peak, so `peak_rss_bytes` was declared unavailable even though
the paired components produced it. Every ordinary `devtools bench
pipeline` run raised; the existing `test_main_*` tests fail on master.

## Solution

- Readiness reads the same `_prerequisite_index` as closure membership.
`blocks_prerequisites` is deleted.
- `explain(subject="capability")` returns `read_view_profile_ids`: every
profile's `view_id` from `Polylogue.list_read_view_profiles()`. The
scenario compares that list with its fixture oracle. The worker's draft
returned the full profile payloads, which exceeded the MCP response
budget (`response_budget_exceeded`), so the page carries only the
identities. Full metadata stays on the facade and on
`/api/read-view-profiles`. `docs/atlas/mcp.md` documents the field.
- When SQL sites share a key, the census keeps the broadest scope and
that site's location. Only entry order in
`docs/plans/derived-sweep-census.yaml` changes; no classification
changes.
- `_leaves` escapes empty keys and keys containing a quote.
- Both RSS components are omitted unless both were measured.
`peak_rss_bytes` is marked unavailable only when no peak was computed.
- Tests are in the existing module test files, not the worker's
`test_codex_debt_w14.py`. The MCP test is
`tests/unit/mcp/test_explain_read_view_profiles.py`. The self-inspection
oracle now includes `compact`, the profile master added.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w14 --wait`: job 2336, `verify: PASSED exit=0
... head=f040f940bd5e`.
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w14 --wait --
tests/unit/devtools/test_derived_sweep_census.py
tests/unit/mcp/test_explain_read_view_profiles.py
tests/unit/devtools/test_pipeline_probe.py
tests/unit/devtools/test_campaign_closure.py
tests/unit/devtools/test_measurement_receipts.py`: job 2322 at
f040f94, 91 passed.
- The same selection plus
`tests/unit/mcp/test_capability_pointer_routes.py
tests/unit/mcp/test_session_projection_table.py
tests/integration/test_continuity_replay.py`: job 2301 at 31528cf2ff
(the same tree before the last rebase onto #5801), 117 passed.
`test_continuity_replay` passing shows the capability page with profile
ids fits the continuity byte budget.
- Anti-vacuity: the new tests run with the six production files restored
from master (job 2018) and fail. For measurement receipts, the
empty-parent case is the red one. The three pipeline `test_main_*` tests
fail on master's code with `peak_rss_bytes cannot be both observed and
unavailable` (job 2073).

## Self-review

- **Sibling sites:** the pipeline-probe receipt had a second
observed-and-unavailable contradiction (`peak_rss_bytes`), fixed here.
The readiness predicate had one duplicate owner, which is now deleted.
No other caller of `blocks_prerequisites` exists.
- **Cancellation and shutdown:** no loops or long-running work changed.
- **Unbounded reads:** the capability page gains one list bounded by the
declared profile catalog (20 ids), not by archive size. The full profile
payload is not inlined.
- **Fail-open fallbacks:** none. An unmeasured component or peak is
declared unavailable, not guessed.
- **Compatibility shims:** none. `blocks_prerequisites` is removed
rather than kept beside the index. `capability_declaration_count` is
replaced in both the scenario and the oracle.
- **Removed symbols:** nothing in the repo references
`blocks_prerequisites`.
- **Production route:** the campaign test runs `campaign_closure.main
--json`. The measurement test runs `measurement_receipts.main --record`.
The census test runs `census_package`. The probe test runs
`_build_budget_report`, and the existing `test_main_*` tests run
`pipeline_probe.main`. The MCP test calls the registered `explain` tool
with the real facade method and removes `chronicle` from
`READ_VIEW_PROFILES`.

## Findings

| key | disposition | evidence | test |
| --- | --- | --- | --- |
| #5431 campaign_closure.py:128 | fixed | `build_report` uses
`_prerequisite_index` |
`test_campaign_closure.py::test_readiness_uses_edges_attached_to_the_prerequisite_record`
|
| #4228 continuity_scenarios.py:684 | fixed | `server_cutover.py`
`read_view_profile_ids`; scenario fact `read_view_ids` |
`test_explain_read_view_profiles.py::test_self_inspection_detects_removed_viewport_profile_on_mcp_route`
|
| #5380 derived_sweep_census.py:436 | fixed |
`DerivedSweepCensus.observe.record` keeps the worst scope |
`test_derived_sweep_census.py::test_repeated_rewrite_key_keeps_the_broadest_scope_and_its_location`
|
| #5315 measurement_receipts.py:96 | fixed | `_leaves` key escaping |
`test_measurement_receipts.py::test_distinct_payload_shapes_never_flatten_to_one_unchanged_path`
|
| #4366 pipeline_probe/result.py:324 | fixed (plus sibling) |
`_pipeline_workload_receipt` pairs components; peak unavailability
decided after the peak is computed |
`test_pipeline_probe.py::test_budget_receipt_omits_an_unpaired_rss_component`,
`test_main_*` |
| #4585 dev_loop_service.py:378 | not reached | ports are still released
before the child binds them | none |
| #4540 agent_env.py:36 | stale | the `--commit` verify mode no longer
exists | none |
| 68 others | fixed-already | line-cited per finding in the worker
record; spot-checked on master (agent_env zero-worker cap, campaign exit
status, click help passthrough, collection cost child high-water,
command catalog ownership, cold-model grading, census
regex/tiers/regions/bindings/branches/declaration, dev-loop XDG
isolation, throughput receipts, lineage truncation, live proof output,
measurement leaves/paths/envelopes, pattern YAMLs, pytest
evidence/memory/slot/suite-cost, query envelope/memory budget, agent
manual continuation, OpenAPI path normalization) | none |

## Derived-identity closure

None of the changed files is in
`docs/plans/schema-closure-baseline.json`, and the `schema-closure` gate
passes.

## Residuals

- #4585 remains open.
-
`tests/unit/agent_integration/test_manual_contract.py::test_published_examples_use_live_operation_vocabularies_and_preconditions`
fails on master's code as well (`'messages' in {NoneType,
Literal[...]}`). It is unrelated to this change and was left out of the
selection.
- The measurement-receipt cases `quoted-empty-key` and
`quoted-dotted-key` pass on master too. They pin the new escaping's own
consistency; only `empty-parent` is the regression.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

1 participant