Sitelet https://github.com/tangle-network/agent-eval/pull/925
Skip to content

fix(campaign): publish search estimate method with package proof - #925

Merged
drewstone merged 1 commit into
mainfrom
fix/ops-1528-public-search-estimator
Oct 4, 2026
Merged

drewstone merged 1 commit into
mainfrom
fix/ops-1528-public-search-estimator

Conversation

@drewstone

@drewstone drewstone commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Why

[tool result] src/campaign/estimate-node.ts implements the canonical searchEstimateMethod(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

  • [tool result] Add searchEstimateMethod beside the existing estimate-node exports in src/campaign/index.ts. Preserve the already-public SearchEstimateMethod type from its canonical search-ledger export. Reading src/index.ts confirmed it does not mirror the search estimator APIs, so the specialized entry remains /campaign.
  • [tool result] Extend the existing packed consumer in scripts/verify-package-exports.mjs. It imports the function and type from the actual packed @tangle-network/agent-eval/campaign entry, compiles an exact return-type check, and executes eight cases: 0/1 → none; 2/5 → insufficient; 6/19 → descriptive; 20/100 → bootstrap.
  • [tool result] Regenerate docs/public-api.md with pnpm 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.
  • [tool result] The estimator implementation, thresholds, package versions, dependency lockfile, and blueprint-agent are unchanged.

Validation

[tool result] Validated the complete source tree against main 5d552e5583953e66649db85024a96badc1726477 before editing. The connector-created commit tree matches the tested local tree exactly.

Command Result
pnpm api:census [tool result] Passed; repeat generation was byte-identical.
pnpm lint [tool result] Passed; one existing useTemplate warning in src/campaign/execute-cell.ts:158.
pnpm typecheck [tool result] Passed.
pnpm build [tool result] Passed, including OpenAPI generation.
node scripts/verify-package-exports.mjs [tool result] Passed on the final build; compiled and executed the new packed-entry regression.
pnpm test (final full run) [tool result] Passed: 414 files passed, 2 skipped; 6,094 tests passed, 5 skipped.
git diff --check [tool result] Passed.

[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, reported Error: 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:package passed its preceding checks, publint, attw, and the packed-export guard, then exited 1 at tsx scripts/emit-finding-contract.ts --check with Error: 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:package invocation 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. With main's src/campaign/index.ts it exits 1 with TS2724: '@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.md was regenerated with pnpm api:census; besides the new row it picks up existing drift (System One doc paths, a taskMatrix evidence line number).

This is part 1 of ops-board 1528; blueprint-agent's MIN_RATE_UNITS adoption follows the next agent-eval release.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T02:34:34.289572Z 0721e11 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 drewstone left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. docs/public-api.md
  2. scripts/verify-package-exports.mjs
  3. src/campaign/index.ts

Detailed review (file:line findings)

  1. src/campaign/index.ts
  • Change: new re-export entry added
    • Added lines (approx): 112–114
      • export {
        ...
        searchCellSetDigest,
        searchEstimateMethod,
        searchPosterior,
        } from './estimate-node'
  • 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.
  1. 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'
        }
  • 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.
  1. 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'
    • 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).
  • 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.
  1. 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.

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.

2 participants