Skip to content

Add targeted instruction source replacement - #80

Merged
andrei-hasna merged 1 commit into
mainfrom
fix/36dd6ed8-targeted-replacement
Aug 11, 2026
Merged

Add targeted instruction source replacement#80
andrei-hasna merged 1 commit into
mainfrom
fix/36dd6ed8-targeted-replacement

Conversation

@andrei-hasna

@andrei-hasna andrei-hasna commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add fail-closed source:<normalized-source-id> replacement that removes exactly one earlier overridable source
  • preserve unscoped broad replacement while recording the targeted relation in manifest provenance and skipped-source output
  • add CLI --replace-source replacer=target parity with identity-exported replacementScope

Validation

  • bun test src/lib/session-render-silent-source-drop.test.ts src/cli/session.test.ts — 32 pass, 0 fail
  • bun test — 660 pass, 0 fail
  • bun run typecheck
  • bun run build
  • repository package-manager scan — clean
  • staged and committed-patch secret scans — zero findings

Candidate

  • base: 8b785d6a09b8bb4abd48c7538cdf32418320d5e0
  • head: fafec2a88522ad6bda43dcba3af4618b878df584

Rollback

  • git revert fafec2a88522ad6bda43dcba3af4618b878df584

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] GO — #80 @ fafec2a — lens: correctness+security+gates, reviewer Timon (1 of 1)

Exact candidate reviewed

  • Base: origin/main at 8b785d6.
  • Head: fafec2a.
  • Read: full diffs and surrounding source for src/cli/index.tsx, src/cli/session.test.ts, src/lib/session-render.ts, and src/lib/session-render-silent-source-drop.test.ts. I also traced CLI source collection, identity-export normalization, semantic-policy deduplication, ordered composition, manifest/provenance generation, and broad-replacement compatibility.

Commands and results

  • git log --oneline origin/main..HEAD — exit 0; one commit, fafec2a.
  • git diff origin/main...HEAD --stat — exit 0; 4 changed files, 695 insertions, 17 deletions.
  • bun install — exit 0; setup only, 158 packages installed.
  • bun run typecheck — exit 0; tsc --noEmit, no diagnostics (the gate does not emit pass/fail counts).
  • bun run test — exit 0; 660 pass, 0 fail, 2765 expect() calls across 56 files.

Blocking P0/P1 findings

  • None.

Security and correctness assessment

  • Targeted replacement is bounded to one normalized, earlier, overridable source and fails closed for missing, later, ambiguous, already-removed, malformed-scope, append-mode, non-overridable, and semantic-deduplication cases.
  • The rendered manifest records the replacement scope, skipped target, and replacer provenance; the source hash changes with the replacement relation.
  • Existing unscoped broad replacement behavior remains covered and green.
  • The change does not add a new credential, filesystem-write, command-execution, or authorization sink.

Non-blocking follow-ups

  • None.

@andrei-hasna
andrei-hasna merged commit 7b0bee0 into main Aug 11, 2026
3 checks passed
@andrei-hasna
andrei-hasna deleted the fix/36dd6ed8-targeted-replacement branch August 11, 2026 00:11
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