chore(i18n): canonicalize business cycle terminology #243
No reviewers
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral!243
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/business-cycle-term-49"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Canonicalize business cycle in backend labels and English admin/KPI copy. Spanish presentation remains in the ES i18n dictionary, and CONTEXT.md cross-references jornada with an explicit avoid list. Closes #49.
The maturity badge and tooltip render in EN/ES from API maturity metadata. Below the threshold, the badge shows
N/target business cycles; HIGH showsN business cycles. The backend suppliessample_maturity.target_count, interpolated through{target}; older responses use the existing 14-cycle fallback. Backend timespan and camera-diagnostic label sets now consistently use English. The retained backend maturity explanation and its schema field are explicitly API-only.Architectural impact
Adds
target_countto the existing sample-maturity metadata; the calibration threshold, algorithm and persistence remain unchanged. UI presentation is localized from maturity level/count/target rather than the API-only English explanation. Historical docs/design-history and docs/audit records are untouched.Merged origin/master at
b64e805into this branch in merge commit30b25c2, after review pass 1. This replaces the previous inaccurate claim that master had been merged before the initial implementation push.Shared test-fixture remediation with #218: the opt-in
isolated_repository_dbfixture now lives intests/conftest.py; business-cycle label tests request it throughpytest.mark.usefixtures. It clearsdatabase_url, redirectsdb_pathto a fresh temporary SQLite database and restores settings through monkeypatch. A temporary compatibility harness using #218’s pushed conftest at20e4889passed all nine label cases. #218 must adopt this fixture while retaining its early session isolation and network/log guards.Verification
Checklist
b64e805) merged after pass 1.WIP: chore(i18n): canonicalize business cycle terminologyto chore(i18n): canonicalize business cycle terminologyRequesting code review, pass 1 against master for spec #49. Implementation is pushed; origin/master was merged immediately before this push (already up to date). All required checks pass: Ruff lint/format, scripts/check_docs.py (42 Markdown files, 80 HTTP operations), full pytest (534 passed through the commit hook), and frontend Node tests (245 passed). Please review terminology coverage, EN/ES maturity/calibration rendering, and preservation of existing calibration behavior.
Code review, pass 1 (
origin/master...a95bff4, spec #49)Result: 1 P2 (raised on both axes) and 10 P3s. Not mergeable yet. This is pass 1, so fix every finding, merge
origin/master(nowb64e805with #178;git merge-treeshows it merges cleanly) and request a second pass.jornada.docs/design-historyanddocs/auditare untouched.git grep -i jornadafinds only Spanish i18n strings, the CONTEXT note and the Spanish test assertions. #178 adds no new occurrences.Spec
P2
P2-1. The English copy still uses other names for the same concept (i18n.js ~1206, 1346, 1348, 1463, 2153; raised on both axes). The spec says: "Adopt 'business cycle' as the single canonical English term everywhere ... (admin labels, KPI copy)". These keys still use other terms:
timespanToday"Active Cycle (24H)"operationalCycle"Operating Cycle"totalIngressDesc,totalEgressDescandpeakTooltip: "current operating cycle"modalRetroactiveDateLabel"Operating Cycle Date"driftHistorySpan"Last 14 cycles"Only
pendingAuditsLabelmoved. An English user sees "Active Cycle", "Operating Cycle" and "business cycles" in one panel, which is the inconsistency #49 exists to remove. Change them all to "business cycle". "Truncated business day" (~2188) is a different glossary term (business day), so leave it.P3
sample_maturity_label = "Calidad del Modelo: Inicial"(app/schemas/occupancy_models.py:604). The computed labels are now English, so the default and the computed value disagree.timespan_labelhas "Active business cycle" next to "Última Hora" and "Últimas N Horas" (occupancy_service.py~475–487).diagnostic_messagehas :1694 in English while :1698–1718 are Spanish.app.js~3514/3523, andtests/frontend/test_business_cycle_i18n.test.js:41asserts it). The HIGH description already drops "/14", so the badge should drop it too.016a012.Standards
P2
docs/agents/domain.md§"Use the glossary's vocabulary".P3
_Avoid_:line (CONTEXT.md:179). Every other §3 entry has one. Add one listing jornada in code or English copy, operating cycle and active cycle.occupancy_service.py:475, 478, 487, 1021, 1025, 1029, 1694). code-standards.md §4.2 requires tests for every service fix.maturity_label(occupancy_service.py:1018–1029) and in the frontenddescriptionKeyternary (app.js:3515–3517). The UI no longer readsmaturity_label, so drop it, or comment it as API-only.app.js:3510says "the backend owns the maturity threshold", but14is hard-coded in four i18n strings per language. Pass it in as a{target}placeholder.app.json'\nfunction '(tests/frontend/test_business_cycle_i18n.test.js:10–11). That breaks silently if a helper is added.badge.title === t(descriptionKey)restates the code under test (line 40). Assert literal strings instead.Pass 1 fixes (
00a9b28)Addressed every finding in review r36. Merged origin/master
b64e805in30b25c2; fixes are ine59ae2b.b64e805; corrected the PR body to identify30b25c2and the merge's timing._Avoid_line for jornada in code/English copy, operating cycle and active cycle.sample_maturity.target_count, sharing the threshold constant with maturity evaluation. Interpolated{target}in ES/EN badge and tooltip copy; retained 14 only as compatibility fallback for old API responses. Tested a non-default target.Verification: Ruff lint/format and documentation checks passed (42 Markdown files, 89 HTTP operations); 563 pytest tests and 248 frontend tests passed. Pre-commit checks also passed on the fixes.
Please run review pass 2 against
00a9b28.Shared SQLite fixture remediation with #218 (
00a9b28)Change on #243: moved the per-test SQLite fixture out of
tests/test_business_cycle_labels.pyintotests/conftest.pyas the opt-inisolated_repository_dbfixture. The label test module requests it withpytestmark = pytest.mark.usefixtures("isolated_repository_db"). The fixture clears the higher-prioritysettings.database_url, redirectssettings.db_pathto a fresh temporary SQLite database, initializes real schema state, and relies on monkeypatch teardown to restore settings. It does not change the session-wide database fixture or make per-test isolation autouse across the suite.Process: read #218's latest pass 1 fixes at
20e4889, compared both conftest implementations, moved the fixture on #243, and ran the nine label cases against #243. Then assembled a temporary harness containing #218's actual pushed conftest plus the shared fixture and the same label tests, and reran those nine cases with the project import path and async configuration. Both runs passed. Ruff lint/format checks and the installed full-suite commit hook passed; the full suite remains 563 tests.Conclusion and adoption: this opt-in fixture coexists with #218's collection-time database isolation and outbound-network/lifecycle-log guards. #243 owns the edit; #218 must adopt the
isolated_repository_dbfixture while preserving its own session bootstrap and guards. Adoption instructions are posted on #218. The compatibility run combines #218's conftest with #243's application code; it does not certify #218's entire branch. Neither PR is merged by this remediation. Pass 2 should review the new #243 head00a9b28.Code review, pass 2 (
origin/master...00a9b28, spec #49)Result: no P1, no P2 and 8 P3s. Mergeable. The P3s are filed as #258–#260.
isolated_repository_dbfixture is justified. It is opt-in, restored by monkeypatch, and merges cleanly with both #218 (20e4889) and #233 (1ec6a32).Spec
active_cycleconcept is correctly untouched.30b25c2)_Avoid_line{target}thresholdP3
A mistranslation.
occupancy_service.py:774renders "Jornada Comercial" (the working-hours preset) as "Business cycle working hours". It should be "Working hours", and the test attests/test_business_cycle_labels.py:55locks the wrong string in. This is the most important item in #258.Some English and Spanish copy still uses the old terms:
nocturnalCycleAndCalibTitle, "SPIKE WINDOW (CYCLES)", "Cycle / Time", "Trusted cycle…"→ #258
Standards
P3
target_countisn't declared inSampleMaturityInfo. It reaches the client only throughextra="allow", so OpenAPI never shows it. → #259mat.target_count ?? 14fallback keeps the hard-coded 14. → #259test_timespan_labels_are_englishsaves and restores the config redundantly, even thoughisolated_repository_dbalready gives it a fresh DB. → #260isolated_test_dbdoesn't clearsettings.database_url, while the new fixture does.gabogg referenced this pull request2026-10-03 11:23:28 +00:00