Repository navigation
fix(campaign): publish search estimate method with package proof - #925
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved PR — 0721e11d
Blanket team auto-approval is intentional. This is not a code review.
No automated review runs on this PR. This approval rests on the rule above alone.
tangletools · auto-approval · reason: blanket_auto_approve · 2026-10-04T02:32:49Z
drewstone
left a comment
There was a problem hiding this comment.
Summary
- This PR exports the existing searchEstimateMethod function from the campaign package public surface, adds a compile-time & runtime check into scripts/verify-package-exports.mjs, and updates docs/public-api.md to reflect the newly published symbol. The change is small and focused; it appears correct and safe.
Files changed
- docs/public-api.md
- scripts/verify-package-exports.mjs
- src/campaign/index.ts
Detailed review (file:line findings)
- src/campaign/index.ts
- Change: new re-export entry added
- Added lines (approx): 112–114
- export {
...
searchCellSetDigest,
searchEstimateMethod,
searchPosterior,
} from './estimate-node'
- export {
- Added lines (approx): 112–114
- Findings:
- Correctness: The function searchEstimateMethod is implemented in src/campaign/estimate-node.ts (see estimate-node.ts:74–79) and previously was only available via the internal path. Re-exporting it here correctly exposes the runtime function from the public campaign subpath.
- Types: index.ts already re-exports the SearchEstimateMethod type from the search-ledger types elsewhere; re-exporting the function is consistent with publicly exposing the runtime helper and its type.
- Import hygiene: Many internal modules import searchEstimateMethod directly from '../../campaign/estimate-node' (see e.g. src/search/lenses/shared.ts:11). Re-exporting on the campaign public surface does not break those internal imports and is a reasonable convenience for external consumers. No circular import appears introduced by this re-export (estimate-node imports lower-level modules and not index.ts), so no dependency cycle is introduced.
- Suggestion: consider whether other internal callers should switch to importing from the public surface for consistency; not necessary but could be a follow-up.
- src/campaign/estimate-node.ts
- Context: Function implementation exists and is unchanged.
- Relevant lines: 74–79:
- export function searchEstimateMethod(pairs: number): SearchEstimateMethod {
if (pairs < 2) return 'none'
if (pairs < DESCRIPTIVE_FROM) return 'insufficient'
if (pairs < BOOTSTRAP_GATE_MIN_N) return 'descriptive'
return 'bootstrap'
}
- export function searchEstimateMethod(pairs: number): SearchEstimateMethod {
- Relevant lines: 74–79:
- Findings:
- Correctness: The mapping of pairs -> method is straightforward and well-documented in comments above. Constants used (DESCRIPTIVE_FROM, BOOTSTRAP_GATE_MIN_N) are defined sensibly: DESCRIPTIVE_FROM computed via minimumPairsForPairedDeltaTest(CONFIDENCE) (which returns 6 for confidence 0.95) and BOOTSTRAP_GATE_MIN_N = 20. The test matrix added in the script matches these thresholds: 0/1 -> 'none', 2–5 -> 'insufficient', 6–19 -> 'descriptive', >=20 -> 'bootstrap'.
- No change here; only being published.
- scripts/verify-package-exports.mjs
- Change: added compile-time type equality check and runtime cases for searchEstimateMethod.
- Added import (approx lines 722–727):
- import {
searchEstimateMethod,
type SearchEstimateMethod,
} from '@tangle-network/agent-eval/campaign'
- import {
- Added type equality and runtime checks (approx 749–776):
- const searchEstimateMethodMatches: Equal<ReturnType, SearchEstimateMethod> = true
- const searchEstimateCases: [number, SearchEstimateMethod][] = [ ... ]
- for (const [pairs, expected] of searchEstimateCases) { ... }
- Also added the symbol to the grouping of "void [ ... ]" (approx new ordering includes searchEstimateMethodMatches).
- Added import (approx lines 722–727):
- Findings:
- Correctness: The test covers both a type-level assertion (Equal<...> = true) and a small runtime sanity check matching expected outputs for representative inputs (0,1,2,5,6,19,20,100). As noted above, these correspond to the thresholds in estimate-node.ts (none/insufficient/descriptive/bootstrap).
- Testing approach: This is a good addition — the script verifies that the exported runtime behaves as its declared type and provides canonical behaviour. The sample inputs include boundary values (1/2, 5/6, 19/20) which is appropriate.
- Suggestion: You might include explicit comments noting where DESCRIPTIVE_FROM and BOOTSTRAP_GATE_MIN_N come from, but not required.
- Organization: The import path used in the script is '@tangle-network/agent-eval/campaign' which will pick up the newly exported symbol; this is exactly the intent.
- docs/public-api.md
- Changes:
- Updated counts: published value exports and distinct symbols increased by 1 each, and production increased by 1 (lines near top).
- Under ./campaign symbol table: added |
searchEstimateMethod| production | this package: src/search/lenses/edit-credit.ts:34 |
- Findings:
- Correctness: This correctly documents that searchEstimateMethod is now part of the campaign public API and marks it production.
- Suggestion: The evidence points to src/search/lenses/edit-credit.ts:34, which currently imports searchEstimateMethod from '../../campaign/estimate-node' (internal path). If the canonical public surface is now the campaign subpath, consider updating internal reference evidence to point to the public subpath (minor doc nit).
Security considerations
- No new remote network access, secret handling, or eval-like constructs were added.
- The runtime check in scripts/verify-package-exports.mjs runs deterministic, pure functions and throws on mismatch; this is safe.
- The exported function is purely computational and deterministic; exposing it publicly is low risk.
Performance / Efficiency
- No runtime performance change: only a re-export and a small script test were added.
- The verify script runs a tiny loop over 8 cases; negligible cost.
Compatibility / API considerations
- Publishing searchEstimateMethod expands the public surface. This is backwards-compatible (additive).
- If consumers had previously imported it via internal paths, they can switch to the public path; maintainers should decide whether to keep the internal path import usage or migrate internal callers for consistency.
- No change to types or semantics of the function; behaviour is the same.
Suggestions / minor improvements
- (Docs) When documenting the new symbol in docs/public-api.md, you might prefer the evidence to point to the new public path or to the implementation location for clarity.
- (Code hygiene) Consider consolidating internal imports to the public surface where appropriate to reduce direct internal-path coupling (optional).
- (Verify script) The test is good; consider adding an explicit message on thrown Error to make failure debugging easier (the script currently throws a generic Error('packed search estimate method for ' + pairs + ...), which is okay but could include the actual method result).
Summary / overall verdict
- The changes are correct, minimal, and safe. The PR does what it claims: publishes searchEstimateMethod on the campaign package public surface, updates the public API documentation, and adds a compile-time and runtime check to package-export verification. No functional regressions or security concerns are apparent. I recommend merging.
Why
[tool result]
src/campaign/estimate-node.tsimplements the canonicalsearchEstimateMethod(pairs), but the campaign barrel did not expose that function. This PR makes the existing staging function available from@tangle-network/agent-eval/campaign.[tool result] This is the agent-eval implementation for the requested ops-board #1528 half. The diff contains three files in agent-eval. Existing PRs #923 and #924 overlap this change; this PR includes the generated census and executed public-package proof.
Changes
searchEstimateMethodbeside the existing estimate-node exports insrc/campaign/index.ts. Preserve the already-publicSearchEstimateMethodtype from its canonicalsearch-ledgerexport. Readingsrc/index.tsconfirmed it does not mirror the search estimator APIs, so the specialized entry remains/campaign.scripts/verify-package-exports.mjs. It imports the function and type from the actual packed@tangle-network/agent-eval/campaignentry, compiles an exact return-type check, and executes eight cases: 0/1 → none; 2/5 → insufficient; 6/19 → descriptive; 20/100 → bootstrap.docs/public-api.mdwithpnpm api:census: campaign value exports increase from 168 to 169 and the canonical function has an existing production caller. The complete regeneration also refreshes existing evidence references. A second regeneration produced identical bytes.Validation
[tool result] Validated the complete source tree against main
5d552e5583953e66649db85024a96badc1726477before editing. The connector-created commit tree matches the tested local tree exactly.pnpm api:censuspnpm lintsrc/campaign/execute-cell.ts:158.pnpm typecheckpnpm buildnode scripts/verify-package-exports.mjspnpm test(final full run)git diff --check[tool result] The initial full test run had one failure:
src/analyst/prime-bridge-transport.test.ts:103:3,accepts https and refuses any other scheme, reportedError: Test timed out in 5000ms.(6,093 passed, 1 failed, 5 skipped). That test passed alone on exact main, and the final unchanged full-suite run passed. No timeout, test, or skip configuration was changed.Verification limitation
[tool result]
pnpm verify:packagepassed its preceding checks, publint, attw, and the packed-export guard, then exited 1 attsx scripts/emit-finding-contract.ts --checkwithError: listen EPERM: operation not permitted /tmp/tsx-0/458.pipe.[tool result] Both remaining check implementations passed through the Node loader without the CLI IPC server:
node --import tsx scripts/emit-finding-contract.ts --check→ finding contract fresh, version 1, 22 subject patterns.node --import tsx scripts/render-evidence-index.ts --check→ evidence index fresh, 10 records.[absence] The aggregate
pnpm verify:packageinvocation did not exit successfully. The Python/official-optimizer CI jobs and remote CI results are not claimed here.[tool result] Local validation used Node 24.19.0 and the available pnpm 11.25.0 runtime. Installed TypeScript 7.0.2, tsdown 0.23.0, and Vitest 5.0.1 match the repository declarations. [absence] Validation under the declared pnpm 12.6.0 / CI Node 22 environment has not been run.
Independent verification (fleet delivery)
Built and opened by a ChatGPT Pro session on slot c (chatgpt-fleet item it-125acca368) after slots a and b reported no GitHub write functions. A Claude session verified it on drew-gtr-pro with Node 22.23.2 and pnpm 12.6.0:
git merge-tree --write-tree origin/main HEAD: clean.pnpm install --frozen-lockfile,pnpm build,pnpm typecheck,pnpm typecheck:scripts,pnpm lint: all exit 0.node scripts/verify-package-exports.mjs: exit 0. Withmain'ssrc/campaign/index.tsit exits 1 withTS2724: '@tangle-network/agent-eval/campaign' has no exported member named 'searchEstimateMethod', so the new packed-entry check detects a missing export.pnpm test: 414 files and 6,096 tests passed, 3 skipped.docs/public-api.mdwas regenerated withpnpm api:census; besides the new row it picks up existing drift (System One doc paths, ataskMatrixevidence line number).This is part 1 of ops-board 1528; blueprint-agent's
MIN_RATE_UNITSadoption follows the next agent-eval release.