Skip to content

docs(performance): protect documents telemetry-derived counters - #5707

Merged
kyle-sexton merged 3 commits into
mainfrom
docs/5661-protect-telemetry-counters
Oct 1, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
docs/5661-protect-telemetry-counters

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #5661

Summary

protect documented only counters a command prints. It now has a "Telemetry-derived counters" subsection covering counters read from a telemetry store.

Fix

  • Command form: one command that generates a run id, runs the subject, flushes the exporter, queries the store scoped to that id, fails on zero rows, and prints the field=value token.
  • Twice-measure rule: add and propose-tighten measure twice, so a read before the exporter flush sees partial counts; the command must flush or poll until the run's record is complete.
  • CI: needs the store and exporter stood up so the command is self-contained, or the counter re-expressed as a directly printed count.
  • ratchet.py is untouched, so it gains no dependency.
  • performance plugin bumped to 0.3.1 with a CHANGELOG entry.

Verification

  • scripts/check-changelog-parity.sh --check, --check-order, --check-bump origin/main: pass.
  • scripts/validate-plugins.sh: all manifests and the catalog validated.
  • git diff origin/main...HEAD --stat: SKILL.md, plugin.json, CHANGELOG.md only; ratchet.py not changed.
  • Docs-only change; the plugin has no test suite.

Related

Parent: #5638

🤖 Generated with Claude Code

@kyle-sexton
kyle-sexton marked this pull request as ready for review October 1, 2026 14:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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
📝 Code Review ✅ Completed 2026-10-01T14:31:38.455454Z 2dfa648 Draft marked ready
ℹ️ 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.

@claude

claude Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 47s —— View job


Security review complete

  • Gather context (PR diff, changed files)
  • Run skip-gate check (security-relevant surface?)
  • Review changed files for vulnerabilities
  • Report findings

Scope: plugins/performance/.claude-plugin/plugin.json (version bump), plugins/performance/CHANGELOG.md (entry), plugins/performance/skills/protect/SKILL.md (new "Telemetry-derived counters" subsection).

Result: No security issues found.

This is a docs-only change: a version bump, a CHANGELOG entry, and a new documentation subsection in SKILL.md. No executable code is added or modified — ratchet.py is untouched, confirming the PR's own claim.

I checked the new content against the usual concerns for this lane:

  • Command-injection / unsafe example pattern — the new subsection shows an example command field (id=$(uuidgen); RUN_ID=$id ... duckdb ... "select count(*) from events where run_id='$id'"). This is prose guidance illustrating how to scope a telemetry query to a single run; it isn't invoked by anything in this repo, and ratchet.py's execution of arbitrary command strings from a trusted, repo-controlled ceilings file is pre-existing behavior, not introduced or changed here.
  • Instruction-surface deletions — the diff only adds content (a new subsection, a CHANGELOG entry, a version bump). Nothing is deleted, narrowed, or softened, so the instruction-exception-register lens doesn't apply.
  • Secrets/tokens/credentials — none referenced.
  • GitHub Actions — no workflow files touched.

Per the skip gate, no further findings to post.

@claude

claude Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 5s —— View job


Code review complete

  • Invoke /review:code-review and load criteria
  • Gather context (diff, changed files, CLAUDE.md/AGENTS.md conventions)
  • Review changed files for correctness and maintainability
  • Post findings (inline comments + summary)

This is a docs-only change (SKILL.md + CHANGELOG.md + plugin.json version bump) adding a
"Telemetry-derived counters" subsection to plugins/performance/skills/protect/SKILL.md.

