Skip to content

test(miner-plan): add prompt-packet builder and adversarial redaction suite (#2321) - #4061

Merged
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:test/prompt-packet-redaction-2321-v2
Jul 7, 2026
Merged

test(miner-plan): add prompt-packet builder and adversarial redaction suite (#2321)#4061
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:test/prompt-packet-redaction-2321-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/gittensory-engine/src/prompt-packet.ts — metadata-only analyze-phase prompt-packet builder (four text fields) with redaction/allowlist filtering over the canonical PUBLIC_UNSAFE_TERMS and PUBLIC_LOCAL_PATH_INLINE vocabulary.
  • Add test/unit/prompt-packet-redaction.test.ts — 93 parametrized adversarial tests: every unsafe-term family and local-path prefix (parsed from the regex sources, not hand-copied), injected into each packet field; double-jeopardy; byte-identical clean pass-through.
  • Export the builder from @jsonbored/gittensory-engine barrel.

Closes #2321

Scope

  • Parametrized over every term family in PUBLIC_UNSAFE_TERMS × four packet fields
  • Local-path injection for every prefix in PUBLIC_LOCAL_PATH_INLINE × four fields
  • Double jeopardy (unsafe term + local path in the same field)
  • Clean fields byte-identical after buildPromptPacket
  • Builder prerequisite included — prompt-packet.ts was not on main yet

Changed files

File Change
packages/gittensory-engine/src/prompt-packet.ts buildPromptPacket, sanitizePromptPacketField, four-field packet shape
packages/gittensory-engine/src/index.ts Barrel exports
test/unit/prompt-packet-redaction.test.ts Adversarial redaction/allowlist suite (93 tests)

Validation

git diff --check
./node_modules/.bin/vitest run test/unit/prompt-packet-redaction.test.ts
npm run build:miner
npm run test:ci
npm audit --audit-level=moderate

@andriypolanski
andriypolanski requested a review from JSONbored as a code owner July 7, 2026 20:07
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-07 20:18:05 UTC

5 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a new metadata-only prompt-packet builder (`prompt-packet.ts`) with regex-based redaction of unsafe economic/identity terms and local filesystem paths, plus a genuinely rigorous 93-case adversarial test suite that parses the canonical `PUBLIC_UNSAFE_TERMS`/`PUBLIC_LOCAL_PATH_INLINE` alternation sources (from `src/signals/redaction.ts`) rather than hand-copying terms, so drift between the canonical vocabulary and the duplicated copy in `prompt-packet.ts` would break tests. The core redaction logic (local-path scrub before term scrub, double-jeopardy handling, byte-identical clean pass-through) checks out correctly against the enumerated test cases and the regexes shown. The diff also bundles unrelated timeout bumps (`, 60_000`) into three pre-existing tests in `test/unit/queue.test.ts` and `test/unit/rag-wiring.test.ts` that aren't mentioned in the PR's 'Changed files' table.

Nits — 4 non-blocking
  • The vocabulary in `prompt-packet.ts:3-5` is a hand-duplicated copy of `PUBLIC_UNSAFE_TERMS`/`PUBLIC_LOCAL_PATH_INLINE` from `src/signals/redaction.ts` rather than an import — the code comment acknowledges this is intentional for standalone-package reasons, and the test suite does detect drift by parsing the canonical source, but this is still a manual-sync burden worth a follow-up (e.g. a build-time equality assertion between the two constants) rather than relying solely on the test suite to catch divergence.
  • The timeout bumps to `queue.test.ts:7245` and `queue.test.ts:7290` and `rag-wiring.test.ts:416` are undisclosed scope creep — the PR description's 'Changed files' table only lists the three prompt-packet files, not these pre-existing test timeout changes; call out why these were needed (flaky CI timeout?) in the description.
  • Consider a small unit test (or a lint/build step) asserting `PUBLIC_UNSAFE_TERMS`/`PUBLIC_LOCAL_PATH_INLINE` string literals in `prompt-packet.ts` are byte-identical to the ones exported from `src/signals/redaction.ts`, so drift fails fast instead of only failing indirectly through redaction-behavior test mismatches.
  • Fold the queue.test.ts/rag-wiring.test.ts timeout changes into the PR description's changed-files table, or split them into a separate PR if they address a different (flaky-CI) concern than test(miner-plan): adversarial redaction/allowlist test suite for the prompt-packet builder #2321.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2321
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 0 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ❌ No public Gittensor match andriypolanski; not a blocker.
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript, Python, Rust, Cuda, Kotlin, MDX, Scala
  • Contributor context: Public profile only; not a blocker.
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.59%. Comparing base (66a70b8) to head (df496c9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4061   +/-   ##
=======================================
  Coverage   93.59%   93.59%           
=======================================
  Files         379      380    +1     
  Lines       35582    35594   +12     
  Branches    13049    13049           
=======================================
+ Hits        33302    33314   +12     
  Misses       1618     1618           
  Partials      662      662           
Files with missing lines Coverage Δ
packages/gittensory-engine/src/prompt-packet.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 1deb96c into JSONbored:main Jul 7, 2026
9 checks passed
@andriypolanski
andriypolanski deleted the test/prompt-packet-redaction-2321-v2 branch July 16, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(miner-plan): adversarial redaction/allowlist test suite for the prompt-packet builder

1 participant