docs(i18n): resolve message capture ownership and type evidence
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
# B04: disposition of the83 B03 lexical captures
|
||||
|
||||
Research baselinef1c42a52, source evidence1db5f488. The interrupted worker's B04_review.py draft was preserved and completed by root. Two out-of-range evidence blocks were corrected to the actual64-line preview client and36-line extraction model before any successful validation. No application, catalogue, glossary, translation or locale status changed. B03 remains byte-identical.
|
||||
|
||||
All83 capture identities are mapped through43 original source contexts and36 supporting blocks in24 immutable Git blobs:
|
||||
|
||||
| Source role | Captures | Implementation implication |
|
||||
| --- | ---: | --- |
|
||||
| Schema identifiers/stable failure code | 11 | Preserve identities; do not translate section keys, kind values or cv_processing_failed |
|
||||
| Preview headings | 5 | Profile, Experience, Skills, Education and Languages are preview/document display candidates |
|
||||
| Synthetic example values | 20 | Sample occupations, employer/education facts and skills need deliberate document-language fixtures; never rewrite actual career facts |
|
||||
| Model instruction fragments | 19 | These come from eight C# statements, including nested interpolation; they are not19 independent UI messages |
|
||||
| Operator log templates | 26 | Separate diagnostic templates, parameter values and exposure policy from customer notification/UI catalogues |
|
||||
| Audit success feedback | 1 | The admin client currently displays the server message; retain original status values and historical notes when defining its display owner |
|
||||
| Output filename | 1 | Current cover-letter.pdf flows through exporter/HTTP download contracts; preserve it until locale/Unicode compatibility is qualified |
|
||||
|
||||
The review records60 parameter occurrences with declaration/caller evidence and privacy boundaries. Framework Identity Id and Stripe SDK declaration types are explicitly external/uninspected where appropriate; these are not falsely claimed as verified package declarations. Prompt job fields, source descriptions, recruiter details and career text remain original private data. No runtime values were read or exported. UI language and requested document/model output language remain independent.
|
||||
|
||||
Five **technical implementation policies** remain: diagnostics, preview fixtures/headings, model instruction/output language, audit feedback ownership and filenames. These are work to resolve in the appropriate already-gated implementation stages; they do not create five additional mandatory human approvals. Existing predecessor, native-language/publication and live-model gates remain authoritative.
|
||||
|
||||
## Verification
|
||||
|
||||
From repository root:
|
||||
|
||||
```text
|
||||
rtk proxy python docs/i18n/00/B04_review.py
|
||||
rtk proxy python docs/i18n/00/B04_tests.py -v
|
||||
```
|
||||
|
||||
Five research-integrity methods PASS, zero skips; twelve rejected mutations occur inside one method. Source/record/block hashes, exact83 identities, category partition, typed parameter evidence and no-approval statuses are checked. Positive assertions distinguish actual preview headings from schema/example data, model/diagnostic domains, visible audit feedback and filename transport. The validator reconstructs deterministic evidence; it is not a C# compiler, complete AST extractor or independent linguistic review. The generator's --build writes only the new B04 research JSON.
|
||||
|
||||
Native results and input hashes are retained in B04_VALIDATION.json and B04_TEST_RESULTS.txt. Original incomplete-script assertion failures are described above; no product defect or failed translation test is inferred. Root reviewed the original83 expressions and supporting declaration/caller/type blocks. No application build/test/browser/PDF/provider/model/native-language execution occurred.
|
||||
|
||||
## Remaining scope
|
||||
|
||||
All24 EU official-language groups and all60 planned wider-European candidate tags remain mandatory. No locale is newly translated or published. B03's708 other quoted-line frontier, unselected owners, full frontend/sidecar domains, translator context and native/physical/font/device acceptance remain open. Source-role review of83 captures does not close full I18N-00, create translation approval, alter B03's historical provisional counts or unlock stages01–08. Pending product-stage policies remain distinct from unresolved source reachability.
|
||||
@@ -0,0 +1,10 @@
|
||||
test_all_original_captures_keep_exact_identity_and_no_locale_approval (__main__.DispositionIntegrity.test_all_original_captures_keep_exact_identity_and_no_locale_approval) ... ok
|
||||
test_audit_feedback_and_pdf_filename_keep_their_actual_contracts (__main__.DispositionIntegrity.test_audit_feedback_and_pdf_filename_keep_their_actual_contracts) ... ok
|
||||
test_preview_schema_headings_and_example_facts_have_separate_owners (__main__.DispositionIntegrity.test_preview_schema_headings_and_example_facts_have_separate_owners) ... ok
|
||||
test_prompt_fragments_and_diagnostic_values_are_not_ui_messages (__main__.DispositionIntegrity.test_prompt_fragments_and_diagnostic_values_are_not_ui_messages) ... ok
|
||||
test_source_role_type_and_approval_mutations_are_rejected (__main__.DispositionIntegrity.test_source_role_type_and_approval_mutations_are_rejected) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 5 tests in 1.347s
|
||||
|
||||
OK
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"status": "disposition-integrity-only",
|
||||
"sourceCommit": "1db5f488f6138e4f0f33749452b7d9f47658f4b0",
|
||||
"counts": {
|
||||
"occurrences": 83,
|
||||
"contexts": 43,
|
||||
"sourceBlobs": 24,
|
||||
"evidenceBlocks": 36,
|
||||
"parameters": 60,
|
||||
"byRole": {
|
||||
"invariant-schema-or-failure-code": 11,
|
||||
"preview-heading-candidate": 5,
|
||||
"synthetic-example-value": 20,
|
||||
"model-instruction-fragment": 19,
|
||||
"operator-log-template": 26,
|
||||
"audit-feedback-candidate": 1,
|
||||
"output-filename": 1
|
||||
}
|
||||
},
|
||||
"pendingPolicyDecisions": 5,
|
||||
"unreviewedB03OccurrenceIds": [],
|
||||
"inputSha256": {
|
||||
"B03_CENSUS.json": "b4e91fb2c4821cfadcf58445dbc358f20abb26c505c219681757c0ae22f5b8e3",
|
||||
"B04_DISPOSITIONS.json": "d31318dbf69ee26424d2e4fc566b6bb9a7e9c101e4b6dcde0bf6a9155426ada9",
|
||||
"B04_review.py": "b1ec564e3c48a80655d58fbd8e12123f41b09565b2a820cdc7aa9c04af1bfe3c",
|
||||
"B04_tests.py": "0bf500436d81de813c320854667a0cb4d471752bb15ea965ff92687ad3d2682a"
|
||||
},
|
||||
"productNativeLanguageTests": "NOT RUN",
|
||||
"acceptance": "NOT GRANTED",
|
||||
"testCommand": [
|
||||
"C:\\Users\\Connor\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
|
||||
"docs/i18n/00/B04_tests.py",
|
||||
"-v"
|
||||
],
|
||||
"testExitCode": 0,
|
||||
"testsPassed": 5,
|
||||
"mutationsInsideOneTest": 12,
|
||||
"testResultsSha256": "08c8aafe92515507ceb02ca24ebd8787759e6005162493697056e156efd94e56"
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
"""Explicit disposition of B03's 83 captures; research only, no translation approval."""
|
||||
from collections import Counter
|
||||
from functools import lru_cache
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parents[2]
|
||||
SOURCE = '1db5f488f6138e4f0f33749452b7d9f47658f4b0'
|
||||
B03_HASH = 'b4e91fb2c4821cfadcf58445dbc358f20abb26c505c219681757c0ae22f5b8e3'
|
||||
C, S, M, T, UI = 'JobTrackerApi/Controllers/', 'JobTrackerApi/Services/', 'JobTrackerApi/Models/', 'JobTrackerApi.Tests/', 'job-tracker-ui/src/'
|
||||
# Complete containing declarations, followed by supporting type/caller/test contracts.
|
||||
BLOCKS = {
|
||||
'preview': (C+'CvVariantController.cs', 322, 348),
|
||||
'rewrite': (C+'ProfileCvController.cs', 374, 468),
|
||||
'apply-extraction': (C+'ProfileCvController.Pipeline.cs', 253, 307),
|
||||
'artifact-cleanup': (C+'ProfileCvController.Pipeline.cs', 391, 401),
|
||||
'processing': (C+'ProfileCvController.Pipeline.cs', 407, 591),
|
||||
'prune': (C+'ProfileCvController.Pipeline.cs', 604, 646),
|
||||
'completion-mail': (C+'ProfileCvController.Pipeline.cs', 648, 665),
|
||||
'attachment-delete': (C+'AttachmentsController.cs', 171, 252),
|
||||
'attachment-upload': (C+'AttachmentsController.cs', 255, 391),
|
||||
'send': (C+'EmailController.cs', 130, 261),
|
||||
'checkout': (C+'BillingController.cs', 60, 102),
|
||||
'portal': (C+'BillingController.cs', 106, 130),
|
||||
'webhook': (C+'BillingController.cs', 135, 224),
|
||||
'reset-mail': (C+'UsersController.cs', 223, 249),
|
||||
'test-mail': (C+'UsersController.cs', 255, 284),
|
||||
'undo': (C+'AdminAuditController.cs', 118, 194),
|
||||
'letter-render': (S+'CoverLetterDocumentRenderer.cs', 12, 92),
|
||||
'preview-caller': (C+'CvVariantController.cs', 77, 89),
|
||||
'preview-client': (UI+'components/CvTemplateThumbnail.tsx', 1, 64),
|
||||
'render-model-types': (S+'CvRenderModel.cs', 8, 54),
|
||||
'rewrite-request': (C+'ProfileCvController.cs', 148, 159),
|
||||
'rewrite-helpers': (C+'ProfileCvController.cs', 575, 623),
|
||||
'job-types': (M+'JobApplication.cs', 5, 75),
|
||||
'company-types': (M+'Company.cs', 6, 24),
|
||||
'account-types': (M+'ApplicationUser.cs', 5, 40),
|
||||
'run-types': (M+'CvExtraction.cs', 3, 36),
|
||||
'attempt-types': (M+'EmailSendAttempt.cs', 12, 27),
|
||||
'metrics-types': (S+'SummarizerService.cs', 16, 50),
|
||||
'failure-types': (S+'SummarizerService.cs', 71, 84),
|
||||
'undo-client': (UI+'views/AdminAuditPage.tsx', 67, 86),
|
||||
'pdf-http-caller': (C+'ApplicationAssetsController.cs', 105, 122),
|
||||
'pdf-filename': (S+'PlaywrightCvPdfExporter.cs', 50, 61),
|
||||
'rewrite-test': (T+'ProfileCvControllerTests.cs', 844, 935),
|
||||
'letter-test': (T+'CoverLetterDocumentPersistenceTests.cs', 88, 116),
|
||||
'billing-test': (T+'BillingControllerTests.cs', 119, 128),
|
||||
'email-test': (T+'EmailControllerTests.cs', 45, 69),
|
||||
}
|
||||
SCHEMA_POSITIONS = {(20, 0), (20, 2), (21, 0), (21, 2), (24, 0), (24, 2), (25, 0), (25, 2), (26, 0), (26, 2)}
|
||||
HEADING_POSITIONS = {(record, 1) for record in [20, 21, 24, 25, 26]}
|
||||
MODEL_IDS = set(range(47, 55))
|
||||
POLICIES = {
|
||||
'operator-language': 'Define diagnostic language/exposure in its implementation stage; ILogger templates are not notification/UI copy.',
|
||||
'preview-language': 'Qualify translated preview headings and cross-occupation example fixtures; never rewrite real career facts.',
|
||||
'model-language': 'Qualify instruction versus requested output language independently from interface locale; live semantic tests remain blocked.',
|
||||
'audit-display': 'Define server display versus stable code/client rendering; preserve stored status identities and historical event notes.',
|
||||
'filename-language': 'Preserve the current filename until its locale/Unicode/header/client contract is qualified.',
|
||||
}
|
||||
|
||||
def sha(data):
|
||||
return hashlib.sha256(data).hexdigest()
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def blob(path):
|
||||
assert path in {entry[0] for entry in BLOCKS.values()}
|
||||
return subprocess.check_output(['git', 'show', f'{SOURCE}:{path}'], cwd=ROOT)
|
||||
|
||||
def block_for(record):
|
||||
matches = [name for name, (path, start, end) in BLOCKS.items()
|
||||
if path == record['source'] and start <= record['line'] <= end]
|
||||
assert len(matches) == 1, (record['id'], matches)
|
||||
return matches[0]
|
||||
|
||||
def role(record, index, segment):
|
||||
number = int(record['id'].rsplit('-', 1)[1])
|
||||
if (number, index) in SCHEMA_POSITIONS or segment == 'cv_processing_failed':
|
||||
return 'invariant-schema-or-failure-code', None
|
||||
if (number, index) in HEADING_POSITIONS:
|
||||
return 'preview-heading-candidate', 'preview-language'
|
||||
if 20 <= number <= 26:
|
||||
return 'synthetic-example-value', 'preview-language'
|
||||
if number in MODEL_IDS:
|
||||
return 'model-instruction-fragment', 'model-language'
|
||||
if record['boundary'] == 'diagnostic-template':
|
||||
return 'operator-log-template', 'operator-language'
|
||||
if number == 279:
|
||||
return 'audit-feedback-candidate', 'audit-display'
|
||||
if number == 346:
|
||||
return 'output-filename', 'filename-language'
|
||||
raise AssertionError(('undispositioned capture', record['id'], index))
|
||||
|
||||
def parameter_type(name):
|
||||
types = {
|
||||
'SectionName': ('string?', 'rewrite', 'private section/display metadata'),
|
||||
'TemplateId': ('string', 'rewrite-helpers', 'template identifier; preserve identity'),
|
||||
'TargetRole': ('string?', 'rewrite', 'private career/job role'),
|
||||
'JobApplicationId': ('int?', 'rewrite-helpers', 'private owned job identifier'),
|
||||
'HasSourceText': ('bool', 'rewrite', 'presence only, not CV source text'),
|
||||
'StructuredSectionCount': ('int', 'rewrite', 'collection Count, not source content'),
|
||||
'AiHealthy': ('bool', 'metrics-types', 'service health signal'),
|
||||
'AiLastError': ('string?', 'metrics-types', 'upstream diagnostic domain; private values not exported'),
|
||||
'UserId': ('string identity/storage contract; framework Id declaration external', 'account-types', 'private account identifier'),
|
||||
'ArtifactPath': ('string', 'artifact-cleanup', 'private filesystem path'),
|
||||
'RunId': ('int', 'run-types', 'private processing identifier'),
|
||||
'Category': ('string', 'failure-types', 'stable failure category, not translated prose'),
|
||||
'ArtifactId': ('int', 'run-types', 'private artifact identifier'),
|
||||
'Path': ('string', 'run-types', 'private filesystem path'),
|
||||
'AttachmentId': ('int', 'attachment-delete', 'private attachment identifier'),
|
||||
'JobId': ('int', 'attachment-upload', 'private owned job identifier'),
|
||||
'AttemptId': ('Guid', 'attempt-types', 'private delivery-attempt identifier'),
|
||||
'ExceptionType': ('string framework Type.Name contract', 'send', 'exception type name, not full exception text'),
|
||||
'SubscriptionId': ('external Stripe Subscription.Id; string? storage sink confirmed, SDK declaration not inspected', 'account-types', 'private provider identifier'),
|
||||
'Email': ('Identity email value passed to string sender contract; nullable source', 'reset-mail', 'private email address'),
|
||||
'prev': ('string', 'job-types', 'original stored status identifier; preserve value'),
|
||||
'job.Status': ('string', 'job-types', 'restored stored status identifier; preserve value'),
|
||||
}
|
||||
if name in types:
|
||||
value, evidence, sensitivity = types[name]
|
||||
elif name.startswith('jobContext.'):
|
||||
value, evidence, sensitivity = 'string (coalesced where nullable)', 'job-types', 'private job/source-ad/company/recruiter value; preserve original'
|
||||
if 'CompanyName' in name or 'Recruiter' in name:
|
||||
evidence = 'company-types'
|
||||
elif name in {'sectionName', 'effectiveTargetRole', 'tone', 'language', 'promptBackground'}:
|
||||
value, evidence, sensitivity = 'string? input, guarded/coalesced before this interpolation', 'rewrite-request', 'private career/editor input; output language independent of UI'
|
||||
elif name in {'subject', 'style', 'templateGuidance', 'roleGuidance', 'toneGuidance', 'languageGuidance', 'backgroundGuidance'}:
|
||||
value, evidence, sensitivity = 'string expression', 'rewrite', 'composed instruction frame; may contain private runtime values'
|
||||
else:
|
||||
raise AssertionError(('untyped parameter', name))
|
||||
return {'expression': name, 'sourceTypeContract': value, 'evidenceBlock': evidence, 'sensitivity': sensitivity,
|
||||
'runtimeValuesExported': False}
|
||||
|
||||
def build():
|
||||
data = (HERE/'B03_CENSUS.json').read_bytes()
|
||||
assert sha(data) == B03_HASH, 'B03 must remain immutable'
|
||||
prior = json.loads(data)
|
||||
contexts, occurrences = [], []
|
||||
for record in prior['records']:
|
||||
if not record['unresolvedSegments']:
|
||||
continue
|
||||
source = blob(record['source'])
|
||||
line = source.decode('utf-8').splitlines()[record['line'] - 1]
|
||||
assert sha(source) == record['sourceSha256'] and sha(line.encode()) == record['sourceLineSha256']
|
||||
assert line.strip() == record['sourceExpression']
|
||||
parameters = [] if record['boundary'] == 'synthetic-preview-example' else [parameter_type(name)
|
||||
for name in sorted(set(re.findall(r'\{([^{}]+)\}', record['sourceExpression'])))]
|
||||
contexts.append({'recordId': record['id'], 'source': record['source'], 'line': record['line'],
|
||||
'expression': record['sourceExpression'], 'sourceLineSha256': record['sourceLineSha256'],
|
||||
'containingDeclaration': block_for(record), 'parameters': parameters,
|
||||
'note': 'Full statement/declaration is authoritative; lexical fragments are not independent messages.'})
|
||||
for index, segment in enumerate(record['unresolvedSegments']):
|
||||
category, policy = role(record, index, segment)
|
||||
occurrences.append({'id': f'{record["id"]}:U{index + 1:02}', 'recordId': record['id'],
|
||||
'unresolvedIndex': index, 'originalLexicalCapture': segment, 'sourceRole': category,
|
||||
'sourceRoleReviewed': True, 'pendingPolicy': policy, 'translationApproved': False,
|
||||
'runtimeReview': 'not-run', 'nativeReview': 'not-run'})
|
||||
blocks = []
|
||||
for name, (path, start, end) in BLOCKS.items():
|
||||
raw = blob(path)
|
||||
lines = raw.splitlines(keepends=True)
|
||||
assert 1 <= start <= end <= len(lines), name
|
||||
blocks.append({'id': name, 'source': path, 'startLine': start, 'endLine': end,
|
||||
'sourceSha256': sha(raw), 'rawBlockSha256': sha(b''.join(lines[start - 1:end])),
|
||||
'firstLine': lines[start - 1].decode().strip(), 'lastLine': lines[end - 1].decode().strip()})
|
||||
assert len(occurrences) == 83
|
||||
return {'status': 'research-disposition-only', 'sourceCommit': SOURCE, 'immutableB03Sha256': B03_HASH,
|
||||
'contexts': contexts, 'occurrences': occurrences, 'evidenceBlocks': blocks,
|
||||
'policyDecisionsPending': POLICIES, 'counts': {'occurrences': len(occurrences),
|
||||
'contexts': len(contexts), 'sourceBlobs': len({block['source'] for block in blocks}),
|
||||
'evidenceBlocks': len(blocks), 'parameters': sum(len(context['parameters']) for context in contexts),
|
||||
'byRole': dict(Counter(item['sourceRole'] for item in occurrences))},
|
||||
'productTestsExecuted': False, 'nativeLanguageApproval': False, 'localeOrStageAcceptance': 'NOT GRANTED'}
|
||||
|
||||
def validate(payload):
|
||||
assert payload == build(), 'source, coverage, disposition, type evidence or approval drift'
|
||||
assert len({row['id'] for row in payload['occurrences']}) == 83
|
||||
assert all(not row['translationApproved'] for row in payload['occurrences'])
|
||||
return {'status': 'disposition-integrity-only', 'sourceCommit': SOURCE, 'counts': payload['counts'],
|
||||
'pendingPolicyDecisions': len(POLICIES), 'unreviewedB03OccurrenceIds': [],
|
||||
'inputSha256': {name: sha((HERE/name).read_bytes()) for name in ['B03_CENSUS.json', 'B04_DISPOSITIONS.json', 'B04_review.py', 'B04_tests.py']},
|
||||
'productNativeLanguageTests': 'NOT RUN', 'acceptance': 'NOT GRANTED'}
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if sys.argv[1:] == ['--build']:
|
||||
(HERE/'B04_DISPOSITIONS.json').write_text(json.dumps(build(), ensure_ascii=False, indent=2)+'\n', encoding='utf-8')
|
||||
else:
|
||||
print(json.dumps(validate(json.loads((HERE/'B04_DISPOSITIONS.json').read_text(encoding='utf-8'))), indent=2))
|
||||
@@ -0,0 +1,85 @@
|
||||
"""Research evidence tests only; never change application or locale status."""
|
||||
import copy
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
import B04_review as review
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
class DispositionIntegrity(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.payload = json.loads((HERE/'B04_DISPOSITIONS.json').read_text(encoding='utf-8'))
|
||||
|
||||
def test_all_original_captures_keep_exact_identity_and_no_locale_approval(self):
|
||||
result = review.validate(self.payload)
|
||||
self.assertEqual(83, result['counts']['occurrences'])
|
||||
prior = json.loads((HERE/'B03_CENSUS.json').read_text(encoding='utf-8'))
|
||||
original = {(row['id'], i, value) for row in prior['records']
|
||||
for i, value in enumerate(row['unresolvedSegments'])}
|
||||
current = {(row['recordId'], row['unresolvedIndex'], row['originalLexicalCapture'])
|
||||
for row in self.payload['occurrences']}
|
||||
self.assertEqual(original, current)
|
||||
self.assertEqual('NOT GRANTED', result['acceptance'])
|
||||
self.assertFalse(self.payload['productTestsExecuted'])
|
||||
|
||||
def test_preview_schema_headings_and_example_facts_have_separate_owners(self):
|
||||
headings = [row['originalLexicalCapture'] for row in self.payload['occurrences']
|
||||
if row['sourceRole'] == 'preview-heading-candidate']
|
||||
self.assertEqual(['Profile', 'Experience', 'Skills', 'Education', 'Languages'], headings)
|
||||
self.assertEqual(20, self.payload['counts']['byRole']['synthetic-example-value'])
|
||||
codes = [row['originalLexicalCapture'] for row in self.payload['occurrences']
|
||||
if row['sourceRole'] == 'invariant-schema-or-failure-code']
|
||||
self.assertIn('cv_processing_failed', codes)
|
||||
self.assertIn('experience', codes)
|
||||
self.assertNotIn('Experience', codes)
|
||||
|
||||
def test_prompt_fragments_and_diagnostic_values_are_not_ui_messages(self):
|
||||
roles = self.payload['counts']['byRole']
|
||||
self.assertEqual(19, roles['model-instruction-fragment'])
|
||||
self.assertEqual(26, roles['operator-log-template'])
|
||||
expressions = {parameter['expression']: parameter for context in self.payload['contexts']
|
||||
for parameter in context['parameters']}
|
||||
self.assertEqual('bool', expressions['AiHealthy']['sourceTypeContract'])
|
||||
self.assertEqual('Guid', expressions['AttemptId']['sourceTypeContract'])
|
||||
self.assertTrue(all(not parameter['runtimeValuesExported'] for parameter in expressions.values()))
|
||||
self.assertIn('SDK declaration not inspected', expressions['SubscriptionId']['sourceTypeContract'])
|
||||
|
||||
def test_audit_feedback_and_pdf_filename_keep_their_actual_contracts(self):
|
||||
audit = next(row for row in self.payload['occurrences'] if row['sourceRole'] == 'audit-feedback-candidate')
|
||||
filename = next(row for row in self.payload['occurrences'] if row['sourceRole'] == 'output-filename')
|
||||
self.assertEqual('I00-B03-0279', audit['recordId'])
|
||||
self.assertEqual('cover-letter.pdf', filename['originalLexicalCapture'])
|
||||
audit_block = next(block for block in self.payload['evidenceBlocks'] if block['id'] == 'undo-client')
|
||||
source = review.blob(audit_block['source']).decode('utf-8')
|
||||
self.assertIn('res.data?.message || currentTranslation.current', source)
|
||||
self.assertFalse(audit['translationApproved'])
|
||||
|
||||
def test_source_role_type_and_approval_mutations_are_rejected(self):
|
||||
mutations = [
|
||||
lambda d: d['occurrences'].pop(),
|
||||
lambda d: d['occurrences'].append(copy.deepcopy(d['occurrences'][0])),
|
||||
lambda d: d['occurrences'][0].update(sourceRole='translation-ready'),
|
||||
lambda d: d['occurrences'][0].update(translationApproved=True),
|
||||
lambda d: d['contexts'][0].update(expression='forged'),
|
||||
lambda d: d['contexts'][0].update(sourceLineSha256='0'*64),
|
||||
lambda d: d['evidenceBlocks'][0].update(rawBlockSha256='0'*64),
|
||||
lambda d: d.update(sourceCommit='main'),
|
||||
lambda d: d.update(nativeLanguageApproval=True),
|
||||
lambda d: d.update(localeOrStageAcceptance='PASS'),
|
||||
lambda d: d['counts'].update(occurrences=0),
|
||||
lambda d: d['contexts'][-1].update(parameters=[{'sourceTypeContract': 'forged'}]),
|
||||
]
|
||||
for index, mutate in enumerate(mutations):
|
||||
with self.subTest(mutation=index):
|
||||
changed = copy.deepcopy(self.payload)
|
||||
mutate(changed)
|
||||
with self.assertRaises(AssertionError):
|
||||
review.validate(changed)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user