Repository navigation
fix(examples): refuse unsafe wet redaction and preserve regex semantics - #150
Open
TimeToBuildBob wants to merge 2 commits into
Open
TimeToBuildBob wants to merge 2 commits into
TimeToBuildBob wants to merge 2 commits into
Conversation
Git-Session-Id: ea78e829-8b64-4977-91d0-72c842508f84
[Low impact] The PR appears safe to merge. SummaryThis PR makes the redaction example preview-only and preserves regex meaning.
TimeToBuildBob explicitly chose to disable wet writes because the shared client API cannot safely replace events across backends. Review checks were static; no tests were run during this review. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Choose buckets and search pattern] --> B[Warn about raw output]
B --> C[Find matching events]
C --> D{User confirms?}
D -->|No| E[Leave events unchanged]
D -->|Yes| F[Copy event and show before and after]
F --> G{Dry run?}
G -->|Yes| H[Continue preview]
G -->|No| I[Refuse wet writes]
Reviews (1) · Last reviewed commit: "fix(examples): refuse unsafe wet redacti..." · Reviewed by Greptile |
Git-Session-Id: ea78e829-8b64-4977-91d0-72c842508f84
Contributor
Author
|
All seven CI checks pass at c0ae7fc and the PR is mergeable — waiting only on a maintainer click. Greptile rated the implementation commit 5/5 with no findings; the subsequent change only pins the Linux CI runner to Ubuntu 24.04. Bob has triage, not push access, so cannot merge this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--wetmutation before any insert/delete. Keep the default dry-run preview and confirmation prompt.re.IGNORECASEand match against original strings, preserving\D,\S, character classes and scoped case flags. Use the same matcher for selection and redacted preview.Why refuse wet writes?
The existing delete-then-insert sequence loses the original event if insertion fails. Simply inserting first with the old ID is not portable: Python memory/Peewee can update existing IDs, Python SQLite allocates fresh IDs, and Rust uses
INSERT OR REPLACE. The common client API provides insert/delete but no atomic replace/CAS contract. This bounded repair disables the unsafe write path rather than claiming backend-independent replacement or multi-event atomicity. No backend, production history, or public client API changes.Reproduction and verification
On current
origin/masterc88cf12, the two initial offline regressions failed:\D+throughmain(): digits-only title incorrectly matches because the expression was lowercased.After the fix:
make test: 136 passed.make typecheck: no issues in 31 source files.git diff --checkpass.Tests use an in-process synthetic client and synthetic events; no running ActivityWatch server or private history is accessed.