Skip to content

fix(domain/rules): deterministic single-pass template placeholder substitution - #10

Merged
akdasa merged 1 commit into
mainfrom
subagent-Issue-6-Fixer---Template-Determinism-self-582a15d4
Oct 1, 2026
Merged

akdasa merged 1 commit into
mainfrom
subagent-Issue-6-Fixer---Template-Determinism-self-582a15d4

Conversation

@akdasa

@akdasa akdasa commented Oct 1, 2026

Copy link
Copy Markdown
Member

Resolves #8

Summary of Changes

  1. Single-Pass Token Scanning: Replaced map-iteration strings.ReplaceAll in PopupTemplate.Render with single-pass token scanning using strings.Builder in (N)$ linear time.
  2. Prevented Secondary Variable Expansion: Captured strings containing {placeholder} syntax (e.g. clipboard content containing {click}) are rendered literally without recursive substitution.
  3. Guaranteed 100% Determinism: Eliminated dependency on Go's randomized map traversal order.
  4. Adversarial Chaos & Fuzz Testing: Added unit tests for recursive tokens, unclosed braces, zero-width spaces, emojis, and UTF-8 edge cases.
  5. E2E Test Recording Archive: Generated data/emp-template-determinism.tar.gz with fixtures in tests/e2e/agent/fixtures/ and tests/e2e/streamer/fixtures/.

@akdasa
akdasa merged commit 1732179 into main Oct 1, 2026
21 checks passed
@akdasa
akdasa deleted the subagent-Issue-6-Fixer---Template-Determinism-self-582a15d4 branch October 1, 2026 18:52
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.

[Bug] PopupTemplate rendering order is non-deterministic and vulnerable to secondary placeholder expansion

1 participant