checkpoint before checking out main

This commit is contained in:
Rocky
2026-08-25 13:42:00 +08:00
parent 57844ce615
commit dccafe6f9e
105 changed files with 4302 additions and 1323 deletions
@@ -1,7 +1,7 @@
// PolishStyleLearningServiceTests.swift
// OSGKeyboard · Tests
//
// Verifies corpus eligibility, the 5,000-character gate, and that style
// Verifies corpus eligibility, the 2,500-character gate, and that style
// generation receives both paired examples and the prompts that produced them.
@testable import OSGKeyboardShared
@@ -54,7 +54,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
XCTAssertEqual(corpus.examples.count, 1)
XCTAssertEqual(corpus.examples.first?.polishStyleID, "builtin.light")
XCTAssertEqual(corpus.effectiveCharacterCount, 7)
XCTAssertEqual(corpus.remainingCharacterCount, 4_993)
XCTAssertEqual(corpus.remainingCharacterCount, 2_493)
XCTAssertFalse(corpus.isReady)
}
@@ -74,8 +74,8 @@ final class PolishStyleLearningServiceTests: XCTestCase {
XCTAssertEqual(corpus.effectiveCharacterCount, 7)
}
func testCorpusUnlocksAtFiveThousandEffectiveCharacters() {
let text = String(repeating: "", count: 5_000)
func testCorpusUnlocksAtTwoThousandFiveHundredEffectiveCharacters() {
let text = String(repeating: "", count: 2_500)
let corpus = PolishStyleLearningCorpusBuilder.build(
from: [
SpeechHistoryEntry(
@@ -86,7 +86,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
]
)
XCTAssertEqual(corpus.effectiveCharacterCount, 5_000)
XCTAssertEqual(corpus.effectiveCharacterCount, 2_500)
XCTAssertEqual(corpus.remainingCharacterCount, 0)
XCTAssertTrue(corpus.isReady)
}
@@ -108,7 +108,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
store.setPolishStyleCatalog(catalog)
store.setActivePolishStyleId(activeStyle.id)
let source = String(repeating: "测试语料", count: 1_250)
let source = String(repeating: "测试语料", count: 625)
let corpus = PolishStyleLearningCorpus(
examples: [
PolishStyleLearningExample(
@@ -120,7 +120,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
createdAt: Date()
)
],
effectiveCharacterCount: 5_000
effectiveCharacterCount: 2_500
)
let client = StyleLearningCapturingClient(
response: ##"{"name":"","prompt":"# \n自然直接\n# \n不改变原意\n# \n输入 ","allowsAddedEmoji":false}"##
@@ -156,7 +156,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
createdAt: Date()
)
],
effectiveCharacterCount: 5_000
effectiveCharacterCount: 2_500
)
let service = PolishStyleLearningService(
store: store,
@@ -169,7 +169,7 @@ final class PolishStyleLearningServiceTests: XCTestCase {
} catch let error as PolishStyleLearningError {
XCTAssertEqual(
error,
.insufficientCorpus(required: 5_000, actual: 5)
.insufficientCorpus(required: 2_500, actual: 5)
)
} catch {
XCTFail("Unexpected error: \(error)")