Verification performed:

  • Confirmed ratchet.py (plugins/performance/scripts/ratchet.py) is untouched by this PR
    (git diff origin/main...HEAD --stat), matching the PR's claim that it gains no telemetry
    dependency.
  • Cross-checked the new prose against ratchet.py's actual behavior:
    • measure() calls fail() → SystemExit(2) when the counter command exits non-zero — matches
      the claim "check exits 2 when the command fails"
      (plugins/performance/scripts/ratchet.py#L122-L129).
    • measure_twice() is used by both add and propose-tighten and fails when two runs disagree —
      matches the "twice-measure rule" description
      (plugins/performance/scripts/ratchet.py#L169-L178).
    • Manually traced the example JSON block
      (plugins/performance/skills/protect/SKILL.md#L63-L66):
      it parses as valid JSON, carries exactly the five keys ratchet.py's validate() requires
      (name, command, field, ceiling, goal), and the embedded shell command's && chaining
      correctly propagates failure from run-subject.sh, flush-exporter.sh, or a failed/empty
      duckdb query through to the final echo, so a failure anywhere in the pipeline causes the
      whole command to exit non-zero (as ratchet.py requires).
    • I did not execute scripts/check-changelog-parity.sh or scripts/validate-plugins.sh myself
      (no tool access to run them in this session) — the PR body's claims about those passing are
      author-reported and unverified by me. The version/changelog entries line up visually
      (plugin.json → 0.3.1, CHANGELOG.md → ## [0.3.1] - 2026-10-01).

Findings: none that meet this lane's high-signal bar. The new section is internally
consistent, technically accurate against the current ratchet.py implementation, and follows the
existing document's style (bold rule statements, worked example, "Next"/"Gotchas" sections
untouched). No inline comments posted.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2dfa648081

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@claude

claude Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 48s —— View job


Security review complete

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Review changed files for vulnerabilities
  • Report findings

Scope: plugins/performance/.claude-plugin/plugin.json (version bump), plugins/performance/CHANGELOG.md (entry), plugins/performance/skills/protect/SKILL.md (new "Telemetry-derived counters" subsection). Reviewed against head e45e59f.

Result: No security issues found.

This is a docs-only change — a version bump, a CHANGELOG entry, and a new documentation subsection in SKILL.md. No executable code is added or modified. I confirmed plugins/performance/scripts/ratchet.py has zero diff against origin/main, so it gains no new behavior or dependency.

Checked against this lane's criteria:

  • Injection via the example command — the new subsection's JSON example (SKILL.md lines ~61-64, commit blob) is prose guidance, not code executed by anything in this repo. ratchet.py's execution of arbitrary command strings from a repo-controlled, trusted ceilings file is pre-existing, documented behavior ("Commands run through the shell from the current directory"), unchanged by this PR. This commit also already dropped the earlier DuckDB-specific -noheader -csv hard-coding that Codex flagged (now delegates to a generic count-run.sh), so that P1 is resolved.
  • Zero-count / missing-telemetry ambiguity — also addressed in this commit: the rule now says to exit non-zero when the run's completion record is missing, not when the count is zero, explicitly permitting calls=0 as valid. Resolves Codex's P2.
  • Instruction-surface deletions — the diff only adds content; nothing is deleted, narrowed, or softened, so the instruction-exception-register lens (docs/conventions/instruction-exception-register/README.md, present in this checkout) doesn't apply.
  • Secrets/tokens/credentials — none referenced.
  • GitHub Actions — no workflow files touched.

No findings to post.
· branch docs/5661-protect-telemetry-counters

@claude

claude Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 40s —— View job


Code review (/review:code-review)

  • Gather context (PR diff, changed files, AGENTS.md conventions)
  • Check skip gate (not closed/draft/trivial; latest commit not yet reviewed by this lane)
  • Review changed files for correctness and maintainability
  • Cross-check claims against plugins/performance/scripts/ratchet.py
  • Report findings

Scope: plugins/performance/.claude-plugin/plugin.json (version bump), plugins/performance/CHANGELOG.md (entry), plugins/performance/skills/protect/SKILL.md (new "Telemetry-derived counters" subsection).

Result: no high-signal findings.

The latest commit (e45e59f) already resolves both open Codex findings from the prior revision (2dfa648):

  • The example command no longer hard-codes a DuckDB CLI invocation — it now calls generic, tool-neutral helper scripts (run-subject.sh, flush-exporter.sh, count-run.sh), so the .claude/rules/skill-bodies-state-current-rules.md four-part-verification requirement for a restated external-tool specific no longer applies.
  • The zero-count case is now explicit and correctly scoped: "exit non-zero when the run record is missing, not when the count is zero… calls=0 is valid, since a zero ceiling is legitimate" (SKILL.md#L70-L73).

I verified the new prose against ratchet.py directly rather than trusting the PR body's claims:

  • measure()'s token regex (scripts/ratchet.py:128) is (?<![\w.-])field=(\d+(?:\.\d+)?)(?![\w.]), which matches calls=0 — the "zero is a valid count" claim holds against the actual parser, not just the prose.
  • measure() calls fail() → SystemExit(2) on a non-zero exit code (scripts/ratchet.py:132-136), matching "check exits 2 when the command fails."
  • measure_twice() (scripts/ratchet.py:169-178), used by both add and propose-tighten, matches the documented twice-measure/exporter-flush interaction.
  • validate() requires exactly the five keys name, command, field, ceiling, goal (scripts/ratchet.py:76-91); the new example JSON carries exactly those.

I was not able to run scripts/validate-plugins.sh or scripts/check-changelog-parity.sh myself in this session (both require shell approval this lane doesn't have), so the PR body's claims that those pass are author-reported and unverified by me — flagging per this lane's rule against restating unverified author claims as confirmed. The version/changelog entries do line up visually (plugin.json → 0.3.1, CHANGELOG.md → ## [0.3.1] - 2026-10-01), and ratchet.py is confirmed untouched by this PR's diff.

No inline comments posted — nothing met the high-signal bar for this lane.

@kyle-sexton
kyle-sexton merged commit 792f747 into main Oct 1, 2026
3 checks passed
@kyle-sexton
kyle-sexton deleted the docs/5661-protect-telemetry-counters branch October 1, 2026 14:40
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.

docs(performance): protect documents telemetry-derived counters

1 participant