Repository navigation
refactor(doc): move constant fields out of Settings into domain constants - #392
Merged
Conversation
Move the Reviewer's Guide survey files to backend/passages/data/en_rg, define their location and key table in passages, drop the runtime copy hook, Dockerfile COPY lines and shared_en_rg volume, key the rg filter on resource type, and cache the language-independent parse by path and mtime.
…g slug, safe stet file name generate_docx changes the rendered HTML so it is now Hashed. The passages key caps the language slug with slug_group/MAX_LANGS_SLUG_LEN. The stet file name is built with slug_group and request_key instead of raw language codes.
Move the 14 rendering-constant and domain-table fields (HTML fragments, format strings, HR, PREFERRED_RESOURCES, GATEWAY_LANGUAGES, USFM_RESOURCE_TYPES, RESOURCE_TYPE_CODES_AND_NAMES) out of Settings into immutable Final module constants. Values are unchanged; mappings are MappingProxyType and USFM_RESOURCE_TYPES is a tuple. Defaulted parameters now bind the constants directly, so signatures and call sites are unchanged.
PurpleGuitar
approved these changes
Nov 4, 2026
linearcombination
merged commit Nov 4, 2026
6efad7f
into
WycliffeAssociates:doc-dev.walink.org
8 checks passed
linearcombination
deleted the
DOC/fm/doc-settings-constants-out-of-settings
branch
November 4, 2026 23:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #385. Please let developer handle merge.
Intent
Create a PR for step 1 only of the DOC globals and defaulted-settings refactor: move the constant fields out of the
Settingsobject into plain module constants. The other steps stay on hold.Context: a scout surveyed the DOC backend (report: data/doc-globals-defaults-pattern-scout/report.md, sections 3.2 P5, 4 G2 and 5 M3). It found 14
Settingsfields (about 51 default-parameter sites in about 40 functions) that are rendering constants or domain tables rather than deployment config, such asPREFERRED_RESOURCES,GATEWAY_LANGUAGES,USFM_RESOURCE_TYPES,RESOURCE_TYPE_CODES_AND_NAMES, the*_FMT_STRstrings,HRand the other HTML fragments. None of them appears in the committed.env. Step 1 moves them out ofSettingsinto immutableFinalconstants next to their domain, with no behavior change.What Changed
Settingsinbackend/doc/config.py:PREFERRED_RESOURCES,GATEWAY_LANGUAGES,USFM_RESOURCE_TYPES,RESOURCE_TYPE_CODES_AND_NAMES, the*_FMT_STRstrings,HRand the other HTML fragments. They now live as module-levelFinalconstants in the newbackend/doc/domain/constants.py.Settingsdefaults or attributes. These are the assembly strategies,document_generator,model,parsing,resource_lookupandtw_utilsindoc, plus thepassagesandstetgenerators andstetresource lookup.conftest.pyandtest_randomized_combinatoric.pyto import the constants from their new location. The values themselves are unchanged.🤖 Generated with Claude Code
Risk Assessment
✅ Low: Mechanical relocation of constants into Final module constants with all call sites updated and no leftover Settings references; no behavior change.
Testing
I compared the 14 relocated constants against their old Settings values (identical, and removed from Settings), confirmed no code still reads them from settings, and imported every touched module. The developer ran both backend and frontend tests with success.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Loaded the baseconfig.pyand the newdoc.domain.constantsand compared all 14 moved values. All are equal, and none is still an attribute ofSettings.grepfor leftoversettings.<MOVED_NAME>uses in backend and tests. Only two commented-out lines remain.Imported every touched module (doc, passages and stet document generators, resource lookup, tw_utils, parsing, model, assembly strategies). All import cleanly.pytest tests/uniton the target commit and again on the base commit.- `Developer ran backend and frontend test suites with success`✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.