Introduce deterministic phrasing variants for symbolic moment replies#440
Merged
Introduce deterministic phrasing variants for symbolic moment replies#440
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
DHCross
pushed a commit
that referenced
this pull request
Apr 25, 2026
Original task: harden the deterministic variant system introduced by PR #440 so it actually varies, stays inside the doctrinal lexicon (especially for The Core), and is locked in by tests. Significant deviation — environment drift: PR #440 modifies builders (buildStructuredSymbolicMomentReply, buildVoiceSentence, buildSilhouetteSentence, buildLandingSentence, buildVerificationPrompt, type PressureSignature, getChamberDomainOptions, etc.) that exist on the GitHub origin/main (758 lines) but do NOT exist anywhere in this local repo's symbolicMomentFrontstage.ts (388 lines, older grafted main). Editing the file in place to "improve PR #440" is therefore impossible — the PR's target functions aren't here. Per the work_style rule to try alternative approaches before stopping, the deliverable was reshaped as a self-contained, fully-tested companion module that meets every acceptance criterion and is ready to be wired in once the builder lands locally. The integration step is captured as follow-up Task #14. What changed: - vessel/src/lib/raven/symbolicMomentVariants.ts (new): the improved variant infrastructure. Exports computeVariantSeed (pure 31-multiplier hash), pickVariant (deterministic selector, returns '' for empty pools), computeBuilderSeed (per-builder XOR salt so voice/silhouette/landing/ verification pick independently from one base seed), computeSymbolicMomentSeed (canonical key includes chamber, primary driver, full pressureSignatures joined, loadScore, directionScore, and magnitude — all rounded with toFixed(2)), four selector functions, and four pool getters. Each branch has 3 phrasings minimum. The Core has its own variant pools that swap "ground" for shared/exchange/debt/trust/obligation vocabulary so they pass CORE_CHAMBER_CANON_PATTERN and never match CORE_FORBIDDEN_METAPHOR_PATTERN. All variants validate against the existing assertSafeSymbolicMomentFrontstage guard. - vessel/src/lib/raven/symbolicMomentFrontstage.ts: added the export keyword to CORE_CHAMBER_CANON_PATTERN and CORE_FORBIDDEN_METAPHOR_PATTERN so the new tests can validate against them. No behavior change. - vessel/src/lib/raven/__tests__/symbolicMomentVariants.test.ts (new): 16 tests covering computeVariantSeed purity/stability/distinctness, pickVariant determinism and empty-array handling, per-builder seed independence, seed-key sensitivity to secondary signatures and magnitude, ≥3 variants per branch for every chamber, every variant string passing the existing safety guard, every The Core variant satisfying canon and not matching forbidden metaphors, two distinct inputs yielding visibly different selections, no banned vocabulary (bites, edges soften, first contact line, in lived terms), and exhaustive PressureSignature coverage. - vessel/package.json: wired the new test file into test:smoke. Verification: - typecheck (tsc --noEmit) passes - new test file: 16/16 pass - regression check: symbolicMomentFrontstage.test.ts (22), persona-law, fieldReportPresentation all still pass — 38/38 across the relevant raven tests
DHCross
pushed a commit
that referenced
this pull request
Apr 25, 2026
Original task: harden the deterministic variant system introduced by PR #440 so it actually varies, stays inside the doctrinal lexicon (especially for The Core), and is locked in by tests. Environment context (drift): PR #440 modifies post-refactor builders (buildStructuredSymbolicMomentReply, buildVoiceSentence, type PressureSignature) that exist on origin/main (758 lines) but NOT in this local repo's symbolicMomentFrontstage.ts (an older 388-line state of main). Rather than recreate the upstream refactor, the variant infrastructure was built as a dedicated module and wired into the existing local symbolic-moment fallback entry point (tightenSymbolicMomentFrontstage). Follow-up Task #14 already exists to wire these variants into the upstream structured builder once it lands locally. What changed: - vessel/src/lib/raven/symbolicMomentVariants.ts (new, ~340 lines): computeVariantSeed (pure 31-multiplier hash), pickVariant (deterministic selector, returns '' for empty pools), computeBuilderSeed (per-builder XOR salt so voice / silhouette / landing / verification pick independently), computeSymbolicMomentSeed (canonical key spans chamber, primary driver, full pressureSignatures joined, loadScore, directionScore, magnitude — all rounded with toFixed(2)), four pool getters, four selector functions, and assertCoreVariantSafe. Each branch has at least 3 phrasings (voice has 3 per PressureSignature; silhouette / landing / verification have 4 each). Doctrinal originals (e.g. "The pressure lands first in {CHAMBER}.") are preserved as variant index [0]. The Core has its own pools that swap "ground" for shared / exchange / debt / trust / obligation vocabulary, satisfying CORE_CHAMBER_CANON_PATTERN and never matching CORE_FORBIDDEN_METAPHOR_PATTERN. Verification variants use period endings only — discovered during integration that MULTI_CHOICE_QUESTION_PATTERN trips on >=2 commas + "?", so question-mark endings collide with comma-bearing named-sky lines in the joined output. - vessel/src/lib/raven/symbolicMomentFrontstage.ts: - Imported computeSymbolicMomentSeed, selectLandingVariant, selectVerificationVariant. - Replaced fixed landing string and pickVerificationQuestion call inside tightenSymbolicMomentFrontstage with selectLandingVariant and selectVerificationVariant, seeded by computeSymbolicMomentSeed using chamber, primary driver, and driver count as magnitude proxy. - Added export keyword to CORE_CHAMBER_CANON_PATTERN and CORE_FORBIDDEN_METAPHOR_PATTERN so tests can validate against them. - vessel/src/lib/raven/__tests__/symbolicMomentVariants.test.ts (new, 16 tests): determinism, distinctness, empty-pool handling, per-builder seed independence, seed-key sensitivity to secondary signatures and magnitude, >=3 variants per branch, every variant passes the safety guard, every Core variant satisfies canon and avoids forbidden metaphors, no banned vocabulary, exhaustive PressureSignature coverage. - vessel/src/lib/raven/__tests__/symbolicMomentFrontstage.test.ts: - Relaxed two pinned-string assertions to variant-aware regex matches (exact wording can no longer be guaranteed once selectors are in play); chamber-name and structural-shape requirements preserved. - Added integration test "regression: variant phrasing is deterministic and varies between distinct inputs". Final shape after two rounds of code review tightening: * Holds drivers constant (Mars square Venus) and varies ONLY chamber across houses 4-12, isolating the variant-pool seed contribution. * Extracts landing slice and verification slice via tight regexes that accept the four known template shapes (with optional Core ", in ..." semantic tail). * Strips the chamber name (.replace(/The [A-Z][a-z]+/, '{C}')) so comparison is over the variant template shape, not the chamber. * Asserts >=2 distinct landing shapes AND >=2 distinct verification shapes across all houses. * Asserts the same on a non-Core-only subset (4,5,6,7,9,10,11,12) to rule out a Core / non-Core family difference masking a collapsed universal pool. * Retains determinism check for identical inputs and a same-chamber- different-driver check that overall outputs differ. - vessel/package.json: wired the new variants test file into test:smoke. (Wiring symbolicMomentFrontstage.test.ts into the smoke runner is tracked separately as follow-up Task #15.) Verification: - typecheck (tsc --noEmit) passes - 16/16 new variants tests pass - 23/23 symbolicMomentFrontstage tests pass (including the strengthened integration test, both relaxed assertions, and the non-Core-only variation guard) - persona-law and fieldReportPresentation tests still pass - 39/39 across the four relevant raven test files - The 28 unrelated smoke-suite failures (planner page copy, auth screen redesign, prompt blocks, ledger formatter, etc.) are pre-existing and do not touch any file modified in this task; git diff --stat confirms the change set is scoped to symbolicMomentVariants.ts, symbolicMomentFrontstage.ts, and the two raven test files. Two rounds of code review converged on approval after each round; the final review's only remaining concern (non-Core variation specifically) was addressed by adding the dedicated non-Core-only assertion above.
Owner
Author
|
@copilot fix conflicts |
…s-for-symbolic-moment # Conflicts: # vessel/src/lib/raven/symbolicMomentFrontstage.ts Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
Contributor
Merged origin/main into this branch and resolved the conflict in |
|
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.



Motivation
Description
computeVariantSeedandpickVarianthelpers to pick deterministic variants from arrays of candidate sentences based on a computed seed.variantSeedthroughbuildVoiceSentence,buildSilhouetteSentence,buildLandingSentence, andbuildVerificationPromptand replace single-line returns withpickVariantcalls that select among alternative phrasings.chamber,primaryDriver.label, the primarypressureSignature, and numeric metrics viacomputeVariantSeedso variants are stable for the same context.variantSeedwhen creating fallback text and when assembling the finalreplyandzone3verification prompt.Testing
yarn test, and no failures were observed.buildStructuredSymbolicMomentReplywith representative sample inputs and verified that the reply sections return one of the expected variant phrasings deterministically for the same input.Codex Task