Phase 7 Step 3d (leaf 1/5): thread config into consensus-extraction#19
Closed
ethanj wants to merge 1 commit intoarchitecture2from
Closed
Phase 7 Step 3d (leaf 1/5): thread config into consensus-extraction#19ethanj wants to merge 1 commit intoarchitecture2from
ethanj wants to merge 1 commit intoarchitecture2from
Conversation
First leaf conversion in the singleton-audit ratcheting sequence. Drops
consensus-extraction.ts from the singleton importer set (33 → 32).
- src/services/consensus-extraction.ts: dropped the `import { config }`
singleton binding. `consensusExtractFacts` now takes config as a
required parameter typed `ConsensusExtractionConfig`
(Pick-style: consensusExtractionEnabled, consensusExtractionRuns,
chunkedExtractionEnabled). The new type is co-located and exported so
orchestration files importing it get the narrow contract.
- src/services/memory-ingest.ts: both call sites (performIngest line 66,
workspace line 191) now pass `deps.config` explicitly. Already had
deps.config in scope — no signature ripple into performIngest/
performWorkspaceIngest callers.
- src/services/memory-service-types.ts: IngestRuntimeConfig gains
chunkedExtractionEnabled, consensusExtractionEnabled,
consensusExtractionRuns so deps.config satisfies the new parameter
type structurally.
- src/__tests__/config-singleton-audit.test.ts: MAX_SINGLETON_IMPORTS
ratcheted 33 → 32 with updated justification comment referencing this
step.
Defaulting location: at the composition root (runtime-container builds
deps.config once from the singleton), not inside the leaf module — so
the leaf file itself no longer binds `config`, which is how it drops
out of the audit. Any alternative where the leaf kept a
"if (!config) fall back to singleton" path would have left the import
in place and made the ratcheting theatre.
963/963 tests pass. tsc --noEmit clean. fallow --no-cache 0 above
threshold.
Plan: phase7-v1-parity item 3d, four leaves remaining
(write-security.ts, cost-telemetry.ts, embedding.ts, llm.ts).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ethanj
added a commit
that referenced
this pull request
Apr 18, 2026
Second leaf conversion. Drops write-security.ts from the singleton importer set (32 → 31). Stacked on PR #19 until it merges. - src/services/write-security.ts: dropped `import { config }`. Both exported functions now take config explicitly: - assessWriteSecurity(content, sourceSite, WriteSecurityAssessConfig) — reads trustScoringEnabled, trustScoreMinThreshold. - recordRejectedWrite(userId, content, sourceSite, decision, WriteSecurityRecordConfig, lessons?) — reads auditLoggingEnabled, lessonsEnabled, trustScoreMinThreshold (the last is used to build the `trust:below-threshold` audit payload, which previously read the singleton at emit time). Two new exported config interfaces (Pick-style) keep the contract narrow; IngestRuntimeConfig satisfies both structurally. - src/services/memory-ingest.ts:143 + src/services/ingest-fact- pipeline.ts:84/130/168/87/170: all 6 call sites thread deps.config. No signature ripple — every caller already had deps in scope. - src/services/memory-service-types.ts: IngestRuntimeConfig gains trustScoringEnabled + trustScoreMinThreshold so deps.config satisfies both new config interfaces structurally. - src/services/__tests__/write-security.test.ts: stopped importing and mutating the runtime config singleton; builds its own config object per test instead. Cleaner — the tests are now pure unit tests with explicit inputs. - src/__tests__/config-singleton-audit.test.ts: MAX_SINGLETON_IMPORTS ratcheted 32 → 31. 963/963 tests pass. tsc --noEmit clean. fallow --no-cache 0 above threshold. Plan: phase7-v1-parity item 3d. Three leaves remain: cost-telemetry.ts, embedding.ts, llm.ts. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
Contributor
Author
|
Superseded — bundling all 3d leaves into a single PR per updated review direction. Leaf 1 commits will land on the combined branch. |
6 tasks
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
Phase 7 Step 3d leaf 1/5 — thread config explicitly through
consensus-extraction.tsinstead of reading the module singleton. First drop in theMAX_SINGLETON_IMPORTSratcheting sequence: 33 → 32.Plan:
atomicmemory-research/docs/core-repo/rearchitecture/phase7-v1-parity/phase7plan.mdItem 3d.What changed
src/services/consensus-extraction.ts— dropped theimport { config }singleton binding.consensusExtractFactsnow takes config as a required parameter typedConsensusExtractionConfig(Pick-style:consensusExtractionEnabled,consensusExtractionRuns,chunkedExtractionEnabled). New type exported.src/services/memory-ingest.ts— both call sites (performIngest, workspace ingest) passdeps.configexplicitly. No signature ripple upstream.src/services/memory-service-types.ts—IngestRuntimeConfiggains the three fields the leaf needs, sodeps.configsatisfies the new parameter type structurally.src/__tests__/config-singleton-audit.test.ts—MAX_SINGLETON_IMPORTSratcheted 33 → 32 with updated comment.Why defaulting happens at the caller, not the leaf
The plan's load-bearing rule: defaulting to the singleton inside the leaf module would keep the
import { config }binding in the file, so the audit count wouldn't drop. Conversion must move the binding out entirely. In this case,deps.configis already built at the composition root (runtime-container.ts) and flows throughMemoryServiceDeps, somemory-ingest.tsthreads it through — no new defaulting infrastructure needed.Test plan
npx tsc --noEmitcleannpm test963/963 pass (no change in count — no new tests, just signature threading)fallow --no-cache0 above thresholdconfig-singleton-audit.test.tspasses at the new threshold 32smoke.test.ts,memory-ingest-runtime-config.test.ts, etc.) continue to work — mock implementations accept fewer args than the real signature, which JavaScript toleratesOut of scope
write-security.ts,cost-telemetry.ts,embedding.ts,llm.ts. Each will land as a separate PR per the plan.process.env.CONSENSUS_MODEread inside the same file (line 44) is not a config-singleton binding, so the audit doesn't flag it. Cleaning that up is a separate concern not covered by Item 3d.🤖 Generated with Claude Code