Phase 3: VISUAL feed and M-Files drawings in the worker
Migration 0004 (VISUAL and drawing caches, go-live ignored list, resource map, job tables, order-derived columns with provenance; work order key includes the operation sequence). The real worker on APScheduler with settings re-read each fire, pause, run now, advisory locks, job_runs and a heartbeat. The visual-feed job (five VisualKit reads, COPY and MERGE cache, suspect-batch guard, the apply in one transaction: drafts, change orders, retire-moved, work order gone, closed and cancelled observed, projects and units from order links, auto-release) and the fingerprint. The drawing-lookup job (queue, budget, download on version change, sha256 into assets, decision table, staging for rev approval, drawing-origin change orders). Clerical From VISUAL panel, flags, rev approval, hand uploads, change-order review; Admin Feed settings and resource map. Synthetic fixture generator and a fixture-driven worker in CI with a Playwright scenario. Docs updated. Verified: 3249 server tests and 13 Playwright scenarios on the docker-1 CI stack, 76 frontend tests, doctor at 0004; one feed and one drawing run against VISUAL DEV and the vault from the developer machine (counts in the changelog). Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -12,6 +12,8 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
ENV_FILE_VAR = "PS_ENV_FILE"
|
||||
Stack = Literal["prod", "test", "ci", "dev"]
|
||||
FeedSource = Literal["visualkit", "fixture"]
|
||||
DrawingSource = Literal["mfiles", "fixture"]
|
||||
|
||||
|
||||
class SecretFileError(Exception):
|
||||
@@ -101,6 +103,11 @@ class Settings(BaseSettings):
|
||||
pin_max_digits: int = Field(default=12, ge=4)
|
||||
upload_max_bytes: int = Field(default=25 * 1024 * 1024, ge=1024)
|
||||
|
||||
# Where the worker reads VISUAL and M-Files from. `fixture` reads synthetic files under FIXTURE_DIR (CI and tests).
|
||||
feed_source: FeedSource = "visualkit"
|
||||
drawing_source: DrawingSource = "mfiles"
|
||||
fixture_dir: Path = Path("/fixtures")
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _blank_is_unset(cls, data: Any) -> Any:
|
||||
@@ -110,7 +117,7 @@ class Settings(BaseSettings):
|
||||
if key.lower() in _OPTIONAL_PATHS and data[key] in ("", None):
|
||||
data[key] = None
|
||||
for key in list(data):
|
||||
if key.lower() == "stack" and isinstance(data[key], str):
|
||||
if key.lower() in ("stack", "feed_source", "drawing_source") and isinstance(data[key], str):
|
||||
data[key] = data[key].strip().lower()
|
||||
return data
|
||||
|
||||
@@ -128,6 +135,12 @@ class Settings(BaseSettings):
|
||||
raise ValueError("LDAP_ALLOW_INSECURE=true is refused on STACK=prod")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _fixture_sources(self) -> Settings:
|
||||
if self.stack == "prod" and (self.feed_source == "fixture" or self.drawing_source == "fixture"):
|
||||
raise ValueError("FEED_SOURCE=fixture and DRAWING_SOURCE=fixture are refused on STACK=prod")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _pin_digits(self) -> Settings:
|
||||
if self.pin_min_digits > self.pin_max_digits:
|
||||
|
||||
Reference in New Issue
Block a user