Skip to content

fix: harden Zola export, hook paths, and filter store access#144

Merged
avrabe merged 6 commits intomainfrom
fix/harden-everything
Apr 13, 2026
Merged

fix: harden Zola export, hook paths, and filter store access#144
avrabe merged 6 commits intomainfrom
fix/harden-everything

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 13, 2026

Summary

Quality hardening based on honest review of what was actually broken:

  1. Zola filter: matches_filtermatches_filter_with_store (quantifiers now work in export)
  2. Hook paths: rivet init --hooks uses PATH-based resolution instead of hardcoded debug binary
  3. Zola templates: generates fallback taxonomy_list.html/taxonomy_single.html when missing
  4. Verified end-to-end: needs-json import → validate, variant constraints, clean Zola build

Test plan

  • Clean Zola roundtrip: export → zola build → 53 pages, zero errors, no theme needed
  • needs-json: 3 artifacts imported, IDs normalized, validates PASS
  • Variant: (implies a b), (excludes a c), (and a b) all work correctly
  • Hook uses /Users/r/.cargo/bin/rivet (installed) not /target/debug/rivet

🤖 Generated with Claude Code

avrabe and others added 5 commits April 13, 2026 15:47
Fixes found during honest quality review:

1. Zola export filter now uses matches_filter_with_store (quantifiers work)
2. rivet init --hooks resolves binary via PATH (not hardcoded debug path)
3. Zola export generates fallback taxonomy templates when missing
   (zola build now works without a theme)
4. Verified: needs-json import works end-to-end (import → validate → PASS)
5. Verified: variant constraints handle (not feature), (and a b), (excludes a c)

Tested:
- Clean Zola roundtrip: export → zola build → 53 pages, zero errors
- needs-json: 3 artifacts imported, IDs normalized, validates clean
- Variant: complex constraints with implies/excludes/and/not

Implements: REQ-007

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
STPA analysis treating rivet as a qualification tool (ISO 26262 §11.4.7,
TCL 1). Covers hazards introduced by s-expression evaluator, variant
solver, Zola export, needs-json import, MCP write tools, and git hooks.

Safety (7 hazards, 7 constraints, 3 losses):
- H-TQ-001: evaluator returns wrong boolean (→ false PASS)
- H-TQ-002: variant solver unsound (accepts invalid config)
- H-TQ-003: Zola export omits/stales artifacts
- H-TQ-004: needs-json maps links incorrectly
- H-TQ-005: MCP modifies without validation
- H-TQ-006: git hooks bypassed
- H-TQ-007: quantifier scope mismatch

Security (5 losses, 3 hazards, 5 constraints):
- SL-TQ-002: AI agent prompt injection via MCP (no auth/rate limit)
- SL-TQ-004: --no-verify bypasses hooks (hooks are not security controls)
- SSC-TQ-002: MCP mutations must produce tamper-evident audit log
- SSC-TQ-005: CI must independently verify (hooks are convenience, not security)

Implements: REQ-002

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Seven requirements addressing STPA tool qualification constraints:
- REQ-047: MCP mutation audit logging (SSC-TQ-002)
- REQ-048: Regex complexity bounds (SSC-TQ-001)
- REQ-049: Export validation embedding + --clean (SC-TQ-003, SSC-TQ-004)
- REQ-050: Import link-target verification (SC-TQ-004, SSC-TQ-003)
- REQ-051: CI-enforced traceability, hooks are convenience only (SSC-TQ-005)
- REQ-052: Variant solver fuzz testing (SC-TQ-002)
- REQ-053: Quantifier scope correctness testing (SC-TQ-007)

Implements: REQ-002

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…053 (quantifier scope tests)

Three tool qualification requirements implemented:

REQ-047 — MCP audit logging:
  Every mutation (modify, link, unlink, remove) writes a JSON log entry
  to .rivet/mcp-audit.jsonl with timestamp, tool name, and details.
  Enables forensic analysis of AI agent activity.

REQ-048 — Regex complexity bounds:
  The matches predicate uses RegexBuilder::size_limit(1MB) to prevent
  ReDoS attacks via crafted filter expressions.

REQ-053 — Quantifier scope correctness:
  Three new tests verify forall/exists iterate the store parameter:
  - forall_uses_store_parameter: different stores → different results
  - exists_uses_store_parameter: adding artifact changes exists result
  - quantifier_without_store_returns_false: safe default

Implements: REQ-047, REQ-048, REQ-053
Verifies: REQ-041

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- --clean flag removes content/<prefix>/ and data/<prefix>/ before writing,
  preventing deleted artifacts from persisting as stale published pages
- data/<prefix>/validation.json embeds PASS/FAIL, error/warning counts,
  artifact count, and export date for consumers to verify freshness
- Addresses TOCTOU between export and publication (SSC-TQ-004)

Implements: REQ-049

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 0e00f87 Previous: 7588c3c Ratio
link_graph_build/10000 31957628 ns/iter (± 1255337) 25885542 ns/iter (± 1621608) 1.23

This comment was automatically generated by workflow using github-action-benchmark.

…curity docs)

REQ-050: needs-json import now verifies all link targets exist within
the imported artifact set. Unresolved targets produce warnings with
artifact ID, link type, and target. Prevents crafted imports from
creating links to non-existent artifacts.

REQ-051: CLAUDE.md documents that git hooks are convenience only,
not security controls. CI must independently enforce traceability.

Implements: REQ-050, REQ-051

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 0053fbb into main Apr 13, 2026
17 of 20 checks passed
@avrabe avrabe deleted the fix/harden-everything branch April 13, 2026 22:39
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