Skip to content

Fix supported-zero intent coverage#11

Open
tachyon-beep wants to merge 27 commits into
mainfrom
fix/supported-zero-intent-coverage
Open

Fix supported-zero intent coverage#11
tachyon-beep wants to merge 27 commits into
mainfrom
fix/supported-zero-intent-coverage

Conversation

@tachyon-beep

@tachyon-beep tachyon-beep commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • derive intent denominator completeness from Loomweave classifier support and enumeration metadata instead of observed tag cardinality
  • add negotiated weft.plainweave.intent_coverage.v2 per-class states while preserving the exact-key v1 legacy projection
  • fail closed for unavailable, malformed, degraded, failed, non-completed, or truncated producer coverage; keep evidence truncation separate from denominator counts
  • read schema and paginated catalog data from one SQLite snapshot and return one unavailable page on read failure
  • update PDR-009, product metrics, workflow documentation, and Scrappack-shaped regression coverage

Test plan

  • make ci
  • 566 tests passed
  • 91.45% coverage
  • Ruff check and format check
  • mypy
  • wardline scan . --fail-on ERROR

Notes

The current live Scrappack database lacks compliant authoritative classifier coverage metadata, so v2 correctly reports unavailable there. A deterministic complete-Python-scan regression verifies counts 5/5/0/0 as supported-complete without fabricated entities.

Filigree: plainweave-51b6eec074

tachyon-beep and others added 27 commits July 10, 2026 20:01
…PDR-022

- PDR-021: MCP/CLI read-parity bet decided, delivered (PR #10), accepted;
  reversal trigger bound to the new raw-SQL-fallbacks input metric
- PDR-022: retroactive provenance for the pre-session `plainweave install`
  MCP-repair delivery (closes the ORIENT drift)
- metrics: first foreign-store guardrail reading (no PDR-020 trigger fire);
  input metric baselined ~20+ -> target 0; roadmap Done section updated
- tracker: validation task plainweave-70714fad61 filed (P2)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 11:06

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 pull request updates Plainweave’s intent-coverage “denominator completeness” semantics to be derived from Loomweave classifier-support/enumeration metadata (so “supported with zero matches” can still be complete), and introduces a negotiated weft.plainweave.intent_coverage.v2 output shape that exposes per-class classifier states while preserving the default v1 legacy projection.

Changes:

  • Add classifier-backed completeness evaluation (supported/partial/unsupported/unavailable/incomplete) and propagate it into intent coverage results and contracts (v1 projection preserved; v2 adds classifier + typed source anchors).
  • Make Loomweave catalog reads snapshot-based and fail-closed on read errors (single unavailable page rather than partial prefixes).
  • Expand MCP read surfaces/validators and update tests + documentation to reflect the revised completeness doctrine and v2 negotiation.

Reviewed changes

Copilot reviewed 35 out of 36 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Adds pydantic to locked dependencies.
pyproject.toml Declares runtime dependency on pydantic>=2.0.
src/plainweave/loomweave_adapter.py Implements classifier-coverage parsing, per-class states, snapshot paging/fail-closed catalog iteration.
src/plainweave/service.py Threads catalog classifier coverage into service-level intent coverage and improves paging/event APIs.
src/plainweave/intent_graph.py Extends intent coverage model with typed source and classifier_coverage.
src/plainweave/cli_commands.py Adds --contract-version negotiation and v1/v2 serializers for intent coverage.
src/plainweave/mcp_surface.py Adds intent coverage contract negotiation and preflight pagination plumbing.
src/plainweave/mcp_server.py Exposes new MCP parameters via FastMCP/Pydantic schema annotations.
src/plainweave/mcp_install.py Hardens config read/write paths with atomic writes and error translation.
README.md Documents classifier-backed completeness, v2 negotiation, and supported-zero semantics.
docs/superpowers/specs/2026-07-11-supported-zero-intent-coverage-design.md Adds design spec for supported-zero classifier-backed completeness.
docs/product/decisions/PDR-009-intent-coverage-accepted-north-star-self-computable.md Records the classifier-backed completeness amendment.
docs/product/metrics.md Updates metric caveats and adds adoption/input-metric notes.
docs/product/roadmap.md Updates roadmap checkpoint and adds “done since last checkpoint” entries.
docs/product/current-state.md Updates current-state checkpoint narrative and priorities.
docs/product/decisions/PDR-021-mcp-read-parity-from-first-external-dogfood.md Adds decision record for read-parity work.
docs/product/decisions/PDR-022-mcp-install-repair-delivered.md Adds retroactive decision record for install/repair delivery.
docs/handoffs/2026-07-01-loomweave-rust-public-surface-tagging.md Marks historical handoff as superseded by the new classifier-backed contract.
src/plainweave/skills/plainweave-workflow/SKILL.md Updates workflow guidance for v1 vs v2 intent coverage interpretation.
src/plainweave/skills/plainweave-workflow/references/intent-graph-patterns.md Updates reference guidance around completeness qualifiers and supported-zero.
tests/loomweave_test_utils.py Seeds Loomweave runs table and helpers for classifier-coverage test fixtures.
tests/test_loomweave_adapter.py Adds extensive classifier-coverage parsing/state tests and snapshot iteration tests.
tests/test_intent_coverage.py Updates/expands intent coverage tests for supported-zero, v2 source anchors, pagination snapshotting.
tests/test_mcp_intent_coverage.py Adds v2 MCP coverage tests and validates contract-version errors.
tests/test_cli_intent_coverage.py Adds v2 CLI coverage tests and validates contract-version errors.
tests/intent_coverage_contract.py Adds v2 validator and classifier coverage invariants.
tests/contracts/test_contract_fixtures.py Adds v2 fixture validation and negative-key-drift tests.
tests/fixtures/contracts/intent/intent-coverage-v2.json Adds the v2 golden fixture.
tests/fixtures/contracts/mcp/resource-inventory.json Adds the v2 intent coverage contract resource URI.
tests/preflight_contract.py Validates optional requirement_page pagination metadata.
tests/test_mcp_read_surface.py Adds preflight pagination behavior tests + catalog degradation expectation updates.
tests/test_mcp_server.py Verifies FastMCP tool schemas (pagination fields + intent coverage contract default).
tests/test_mcp_install.py Adds atomic-write permission and failure translation tests for MCP install paths.
tests/test_doctor.py Ensures doctor --fix reports config read/write failures without crashing.
tests/state/test_requirement_lifecycle.py Asserts idempotency conflict hints and adds requirement ID paging behavior tests.

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

Comment on lines +31 to +39
def _config_path_exists(path: Path) -> bool:
try:
return path.exists()
except OSError as exc:
raise _validation_error(
f"cannot inspect {path}: {exc}",
hint="Fix MCP config path permissions, then rerun `plainweave install`.",
details={"path": str(path), "error": str(exc)},
) from exc
Comment on lines +61 to +62
if mode is not None:
tmp_path.chmod(mode)
Comment on lines +328 to +332
observed_counts = {
str(row["tag"]): int(row["matches"])
for row in connection.execute(
f"""
select e.*,
sb.sei as sei,
sb.status as sei_status,
sb.body_hash as sei_body_hash,
(
select group_concat(tag, char(31))
from (
select tag from entity_tags
where entity_id = e.id
order by tag
)
) as tags
from entities e
left join {sei_join} sb
on sb.current_locator = e.id and sb.status = 'alive'
where e.kind = 'module'
or exists (
select 1 from entity_tags t
where t.entity_id = e.id
and t.tag in ({placeholders})
)
order by e.id
limit ? offset ?
select tag, count(distinct entity_id) as matches
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.

2 participants