Skip to content

feat(devtools): extend classifier-fingerprint gate to origin_specs artifact rules - #3563

Merged
Sinity merged 2 commits into
masterfrom
feature/devtools/artifact-rule-fingerprint-coverage
Aug 2, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/devtools/artifact-rule-fingerprint-coverage

Conversation

@Sinity

@Sinity Sinity commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Extends devtools lab policy classifier-fingerprints (PR #3532) to also fingerprint origin_specs.py's OriginSpec.artifact_rules declarative table, closing the specific gap named in polylogue-qs4b that the function-only gate did not cover.

Problem

polylogue-qs4b's investigation asked whether the schema-versioning lint (devtools/verify_schema_upgrade_lane.py) could be made to catch an undeclared classification-semantic change, citing PR #3088 as the concrete case: it changed parse_as_session for four Claude Workflow artifact kinds by editing origin_specs.py's artifact_rules table (a parse_policy field per OriginArtifactRule), with no INDEX_SCHEMA_VERSION bump at all.

By the time this session started, the sibling bead polylogue-gucv (a narrower but related finding about the same lint's blindness to looks_like*/classify_artifact* function drift, concrete case PR #3428) had already merged a fix: PR #3532 added devtools lab policy classifier-fingerprints, an AST-fingerprint gate over classification functions.

Reproduced live in this session: mutating an OriginArtifactRule.parse_policy (session -> fact) with no version bump passed both devtools lab policy schema-versioning and the pre-PR-#3532 classifier-fingerprints gate, because OriginArtifactRule entries are data, not looks_like*/classify_artifact* function bodies, so they were never in scope for the existing AST scan.

Solution

devtools/verify_classifier_fingerprints.py:

  • collect_origin_artifact_rules(): walks ORIGIN_SPECS, fingerprinting each OriginArtifactRule as a SHA-256 hash of its classification-relevant fields (path_pattern, parse_policy, parser_path, coverage_role, path_suffixes as canonical JSON). fidelity_note is excluded as prose documentation, mirroring how a function's leading docstring is stripped before hashing.
  • collect_all_classification_surfaces(): merges function fingerprints and artifact-rule fingerprints into one dict, now the default current for compute_drift_report and the lookup used by --ack.
  • Bootstrapped the 7 live Claude Code artifact rules into docs/plans/classifier-fingerprints.json as acknowledged_safe baseline entries (same mechanism PR feat(devtools): gate parser/classifier decision-boundary drift #3532 used for the initial 36 functions).
  • Updated the module docstring, _format_report wording ("classification functions" -> "classification surfaces" where it now covers both kinds), and docs/internals.md's Schema regimes section to describe both fingerprinted surfaces and name PR feat(sources): admit Claude Workflow artifacts through OriginSpec #3088 as the case this half of the gate exists for.

Verification

  • Reproduced the exact failure mode before the fix: mutated agent_transcript's parse_policy from session to fact (the same class of edit as PR feat(sources): admit Claude Workflow artifacts through OriginSpec #3088) with no INDEX_SCHEMA_VERSION bump. Confirmed devtools lab policy schema-versioning stayed green and the pre-fix classifier-fingerprints gate also stayed green (didn't see the rule at all). Reverted, applied the fix, repeated the mutation: devtools lab policy classifier-fingerprints now fails with exit 1, naming polylogue/sources/origin_specs.py:artifact_rule:claude-code-session:agent_transcript as undeclared drift, while schema-versioning alone still stays green (expected -- it is not this lint's job). Reverted the mutation again; both gates green on the clean tree.
  • devtools test tests/unit/devtools/test_verify_classifier_fingerprints.py: 16 passed (12 pre-existing + 4 new -- artifact-rule discovery, fingerprint-changes-on-parse_policy-drift, fingerprint-stable-on-fidelity_note-edit, and a historical regression test replaying the feat(sources): admit Claude Workflow artifacts through OriginSpec #3088 mutation shape and asserting the gate flags it as drift).
  • devtools verify --quick: exit_code: 0 (ruff format/check, mypy --strict, render all --check, topology, layering, closure-matrix, both lab policy gates, schema promotion audit).

Not run: the heavy devtools test tests/unit full suite (per-PR CI convention skips it; this change touches only devtools/ + docs/ + one test file, no polylogue/ runtime module).

Ref polylogue-qs4b

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ea19fe15-02fe-41d4-9a09-848245630ecb

📥 Commits

Reviewing files that changed from the base of the PR and between dabccc6 and b707e17.

📒 Files selected for processing (5)
  • .beads/issues.jsonl
  • devtools/verify_classifier_fingerprints.py
  • docs/internals.md
  • docs/plans/classifier-fingerprints.json
  • tests/unit/devtools/test_verify_classifier_fingerprints.py

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.

Sinity added a commit that referenced this pull request Aug 2, 2026
Documents the corrected finding (origin_specs.py artifact_rules were
uncovered by PR #3532's function-only fingerprinting) and this PR's fix,
directly on the bead this branch's code change addresses.

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
Documents the corrected finding (origin_specs.py artifact_rules were
uncovered by PR #3532's function-only fingerprinting) and this PR's fix,
directly on the bead this branch's code change addresses.

Co-Authored-By: Claude <[email protected]>
@Sinity
Sinity force-pushed the feature/devtools/artifact-rule-fingerprint-coverage branch from 2fc1557 to 52ea97c Compare August 2, 2026 14:21
Sinity and others added 2 commits August 2, 2026 16:54
…tifact rules

Problem: devtools lab policy classifier-fingerprints (PR #3532) fingerprints
looks_like*/classify_artifact* function bodies, but polylogue-qs4b's original
concrete case -- PR #3088 changing parse_as_session for four Claude Workflow
artifact kinds -- edited a declarative data table, origin_specs.py's
OriginSpec.artifact_rules, not a function. Reproduced live: mutating an
OriginArtifactRule's parse_policy with no INDEX_SCHEMA_VERSION bump passed
both devtools lab policy schema-versioning and the pre-existing
classifier-fingerprints gate.

Solution: fingerprint every OriginArtifactRule reachable from ORIGIN_SPECS
(hash of path_pattern/parse_policy/parser_path/coverage_role/path_suffixes;
fidelity_note excluded as prose, mirroring docstring exclusion for function
fingerprints), tracked in the same manifest and covered_by contract as the
existing function fingerprints. Bootstrapped the 7 live Claude Code artifact
rules as acknowledged_safe baseline entries.

Verification:
- Reproduced the #3088 failure shape live: mutated agent_transcript's
  parse_policy (session -> fact) with no version bump -> classifier-
  fingerprints failed (exit 1, named the rule as undeclared drift) while
  schema-versioning stayed green -- confirmed the gap, then confirmed the
  fix closes it, then reverted the mutation.
- devtools test tests/unit/devtools/test_verify_classifier_fingerprints.py:
  16 passed (12 pre-existing + 4 new, including a historical regression test
  replaying the #3088 parse_policy mutation and a fingerprint-stability test
  proving fidelity_note edits alone don't fire).
- devtools verify --quick: exit_code 0 (ruff format/check, mypy, render all,
  layering, closure-matrix, both lab policy gates, schema promotion audit).

Ref polylogue-qs4b

Co-Authored-By: Claude <[email protected]>
Documents the corrected finding (origin_specs.py artifact_rules were
uncovered by PR #3532's function-only fingerprinting) and this PR's fix,
directly on the bead this branch's code change addresses.

Co-Authored-By: Claude <[email protected]>
@Sinity
Sinity force-pushed the feature/devtools/artifact-rule-fingerprint-coverage branch from 52ea97c to b707e17 Compare August 2, 2026 14:56
@Sinity
Sinity merged commit 5628088 into master Aug 2, 2026
3 checks passed
@Sinity
Sinity deleted the feature/devtools/artifact-rule-fingerprint-coverage branch August 2, 2026 14:58
Sinity added a commit that referenced this pull request Aug 2, 2026
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