You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just ran the full /edifice loop by hand (pull → improve → report → push) and it surfaced a live backend bug (#74) only at the last step. Nothing guards this pipeline in CI, so an Archon change to hal-mcp or the edifice mapping can silently break the report that field users depend on (IC Ingénieurs today; suivi_chantier prospects such as G. Baron next).
Add a minimal, offline, deterministic regression test that locks the pipeline's contract. Goal: a change that breaks pull→report→push turns a CI job red, not a field mission.
Companion:BluegReeno/bluegreen-marketplace#44 covers the client-side render half (build_context → DOCX). This issue covers the backend half. Land them together for full coverage.
Scope (MVP)
Two fixtures under tests/fixtures/edifice/, mirroring what the PWA stores — one diagnostic and one suivi_chantier mission, each with ≥1 note and ≥1 photo reference (tiny stub images, not real photos):
Pull/report contract — get_mission_with_assets → context shape. Assert the assembled mission+assets payload keeps the shape the edifice skill's build_context.py consumes, for bothproject_types: notes carry note_id + photos[], assessment maps to the diagnostic IE scale / suivi_chantier states, photo filenames resolve. This pins the backend↔skill contract so a shape drift is caught here rather than in the field.
Assertions are structural invariants, not bytes — e.g. "2 observations, each with a note_id and a resolvable photo", never a hash of a rendered .docx (the renderer re-encodes images, so bytes change every run — a byte-exact test would be permanently red and get disabled).
Non-goals / companion
DOCX render smoke test (build_context.py → render_diagnostic.py / render_cr_visite.py → assert "opens, N disorders, M images"): those scripts live in the skill/plugin repo (bluegreen-marketplace), not here. Tracked as the companion BluegReeno/bluegreen-marketplace#44; out of scope for this repo.
No improve (LLM) step in the test — represent the qualified mission as a fixed context.json fixture, not a live model call.
No live Supabase in CI — mock the client or gate behind the existing live marker; the default pytest -m "not live" run must stay green offline.
Both diagnostic and suivi_chantier fixtures covered.
Fully deterministic and offline; runs in a few seconds.
Maintenance
Fixtures are versioned beside the tests. When a behavior change is intentional, update the fixture / expected invariants in the same PR and review the diff (golden-file discipline). Keep the improve step as a fixture and anything needing real Supabase behind live, so the offline suite never rots into a permanently-red state nobody trusts.
BluegReeno/bluegreen-marketplace#44 — companion: client-side build_context → render DOCX smoke test. The two together = the full pull→report→push net.
bluegreen-marketplace#31 (closed) — original skill-side report of the push bug.
Filed from a Cowork session that walked the full loop end-to-end. Intentionally left unlabeled / not queued for Archon — pick it up when priorities allow.
Summary
We just ran the full
/edificeloop by hand (pull → improve → report → push) and it surfaced a live backend bug (#74) only at the last step. Nothing guards this pipeline in CI, so an Archon change tohal-mcpor the edifice mapping can silently break the report that field users depend on (IC Ingénieurs today;suivi_chantierprospects such as G. Baron next).Add a minimal, offline, deterministic regression test that locks the pipeline's contract. Goal: a change that breaks pull→report→push turns a CI job red, not a field mission.
Scope (MVP)
Two fixtures under
tests/fixtures/edifice/, mirroring what the PWA stores — onediagnosticand onesuivi_chantiermission, each with ≥1 note and ≥1 photo reference (tiny stub images, not real photos):Backend contract —
push_mission_context(guards fix(hal-mcp): push_mission_context upserts partial note rows — every push fails on project_id NOT NULL #74). Given seedededifice_notes, a push of partial observations must: UPDATE bynote_id(never insert/upsert), preserveproject_idand untouched columns, reportupdated= rows actually affected, and report an unknownnote_idas skipped/error (never a phantom insert). Idempotent: pushing twice changes nothing. → Best placed as a Deno test besidesupabase/functions/hal-mcp/index.ts, ideally landed with the fix(hal-mcp): push_mission_context upserts partial note rows — every push fails on project_id NOT NULL #74 fix; add adeno teststep to CI if none exists.Pull/report contract —
get_mission_with_assets→ context shape. Assert the assembled mission+assets payload keeps the shape the edifice skill'sbuild_context.pyconsumes, for bothproject_types: notes carrynote_id+photos[],assessmentmaps to the diagnostic IE scale / suivi_chantier states, photo filenames resolve. This pins the backend↔skill contract so a shape drift is caught here rather than in the field.Assertions are structural invariants, not bytes — e.g. "2 observations, each with a
note_idand a resolvable photo", never a hash of a rendered.docx(the renderer re-encodes images, so bytes change every run — a byte-exact test would be permanently red and get disabled).Non-goals / companion
build_context.py→render_diagnostic.py/render_cr_visite.py→ assert "opens, N disorders, M images"): those scripts live in the skill/plugin repo (bluegreen-marketplace), not here. Tracked as the companionBluegReeno/bluegreen-marketplace#44; out of scope for this repo.improve(LLM) step in the test — represent the qualified mission as a fixedcontext.jsonfixture, not a live model call.livemarker; the defaultpytest -m "not live"run must stay green offline.Acceptance
tests/andtests/fixtures/edifice/, green underuv run pytest tests/ -q -m "not live"(CI'spythonjob then runs them on every PR with no extra wiring). If a Deno test is added for fix(hal-mcp): push_mission_context upserts partial note rows — every push fails on project_id NOT NULL #74, it runs under a new CIdeno teststep.NOT NULL project_id): it fails on insert/upsert, passes only on UPDATE-by-note_id, and asserts idempotency + honestupdatedcount.diagnosticandsuivi_chantierfixtures covered.Maintenance
Fixtures are versioned beside the tests. When a behavior change is intentional, update the fixture / expected invariants in the same PR and review the diff (golden-file discipline). Keep the
improvestep as a fixture and anything needing real Supabase behindlive, so the offline suite never rots into a permanently-red state nobody trusts.Related
push_mission_contextUPDATE-vs-upsert fix this test guards (land the push test with it).BluegReeno/bluegreen-marketplace#44— companion: client-sidebuild_context→ render DOCX smoke test. The two together = the full pull→report→push net.bluegreen-marketplace#31(closed) — original skill-side report of the push bug.Filed from a Cowork session that walked the full loop end-to-end. Intentionally left unlabeled / not queued for Archon — pick it up when priorities allow.