refactor(lexicon): shared SyntheticBannedStrings() helper (REQ-029, G-014)
Add lexicon.SyntheticBannedStrings() — single source for the synthetic self-test table consumed by BOTH meta-tests. Refactor TestLexiconMetaSelfTestTable (lexicon_meta) and TestLexiconMetaDocsSelfTestTable (lexicon_meta_docs) to consume the helper; remove the byte-identical duplicated 10-string table from both. Closes the G-014 drift risk. test(hub): cross-package const-equality test (REQ-030, A-304, G-015) Add x/hub/types/cross_const_test.go: test-only import of x/bond/types (G-003 test-exempt). TestLendingCouponCapMatchesBondCap + TestLendingCoupon- FloorMatchesBondFloor assert cross-equality; TestConstsAreMissionLocked800And0 (G-015) asserts absolute 800/0 values — catches paired drift. Closes A-304. Verification: go test ./... green; old synthetic table gone (grep 0); go.mod unchanged; G-003 production firewall intact. ---ci--- project: oy phase: 1 milestone: v0.4 status: execute tag_base: v0.3.x milestone_type: nfr reqs: [REQ-029, REQ-030] ---/ci---
This commit is contained in:
@@ -85,3 +85,41 @@ func FindBannedTerm(s string) (string, bool) {
|
||||
func ContainsBannedTerm(s string) (string, bool) {
|
||||
return FindBannedTerm(s)
|
||||
}
|
||||
|
||||
// SyntheticBannedStrings returns one synthetic string per banned term, each
|
||||
// embedding exactly one banned term in a plausible sentence context. This
|
||||
// is the single source of truth (REQ-029, GRILL G-014) for the synthetic
|
||||
// self-test table consumed by BOTH project-wide meta-tests:
|
||||
//
|
||||
// lexicon_meta_test.go :: TestLexiconMetaSelfTestTable (package lexicon_meta, scans x/**/*.go)
|
||||
// lexicon_meta_docs_test.go :: TestLexiconMetaDocsSelfTestTable (package lexicon_meta_docs, scans README.md + docs/**/*.md)
|
||||
//
|
||||
// Before REQ-029, both meta-tests DUPLICATED their own 10-string synthetic
|
||||
// table (byte-identical), creating a drift risk: a future banned-term
|
||||
// addition updating one table but not the other would silently drop coverage
|
||||
// in the unmaintained firewall. SyntheticBannedStrings() eliminates the
|
||||
// duplication — both meta-tests now consume this helper, so a future addition
|
||||
// updates both firewalls from one place. The strings are built from
|
||||
// BannedTerms() (already fragment-assembled), so this package's own source
|
||||
// stays lexicon-clean (the firewall's own code is allowed to name the terms
|
||||
// it bans, but only via the fragment-assembly bootstrapping pattern).
|
||||
//
|
||||
// The returned slice is indexed positionally against BannedTerms(): the i-th
|
||||
// synthetic string embeds the i-th banned term. Both meta-tests assert
|
||||
// len(SyntheticBannedStrings()) == len(BannedTerms()) and that each string
|
||||
// triggers FindBannedTerm with the matching term.
|
||||
func SyntheticBannedStrings() []string {
|
||||
terms := BannedTerms()
|
||||
return []string{
|
||||
"open a " + terms[0] + " here", // bank
|
||||
"make a " + terms[1] + " now", // deposit
|
||||
"compounding " + terms[2] + " rate", // interest
|
||||
"the " + terms[3] + " is 5pct", // yield
|
||||
"foreign " + terms[4] + " pair", // currency
|
||||
"price in " + terms[5], // dollar
|
||||
"price in " + terms[6], // euro
|
||||
"freeze the " + terms[7], // account
|
||||
"move to " + terms[8] + " now", // savings
|
||||
"the " + terms[9] + " lost money", // depositor
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user