Skip to content

test(scenarios): replace vacuous clean_stderr invariant and classify lane assertions - #878

Merged
Sinity merged 1 commit into
masterfrom
feature/test/scenario-assertions-857
May 7, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/test/scenario-assertions-857

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

Replace the vacuous _check_clean_stderr showcase invariant (always returned success without checking stderr) and add explicit AssertionClass classification so lanes and assertions are honest about what kind of evidence they provide.

Problem

  • _check_clean_stderr() in polylogue/showcase/invariants.py returned None (pass) for all read commands without actually checking stderr (CliRunner merges stderr into merged output)
  • AssertionSpec() defaulted to exit-code-only with no indication it's a smoke/process check, not semantic proof
  • devtools run-validation-lanes --list didn't distinguish smoke/process lanes from semantic behavior lanes
  • Generated scenario proof evidence raners checked static subject metadata but didn't label themselves as metadata/spec completeness

Solution

  1. Deleted _check_clean_stderr from polylogue/showcase/invariants.py and removed from SHOWCASE_INVARIANTS registry
  2. Added AssertionClass enum (SMOKE_PROCESS, SEMANTIC_OUTPUT, RUNTIME_BUDGET, LIVE_OBSERVABILITY, METADATA_SPEC) to polylogue/scenarios/assertions.py with auto-classification from populated assertion fields
  3. Default AssertionSpec() is SMOKE_PROCESS — exit-code-only default is visibly not semantic proof
  4. Classification shown in lane output — print_lane in devtools/validation_lane_runtime.py now prints assertion: smoke/process
  5. Generated scenario evidence labeled — evidence_note added to three runner functions in polylogue/proof/runners.py noting they check metadata/spec completeness, not executed behavior

Verification

pytest tests/unit/scenarios/test_assertions.py -q         # 9 passed (3 existing + 6 new)
devtools run-validation-lanes --lane machine-contract --dry-run  # shows "assertion: smoke/process"
devtools verify --quick                                    # all gates green

Pre-existing master branch import error (_WorkerProgress) prevents running the full focused test suite (tests/unit/showcase/test_invariants_runtime.py, tests/unit/devtools/test_validation_lanes.py, tests/unit/proof/test_generated_scenario_obligations.py) — this is unrelated and tracked in #866.

Closes #857
Ref #852

Files changed (7)

  • polylogue/scenarios/assertions.py — +AssertionClass, auto-classification, classification_override
  • polylogue/scenarios/__init__.py — export new names
  • polylogue/showcase/invariants.py — delete _check_clean_stderr
  • polylogue/proof/runners.py — evidence_note on generated scenario runners
  • devtools/validation_lane_runtime.py — classification in print_lane
  • tests/unit/scenarios/test_assertions.py — +6 classification tests
  • tests/unit/showcase/test_invariants_runtime.py — remove clean_stderr tests

…lane assertions

- Delete _check_clean_stderr from showcase invariants (always returned
  success without checking stderr, since CliRunner merges stderr into
  output)
- Add AssertionClass enum: SMOKE_PROCESS, SEMANTIC_OUTPUT,
  RUNTIME_BUDGET, LIVE_OBSERVABILITY, METADATA_SPEC
- Auto-classify AssertionSpec from populated fields; default
  AssertionSpec() is SMOKE_PROCESS (exit_code only)
- Show assertion classification in devtools run-validation-lanes output
- Label generated-scenario proof evidence as metadata/spec completeness
  (it checks static subject metadata, not executed behavior)
- Add classification tests and remove _check_clean_stderr tests

Closes #857

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 12 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: eaf7b194-a549-4ecf-b742-45e6afe3d230

📥 Commits

Reviewing files that changed from the base of the PR and between ef45ac2 and 4c48ea9.

📒 Files selected for processing (7)
  • devtools/validation_lane_runtime.py
  • polylogue/proof/runners.py
  • polylogue/scenarios/__init__.py
  • polylogue/scenarios/assertions.py
  • polylogue/showcase/invariants.py
  • tests/unit/scenarios/test_assertions.py
  • tests/unit/showcase/test_invariants_runtime.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/scenario-assertions-857

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 and usage tips.

@Sinity
Sinity merged commit b8d7970 into master May 7, 2026
3 checks passed
Copilot AI review requested due to automatic review settings May 7, 2026 06:22
@Sinity
Sinity deleted the feature/test/scenario-assertions-857 branch May 7, 2026 06:23

Copilot AI 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.

Pull request overview

This PR improves the honesty/clarity of scenario and validation-lane evidence by removing a vacuous showcase invariant and introducing explicit assertion classification that can be surfaced in lane listings and proof evidence.

Changes:

  • Removed the _check_clean_stderr showcase invariant and its associated unit test coverage.
  • Added AssertionClass + auto-classification to AssertionSpec, with payload round-tripping for explicit overrides and new unit tests.
  • Surfaced assertion classification in validation lane listing output, and annotated generated-scenario proof runners with an explicit “metadata/spec completeness” note.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
