Skip to content

feat: Declare browser-capture outside the schema-inference denominator - #5223

Merged
Sinity merged 1 commit into
masterfrom
schema/tnqqt-browser-capture-exclusion
Sep 18, 2026
Merged

Sinity merged 1 commit into
masterfrom
schema/tnqqt-browser-capture-exclusion

Conversation

@Sinity

@Sinity Sinity commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

browser-capture is a format this repository authors — browser-extension/
writes it and polylogue-browser-capture-native-host reads it. Its shape is a
decision changed together with its writer, not evidence to discover from a
corpus. It should never have been a schema-inference subject.

Problem

source_inference.py refused every browser-capture candidate at preflight with
browser_capture_adapter_unavailable — a reason that reads as unfinished work,
and one that produced a non-empty refused denominator: 1,243 members in the
recorded frontier.

"We refused all 1,243" and "there were zero eligible" are different claims.
Only the second is proof of non-applicability. The first invites someone to
finish the adapter that should not exist.

Solution

The declaration kernel carries inference_excluded_reason, and every door into
inference enforces it:

  • parse_schema_source_input, inventory_schema_sources and infer_sources
    raise SchemaSubjectExcludedError (also a ValueError), so no candidate can
    be inventoried, counted, sampled, or reported eligible-then-unsupported.
  • The schema-source frontier refuses a declaration that gives the subject a root
    or a recorded baseline, so the recorded denominator is zero, not
    1,243-refused.
  • The stale inferred package is retired in favour of the authored pydantic
    contract; docs/browser-capture.md states where the shape is owned.

Only the current shape is modelled. There is no historical-schema handling for
this subject, because we control the writer.

Verification

  • Focused suites — 144 passed
  • devtools verify --quick — exit 0, 21 gates ok
  • devtools render all --check — exit 0
  • Frontier re-recorded without its 1,243-member baseline, digest 4f281442…

Landing order

This touches polylogue/core/schema_subjects.py, which #5219 also edits
(that PR adds member_prefixes/excluded_member_prefixes for the
claude-ai/claude-design partition). Both are in the schema closure. They must be
sequenced, not merged in parallel; whichever lands second gets rebased onto the
first.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

Summary by CodeRabbit

  • Changes
    • Browser capture is now treated as an authored, repository-controlled format rather than an inferred schema subject.
    • Schema inference, source inventory, frontier declarations, and verification exclude browser capture and report the exclusion reason.
    • Listing and verification outputs identify excluded subjects and show that they have no eligible inferred material.
    • Attempts to generate or commit a browser-capture schema package now fail with an explanatory error.
    • The previously generated browser-capture schema package has been removed.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-16T03:23:21.248314Z ecfce5b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4e44a241-91d0-4fa9-96af-f8b42a6899d8

📥 Commits

Reviewing files that changed from the base of the PR and between ecfce5b and ef77443.

📒 Files selected for processing (2)
  • polylogue/core/schema_subjects.py
  • polylogue/sources/origin_specs.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 15a8ceae-9ff1-430a-ad46-15c41f1a198d

📥 Commits

Reviewing files that changed from the base of the PR and between 342cf9e and ecfce5b.

