Repository navigation
feat(devtools): extend classifier-fingerprint gate to origin_specs artifact rules - #3563
Conversation
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
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. Comment |
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]>
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]>
2fc1557 to
52ea97c
Compare
…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]>
52ea97c to
b707e17
Compare
Summary
Extends
devtools lab policy classifier-fingerprints(PR #3532) to also fingerprintorigin_specs.py'sOriginSpec.artifact_rulesdeclarative 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 changedparse_as_sessionfor four Claude Workflow artifact kinds by editingorigin_specs.py'sartifact_rulestable (aparse_policyfield perOriginArtifactRule), with noINDEX_SCHEMA_VERSIONbump 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 addeddevtools 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 bothdevtools lab policy schema-versioningand the pre-PR-#3532classifier-fingerprintsgate, becauseOriginArtifactRuleentries are data, notlooks_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(): walksORIGIN_SPECS, fingerprinting eachOriginArtifactRuleas a SHA-256 hash of its classification-relevant fields (path_pattern,parse_policy,parser_path,coverage_role,path_suffixesas canonical JSON).fidelity_noteis 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 defaultcurrentforcompute_drift_reportand the lookup used by--ack.docs/plans/classifier-fingerprints.jsonasacknowledged_safebaseline entries (same mechanism PR feat(devtools): gate parser/classifier decision-boundary drift #3532 used for the initial 36 functions)._format_reportwording ("classification functions" -> "classification surfaces" where it now covers both kinds), anddocs/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
agent_transcript'sparse_policyfromsessiontofact(the same class of edit as PR feat(sources): admit Claude Workflow artifacts through OriginSpec #3088) with noINDEX_SCHEMA_VERSIONbump. Confirmeddevtools lab policy schema-versioningstayed green and the pre-fixclassifier-fingerprintsgate also stayed green (didn't see the rule at all). Reverted, applied the fix, repeated the mutation:devtools lab policy classifier-fingerprintsnow fails withexit 1, namingpolylogue/sources/origin_specs.py:artifact_rule:claude-code-session:agent_transcriptas undeclared drift, whileschema-versioningalone 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, bothlab policygates, schema promotion audit).Not run: the heavy
devtools test tests/unitfull suite (per-PR CI convention skips it; this change touches onlydevtools/+docs/+ one test file, nopolylogue/runtime module).Ref polylogue-qs4b