public-release phases 1-3: read-only public mode, gunicorn container, demo bootstrap, CI, README

- before_request guard: visitors browse + explore; writes need PHYSCOM_ADMIN_TOKEN login
- SameSite=Lax/HttpOnly cookies, persisted secret key, debug off unless FLASK_DEBUG=1
- non-root gunicorn container with healthcheck; physcom demo --if-empty on first start
- landing page Top Concepts, write controls hidden from visitors
- CI workflow, pyproject metadata, compose Ollama parity, README rewrite
- tests/test_web_access.py: access control + GET smoke test of every page

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-25 15:40:02 -05:00
parent 2e38a6cf73
commit 8171fc023e
23 changed files with 510 additions and 112 deletions

View File

@@ -19,7 +19,7 @@ def _get_repo(db_path: str | None = None) -> Repository:
@click.group()
@click.option("--db", default=None, help="Path to SQLite database")
@click.option("--db", default=None, envvar="PHYSCOM_DB", help="Path to SQLite database (or $PHYSCOM_DB)")
@click.pass_context
def main(ctx, db):
"""Physical Combinatorics — innovation via attribute mixing."""
@@ -49,6 +49,31 @@ def seed(ctx, seed_name):
click.echo(f"Unknown seed: {seed_name}. Available: transport")
@main.command()
@click.option("--if-empty", is_flag=True, help="Do nothing if the DB already has entities")
@click.pass_context
def demo(ctx, if_empty):
"""Seed the transport example and run passes 1-3 for every domain."""
repo = _get_repo(ctx.obj["db"])
if if_empty and repo.list_entities():
click.echo("DB already has data; skipping demo build.")
return
from physcom.engine.constraint_resolver import ConstraintResolver
from physcom.engine.scorer import Scorer
from physcom.engine.pipeline import Pipeline
from physcom.seed.transport_example import load_transport_seed
load_transport_seed(repo)
dims = ["platform", "actuator", "energy_storage"]
for domain in repo.list_domains():
result = Pipeline(repo, ConstraintResolver(), Scorer(domain)).run(
domain, dims, score_threshold=0.1, passes=[1, 2, 3],
)
click.echo(f" {domain.name}: {result.pass3_above_threshold} of "
f"{result.total_generated} combos above threshold")
@main.group()
def entity():
"""Manage entities."""