⛔ Files ignored due to path filters (1)
  • polylogue/schemas/providers/browser-capture/versions/v1/elements/session_document.schema.json.gz is excluded by !**/*.gz
📒 Files selected for processing (16)
  • devtools/schema_frontier.py
  • devtools/schema_parser_diff.py
  • docs/browser-capture.md
  • polylogue/core/schema_subjects.py
  • polylogue/schemas/operator/commit.py
  • polylogue/schemas/providers/browser-capture/catalog.json
  • polylogue/schemas/providers/browser-capture/versions/v1/package.json
  • polylogue/schemas/schema_parser_coverage.py
  • polylogue/schemas/source_frontier.py
  • polylogue/schemas/source_inference.py
  • polylogue/sources/origin_specs.py
  • tests/unit/devtools/test_schema_commit_command.py
  • tests/unit/schemas/test_inferred_corpus_manifest.py
  • tests/unit/schemas/test_source_frontier.py
  • tests/unit/schemas/test_source_inference.py
  • tests/unit/sources/test_provider_completeness.py
💤 Files with no reviewable changes (4)
  • polylogue/schemas/schema_parser_coverage.py
  • devtools/schema_parser_diff.py
  • polylogue/schemas/providers/browser-capture/catalog.json
  • polylogue/schemas/providers/browser-capture/versions/v1/package.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
🪛 ast-grep (0.45.3)
devtools/schema_frontier.py

[info] 115-115: use jsonify instead of json.dumps for JSON output
Context: json.dumps(check_payload, indent=2, sort_keys=True)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

tests/unit/schemas/test_source_inference.py

[info] 605-605: use jsonify instead of json.dumps for JSON output
Context: json.dumps({"polylogue_capture_kind": "browser_llm_session"})
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🔇 Additional comments (12)
polylogue/sources/origin_specs.py (1)

3051-3051: LGTM!

Also applies to: 3056-3062

docs/browser-capture.md (1)

254-283: LGTM!

tests/unit/sources/test_provider_completeness.py (1)

10-15: LGTM!

Also applies to: 46-50, 53-53, 121-140

polylogue/core/schema_subjects.py (1)

24-31: LGTM!

Also applies to: 58-76, 94-102, 108-108, 113-113

polylogue/schemas/source_inference.py (1)

36-36: LGTM!

Also applies to: 89-97, 506-520, 2742-2742

polylogue/schemas/operator/commit.py (1)

38-38: LGTM!

Also applies to: 73-79

tests/unit/schemas/test_source_inference.py (1)

16-16: LGTM!

Also applies to: 22-22, 31-32, 600-631

tests/unit/schemas/test_inferred_corpus_manifest.py (1)

929-940: LGTM!

Also applies to: 950-954

polylogue/schemas/source_frontier.py (1)

44-44: LGTM!

Also applies to: 395-404, 417-422

tests/unit/schemas/test_source_frontier.py (1)

18-18: LGTM!

Also applies to: 20-20, 198-235

tests/unit/devtools/test_schema_commit_command.py (1)

191-193: LGTM!

Also applies to: 198-200, 215-215, 224-252

devtools/schema_frontier.py (1)

31-31: LGTM!

Also applies to: 48-66, 85-85, 114-124


📝 Walkthrough

Walkthrough

The change declares browser-capture outside schema inference. Inference, frontier loading, and schema commits now reject it. Generated browser-capture packages are removed, tooling reports the exclusion, and tests verify the new boundaries.

Changes

Browser-capture inference exclusion

Layer / File(s) Summary
Inference exclusion contract
polylogue/core/schema_subjects.py
SchemaSubjectSpec records exclusion reasons. INFERENCE_EXCLUDED_SUBJECTS and inference_exclusion_reason() expose normalized exclusion metadata.
Inference and frontier guards
polylogue/schemas/source_inference.py, polylogue/schemas/source_frontier.py, polylogue/schemas/operator/commit.py, tests/unit/schemas/*, tests/unit/devtools/*
Inference, frontier loading, and schema commits reject excluded subjects before source counting or package persistence. Tests cover the new exceptions, error messages, and refusal behavior.
Authored contract and package cleanup
polylogue/sources/origin_specs.py, polylogue/schemas/providers/browser-capture/*, polylogue/schemas/schema_parser_coverage.py, devtools/schema_parser_diff.py, docs/browser-capture.md, tests/unit/sources/test_provider_completeness.py
Browser-capture ownership points to polylogue/browser_capture/models.py. Generated package metadata and parser mappings are removed. Documentation and completeness tests describe the excluded subject.
Frontier reporting
devtools/schema_frontier.py, tests/unit/schemas/test_inferred_corpus_manifest.py
Frontier listing and verification output include excluded subjects and their reasons. Corpus constraint tests no longer depend on browser-capture packages.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant SchemaCommit
  participant CommitOperator
  participant SubjectRegistry
  participant SchemaPackageStore
  SchemaCommit->>CommitOperator: request browser-capture commit
  CommitOperator->>SubjectRegistry: check inference exclusion
  SubjectRegistry-->>CommitOperator: return exclusion reason
  CommitOperator-->>SchemaCommit: reject with ValueError
  SchemaCommit-->>SchemaPackageStore: no package written
Loading

Merge Risk: ⚪ Minimal · up to ecfce

No actionable merge risk remains for this change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 11 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: declaring browser-capture outside the schema-inference denominator.
Description check ✅ Passed The description includes the required Summary, Problem, Solution, and Verification sections and explains the implementation, impact, testing, and landing order. It omits the Changelog and Risks and Fo…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 72.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 11 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch schema/tnqqt-browser-capture-exclusion

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

A rabbit guards the schema gate,
Browser capture must now wait.
The authored model holds the key,
No inferred bundle grows a tree.
Frontier notes the reason clear,
And tests keep every boundary near.

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

browser-capture is a format this repository authors: `browser-extension/`
writes it and `polylogue-browser-capture-native-host` reads it. Its shape is a
decision changed together with its writer, not evidence to discover from a
corpus, so no source-evidence adapter should exist for it.

`source_inference.py` previously refused every browser-capture candidate at
preflight with `browser_capture_adapter_unavailable` -- a reason that reads as
unfinished work and produced a *non-empty* refused denominator (1,243 members
in the recorded frontier). "We refused all 1,243" and "there were zero
eligible" are different claims; only the second is proof of non-applicability.

The declaration kernel now carries `inference_excluded_reason`, and every door
into inference enforces it:

- `parse_schema_source_input` / `inventory_schema_sources` / `infer_sources`
  raise `SchemaSubjectExcludedError` (also a `ValueError`), so no candidate can
  be inventoried, counted, sampled or reported eligible-then-unsupported;
- the schema-source frontier refuses a declaration that gives the subject a
  root or a recorded baseline, so the recorded denominator is zero;
- `devtools schema commit --provider browser-capture` refuses instead of
  writing a package;
- `devtools schema frontier --list` / check report it as declared
  non-applicable with its reason, in text and JSON.

The stale inferred package (v1, last_seen 2026-07-27, one sample) is retired:
an inferred artifact for an authored format invites a "refresh" that must never
happen. Its shipped replacement already exists and is now the completeness
row's schema evidence -- the authored pydantic contract in
`polylogue/browser_capture/models.py`, which the receiver enforces on every
accepted capture.

Verification: devtools test over the schema, frontier, commit-command and
provider-completeness suites, 144 passed; devtools verify --quick, 21 gates ok;
devtools render all --check, exit 0, no "out of sync".

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
@Sinity
Sinity force-pushed the schema/tnqqt-browser-capture-exclusion branch from ecfce5b to ef77443 Compare September 16, 2026 08:56
@Sinity
Sinity merged commit 262cd4c into master Sep 18, 2026
3 checks passed
@Sinity
Sinity deleted the schema/tnqqt-browser-capture-exclusion branch September 18, 2026 20:35
Sinity added a commit that referenced this pull request Sep 22, 2026
…ence (#5444)

## Summary

The schema commit route ran **no privacy review**, and no post-hoc gate
could substitute for one — because the write itself strips the evidence.
Bead: polylogue-tnqqt (AC7; bead not closed).

## Problem

`operator/commit.py` persisted without any privacy review. That matters
more than it sounds, because `replace_provider_packages` **strips
`x-polylogue-values` as it writes**.

Measured directly: committing a bundle whose `conversation_id` retains a
UUID **succeeded**, and the persisted element was `{"type": "string"}` —
the value silently dropped rather than the commit refused. `gate
schema-privacy` therefore inspects bytes the leak has already been
removed from. The gate was never going to catch this class.

## Solution

`_commit_into` runs the registered predicate on the **in-memory** bundle
and raises `SchemaCommitPrivacyError` before the write.

**Two wrong placements were found and discarded before landing**,
reported rather than hidden:

1. A *post-persist* audit — structurally incapable of catching this
class. That is the "harness more permissive than production" trap.
2. Inside `persist_generated_provider_bundle` — this grew the
schema-closure ratchet **558 -> 559** and `gate schema-closure` FAILED,
which would have made every future privacy-predicate edit move the
archive identity.

## Verification

```
devtools verify --quick     ->  PASSED (gate schema-closure ok)
devtools render all --check ->  exit 0, grep -c "out of sync" = 0
devtools test tests/unit/schemas/test_operator_commit.py  ->  PASSED
devtools schema closure polylogue/schemas/operator/commit.py  ->  out
```

Derived `index` identity `4df1149f…` is **identical at base and head** —
no rebuild-ordering constraint.

Anti-vacuity executed, not asserted: removing the call produced `Failed:
DID NOT RAISE SchemaCommitPrivacyError`, then restored. A second test
proves the check **discriminates** rather than refusing everything. A
`getattr(bundle, "package_schemas", {})` was also replaced with direct
attribute access — the `getattr` default would have made the check
silently vacuous forever under a rename.

## The rest of the bead was already satisfied

Its notes are **stale**: they cite master `da37fcf4c` (PR #4830), but
packages were regenerated since by **#5215, #5219, #5223, #5357,
#5411**. The committed `provider-matrix.json` at head has 12 subjects,
zero blockers, zero findings.

- **AC1 / AC3 / AC5 / AC6** satisfied by already-committed work:
`outcome_counts` is 8 `zero_diff`, 1 `generated`, 2
`proven_non_applicable`, 1 `declared_non_applicable` = 12, matching the
denominator exactly; per-subject `denominator.conserves: true`.
- **AC2** satisfied — `derive_provider_denominator()` derives at call
time from `SCHEMA_SUBJECTS` + `origin_specs()`, no hard-coded count.
Residual: hard-coded provider sets in `synthetic/wire_formats.py:39` and
`build_batch.py:665` will not follow a new subject.
- **AC4** satisfied — `SubjectOutcome` includes `not_run`, and
cardinality comes from the denominator, not the receipts.
- **AC8** satisfied at the aggregate matrix (all six bindings);
**unsatisfied at per-package metadata** (only `input_manifest_digest`).
Needs an operator reading of whether the aggregate suffices.
- **AC9** not attempted — owned by polylogue-rrxe4.1, downstream.

## Inherited reds, named and not fixed

10 tests in `tests/unit/schemas/test_source_cache_reuse.py` and
`test_promote_cluster_privacy_config.py` fail **identically at base and
at head** — same 10 nodeids in both runs. Unrelated to this bead
(source-evidence cache phases and default privacy-config generation) and
a large separate scope.

## Residuals

- The `db_path` generation path persists inside `generate_all_schemas`
with no pre-strip seam; unguarded, and stated in the commit message.
- **False docstring** at `provider_denominator.py:28-31` claims a
closure test exists in `test_provider_denominator.py` — it does not.
- **No gate detects the committed `provider-matrix.json` going stale**
against head's generator fingerprints; its recorded `code_revision
a5c893c8f` is not an ancestor of master.
- `schema-inference-handoff.json` records four providers as
`provider_without_wire_format` because `receipt.py:392` reads the narrow
`PROVIDER_WIRE_FORMATS` rather than `PROVIDER_WIRE_ROUTES`, which its
own docstring calls *"the authority for catalog coverage"*, discarding
the declared specific reasons. Not fixed: correcting it would change a
committed receipt that cannot be regenerated without private source.

No operator material in the diff; fixtures are synthetic.

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

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

Co-authored-by: Claude Opus 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