Skip to content

feat(agent-builder): raise prompt-hint clamp to 350#1139

Merged
saulmc merged 1 commit into
devfrom
saulmc/hint-char-limit-350
Jul 7, 2026
Merged

feat(agent-builder): raise prompt-hint clamp to 350#1139
saulmc merged 1 commit into
devfrom
saulmc/hint-char-limit-350

Conversation

@saulmc

@saulmc saulmc commented Jul 6, 2026

Copy link
Copy Markdown
Member

Raise the client-side prompt-hint clamp from 240 to 350 (PromptHintsModel.Constant.maxHintLength) so served hints up to the new backend cap aren't truncated in the composer. Doc comments updated; the clamp test now feeds a 400-char hint and asserts a 350-char result.

Part of a coordinated 4-repo change raising the curated dice prompt-hint cap 240→350. The backend PR is the gate and should merge first. Note: already-shipped app builds keep clamping to 240, so hints of 241–350 chars truncate there until users update.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jp2NeQiZiBavQCgyPZVZKd


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Note

Raise PromptHintsModel hint clamp limit from 240 to 350 characters

Updates PromptHintsModel.Constant.maxHintLength from 240 to 350 to match the updated backend contract. Documentation in ConvosAPIClient+Models.swift is updated to reflect the new limit, and tests in PromptHintsModelTests.swift are adjusted accordingly.

Macroscope summarized f72197f.

Raise the client-side clamp (maxHintLength) from 240 to 350 so hints up
to the new backend cap aren't truncated in the composer. Clamp test now
feeds a 400-char hint and asserts 350.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jp2NeQiZiBavQCgyPZVZKd
@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown

Claude finished @saulmc's task —— View job


Code Review Complete ✅

Tasks

  • Read changed files
  • Review code quality and conventions
  • Check test coverage
  • Provide comprehensive feedback

Review Summary

This is a clean, well-coordinated change raising the prompt hint character limit from 240 to 350. The implementation is correct and follows project conventions.

✅ Strengths

1. Consistency Across Changes

  • All three files updated coherently (constant, doc comment, test)
  • Test validates the new 350-char clamp with a 400-char input (PromptHintsModelTests.swift:68-74)
  • Doc comments accurately reflect the new limit

2. Code Quality

  • Follows project conventions (no force unwrapping, proper Swift style)
  • Clear variable naming and type annotations
  • Good test coverage of the clamp behavior

3. Documentation

  • Doc comment at PromptHintsModel.swift:107 correctly states "350-char contract"
  • API model doc comment at ConvosAPIClient+Models.swift:336 accurately documents "<= 350 chars"
  • Test assertion message at line 74 references "350-char contract"

🔍 Observations

No Issues Found - The change is technically sound:

  • Constant update: maxHintLength: Int = 350 (PromptHintsModel.swift:120)
  • Test validation: Asserts 400-char input → 350-char output (PromptHintsModelTests.swift:74)
  • All documentation synchronized

Backwards Compatibility Note (already documented in PR description):

  • Older app builds will continue clamping to 240 chars
  • This is expected behavior until users update
  • Backend coordination is appropriately gated (backend should merge first)

📋 Test Coverage

The test suite properly validates:

  • ✅ Disk hydration (testHydratesFromDiskOnInit)
  • ✅ Successful refresh overwrites (testRefreshOverwritesMemoryAndDiskOnSuccess)
  • ✅ Failed fetch retention (testRetainsLastGoodOnFetchFailure)
  • ✅ Empty payload guard (testEmptyPayloadDoesNotWipeCache)
  • New clamp limit (testSanitizeTrimsDropsEmptyAndClamps - validates 350-char clamp)
  • ✅ Single fetch guarantee (testLoadOnLaunchRunsOnlyOnce)

The updated test at line 68-74 properly validates the new behavior with:

let long = String(repeating: "x", count: 400)
// ... 
XCTAssertEqual(model.hints.last?.count, 350, "Hints are clamped to the 350-char contract")

🎯 Recommendations

No Changes Required - This PR is ready to merge once:

  1. Backend PR merges first (as noted in description)
  2. CI passes

Security & Performance

  • ✅ No security concerns
  • ✅ No performance impact (simple integer constant change)
  • ✅ No new dependencies or external calls
  • ✅ Proper input validation (clamping prevents unbounded strings)

Verdict: Approve ✅ - Clean implementation, well-tested, properly documented.


@macroscopeapp

macroscopeapp Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Simple constant change raising the prompt hint character limit from 240 to 350. Updates are limited to the constant value, documentation comments, and corresponding test assertions with no new logic or behavior changes.

You can customize Macroscope's approvability policy. Learn more.

@saulmc saulmc requested a review from yewreeka July 6, 2026 17:54
@saulmc saulmc merged commit dadb7ef into dev Jul 7, 2026
11 checks passed
@saulmc saulmc deleted the saulmc/hint-char-limit-350 branch July 7, 2026 18:26
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.

1 participant