{"slug": "catch-broken-environment-import-and-route-connections-with-weftgate", "title": "Catch broken environment, import, and route connections with Weftgate", "summary": "A developer maintains Weftgate, an open-source verification gate for coding agents that checks environment-variable reads, dependency imports, and FastAPI route references against repository contracts. The tool runs locally via CLI, MCP, hooks, and CI, with no runtime dependencies and no network calls on its default path, and returns accept, review, or reject results with suggested corrections. The maintainer cautions that a passing gate does not prove an application works and that fixture scores are not claims about arbitrary repositories.", "body_md": "I maintain Weftgate, an open-source verification gate for coding agents. It checks environment-variable reads, dependency imports, and FastAPI route references against contracts in the repository. It runs locally through a CLI, MCP, hooks, and CI.\n\nThe core has no runtime dependencies and makes no network calls on its default path. It is an early static analyzer with explicit limits. A passing gate does not prove that an application works.\n\nUse Python 3.10 or later in a fresh directory:\n\n```\nmkdir weftgate-example\ncd weftgate-example\npython3 -m venv .venv\n. .venv/bin/activate\npip install weftgate\nprintf 'DATABASE_URL=\\n' > .env.example\nprintf 'import os\\nurl = os.environ[\"DATABSE_URL\"]\\n' > app.py\nweftgate check app.py\n```\n\nThe environment oracle compares the read with `.env.example`. The misspelled hard claim rejects, exits 1, and suggests `DATABASE_URL`.\n\nCorrect the reference and check again:\n\n``` python\nprintf 'import os\\nurl = os.environ[\"DATABASE_URL\"]\\n' > app.py\nweftgate check app.py\n```\n\nThis time the reference resolves. Now try a computed key:\n\n``` python\nprintf 'import os\\nkey = \"DATABASE_URL\"\\nurl = os.environ[key]\\n' > app.py\nweftgate check app.py\n```\n\nThat returns `review`, with exit code 0. The environment parser does not establish the computed key's value, so the finding stays advisory.\n\nThese are constructed demonstrations, not field accuracy benchmarks.\n\nThe [58-second demo](https://github.com/Avinash-Amudala/weftgate/releases/download/v0.1.1/weftgate-demo-motion.mp4) traces three intentional mistakes in a fixture:\n\n| Reference | Repository evidence | Suggested correction | \n|---|---|---|\n| `import requestz` | Dependency declarations | `requests` | \n| `os.environ[\"DATABSE_URL\"]` | `.env.example` | `DATABASE_URL` | \n| Route handler `helth` | Defined/imported handlers | `health` | \n\nYou can reproduce the broader mutation fixture locally:\n\n```\nweftgate eval mutate --fixture --seed 13\n```\n\nThe harness measures detection, blocking, and usable suggestions separately. Its fixture score is not a claim about arbitrary repositories.\n\nAn import absent from a manifest can be transitive. A router produced by a factory can register paths that a static scan cannot enumerate. A missing index cannot establish absence. These cases must review or be reported as unverifiable.\n\nAn `accept` result only describes the extracted claims. Continue running your tests, type checker, security checks, and normal review.\n\n```\nweftgate doctor\nweftgate audit\nweftgate check app/main.py\n```\n\n`doctor` explains which contracts are available. Environment reads supplied externally should be documented in your declaration source. Python and Node dependency resolution can depend on workspace and runtime configuration, so review findings in context.\n\nFor a pull request:\n\n```\nname: Verify connections\non: [pull_request]\npermissions:\n  contents: read\njobs:\n  verify:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n      - uses: Avinash-Amudala/weftgate@v0.1.1\n```\n\nMCP clients can start `weftgate mcp` from the target repository. The tools and CLI call the same gate functions; no separate model API or server account is required.\n\nThe most useful feedback is a minimal example of a false block or a missing contract. There are also contribution issues for workspace fixtures and a first-project walkthrough.\n\nDisclosure: this walkthrough was generated with AI and checked against the project's reproducible fixtures. It does not claim independent benchmark results.", "url": "https://wpnews.pro/news/catch-broken-environment-import-and-route-connections-with-weftgate", "canonical_source": "https://dev.to/avinash_amudala_8712ab560/catch-broken-environment-import-and-route-connections-with-weftgate-2h3p", "published_at": "2026-09-13 05:51:19+00:00", "updated_at": "2026-09-13 06:26:47.496226+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Weftgate", "Avinash-Amudala", "FastAPI", "Python", "Node", "GitHub Actions", "MCP"], "alternates": {"html": "https://wpnews.pro/news/catch-broken-environment-import-and-route-connections-with-weftgate", "markdown": "https://wpnews.pro/news/catch-broken-environment-import-and-route-connections-with-weftgate.md", "text": "https://wpnews.pro/news/catch-broken-environment-import-and-route-connections-with-weftgate.txt", "jsonld": "https://wpnews.pro/news/catch-broken-environment-import-and-route-connections-with-weftgate.jsonld"}}