polylogue/scenarios/assertions.py Adds AssertionClass, auto-classification, override support, and payload parsing/serialization changes.
polylogue/scenarios/__init__.py Re-exports new assertion classification symbols.
polylogue/showcase/invariants.py Removes the vacuous clean_stderr invariant from the invariant registry.
devtools/validation_lane_runtime.py Prints assertion classification when listing non-composite lanes.
polylogue/proof/runners.py Adds evidence_note clarifying that generated-scenario evidence is metadata/spec completeness.
tests/unit/scenarios/test_assertions.py Adds classification and payload round-trip tests.
tests/unit/showcase/test_invariants_runtime.py Removes tests for deleted clean_stderr invariant and keeps nonempty-output skip coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +95 to +96
if self.classification_override is not None:
payload["classification"] = self.classification.value
Comment on lines +155 to +157
except ValueError:
return None
return None
Sinity added a commit that referenced this pull request May 7, 2026
Closes #857. Some scenario / validation-lane checks reported
stronger evidence than they actually produced.
`_check_clean_stderr()` always returned success without
checking stderr (Click runner output is merged), and default
`AssertionSpec()` was exit-code-only with no indication that
it was a smoke check rather than semantic proof.

- Deletes `_check_clean_stderr` from
  `polylogue/showcase/invariants.py` and removes it from the
  `SHOWCASE_INVARIANTS` registry.
- Adds `AssertionClass` enum (`SMOKE_PROCESS`,
  `SEMANTIC_OUTPUT`, `RUNTIME_BUDGET`, `LIVE_OBSERVABILITY`,
  `METADATA_SPEC`) to `polylogue/scenarios/assertions.py`
  with auto-classification from populated assertion fields.
  Default `AssertionSpec()` is `SMOKE_PROCESS` so the
  exit-code-only default is visibly not semantic proof.
- `print_lane` in `devtools/validation_lane_runtime.py`
  shows `assertion: smoke/process` so `run-validation-lanes
  --list` distinguishes smoke from semantic lanes.
- `polylogue/proof/runners.py`: three runner functions gain
  `evidence_note` labelling them as metadata/spec
  completeness, not executed behavior.

Closes #857
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. Mixed direct commit that lands the bulk of the
plg/plog alias and lane-enforcement work plus the daemon
CORS / remote-bind security boundary, sharing files with the
context-pack repair in eedbc1f.

- #825: `pyproject.toml` registers `plg` and `plog` as
  `console_scripts` aliases for `polylogue`, and
  `polylogue/daemon/cli.py` picks up the matching wiring.
- #857: `polylogue/scenarios/assertions.py` and
  `devtools/lane_models.py` add `AssertionSpec.validate()` plus
  `LaneEntry.__post_init__` enforcement that warns when
  `SEMANTIC_OUTPUT` lanes lack stdout assertions, so the
  classification from PR #878 is enforced at build time.
- #868: `polylogue/daemon/http.py` adds `_check_cross_origin()`
  rejecting browser cross-origin POSTs to mutating endpoints,
  and requires an auth token whenever the bind address is not
  loopback.

Boundary note: this is intentionally one cross-cutting commit
rather than three small ones because the lane enforcement and
the CORS check share scenario/handler test fixtures that would
have rebased awkwardly.

Refs #825, #857, #868
Sinity added a commit that referenced this pull request May 7, 2026
Closes #857. Some scenario / validation-lane checks reported
stronger evidence than they actually produced.
`_check_clean_stderr()` always returned success without
checking stderr (Click runner output is merged), and default
`AssertionSpec()` was exit-code-only with no indication that
it was a smoke check rather than semantic proof.

- Deletes `_check_clean_stderr` from
  `polylogue/showcase/invariants.py` and removes it from the
  `SHOWCASE_INVARIANTS` registry.
- Adds `AssertionClass` enum (`SMOKE_PROCESS`,
  `SEMANTIC_OUTPUT`, `RUNTIME_BUDGET`, `LIVE_OBSERVABILITY`,
  `METADATA_SPEC`) to `polylogue/scenarios/assertions.py`
  with auto-classification from populated assertion fields.
  Default `AssertionSpec()` is `SMOKE_PROCESS` so the
  exit-code-only default is visibly not semantic proof.
- `print_lane` in `devtools/validation_lane_runtime.py`
  shows `assertion: smoke/process` so `run-validation-lanes
  --list` distinguishes smoke from semantic lanes.
- `polylogue/proof/runners.py`: three runner functions gain
  `evidence_note` labelling them as metadata/spec
  completeness, not executed behavior.

Closes #857
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. Mixed direct commit that lands the bulk of the
plg/plog alias and lane-enforcement work plus the daemon
CORS / remote-bind security boundary, sharing files with the
context-pack repair in eedbc1f.

- #825: `pyproject.toml` registers `plg` and `plog` as
  `console_scripts` aliases for `polylogue`, and
  `polylogue/daemon/cli.py` picks up the matching wiring.
- #857: `polylogue/scenarios/assertions.py` and
  `devtools/lane_models.py` add `AssertionSpec.validate()` plus
  `LaneEntry.__post_init__` enforcement that warns when
  `SEMANTIC_OUTPUT` lanes lack stdout assertions, so the
  classification from PR #878 is enforced at build time.
- #868: `polylogue/daemon/http.py` adds `_check_cross_origin()`
  rejecting browser cross-origin POSTs to mutating endpoints,
  and requires an auth token whenever the bind address is not
  loopback.

Boundary note: this is intentionally one cross-cutting commit
rather than three small ones because the lane enforcement and
the CORS check share scenario/handler test fixtures that would
have rebased awkwardly.

Refs #825, #857, #868
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.

test(scenarios): replace vacuous invariants and classify lane assertions

2 participants