From 607ad2105fcdb7c794dbfc24bc33a873cca3c178 Mon Sep 17 00:00:00 2001 From: aitbc Date: Sat, 9 May 2026 17:41:40 +0200 Subject: [PATCH] ci: refactor docs-validation workflow to use environment variables - Add env section with WORKSPACE_BASE, REPO_URL, STANDARD_DIRS - Replace hardcoded paths with environment variable references - Extract standard directory creation to dedicated step - Remove duplicate directory creation from lint steps - Remove duplicate error message in documentation structure check - Update all workspace paths to use WORKSPACE_BASE variable - Update repository URL to use REPO_URL variable test: fix import path in test_import_surface.py after utils reorgan --- .gitea/workflows/docs-validation.yml | 46 +++++++++++---------- feature_flags.json | 10 +++++ poetry.lock | 49 ++++++++++++++++++++++- pyproject.toml | 1 + tests/verification/test_import_surface.py | 2 +- 5 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 feature_flags.json diff --git a/.gitea/workflows/docs-validation.yml b/.gitea/workflows/docs-validation.yml index 73f7d5e3..b9653935 100644 --- a/.gitea/workflows/docs-validation.yml +++ b/.gitea/workflows/docs-validation.yml @@ -19,6 +19,11 @@ concurrency: group: docs-validation-${{ github.ref }} cancel-in-progress: true +env: + WORKSPACE_BASE: /var/lib/aitbc-workspaces + REPO_URL: http://gitea.bubuit.net:3000/oib/aitbc.git + STANDARD_DIRS: /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc + jobs: validate-docs: runs-on: debian @@ -27,27 +32,27 @@ jobs: steps: - name: Clone repository run: | - WORKSPACE="/var/lib/aitbc-workspaces/docs-validation" + WORKSPACE="${{ env.WORKSPACE_BASE }}/docs-validation" rm -rf "$WORKSPACE" mkdir -p "$WORKSPACE" cd "$WORKSPACE" - git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo + git clone --depth 1 "${{ env.REPO_URL }}" repo - name: Initialize job logging run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" bash scripts/ci/setup-job-logging.sh + - name: Ensure standard directories + run: mkdir -p ${{ env.STANDARD_DIRS }} + - name: Install tools run: | npm install -g markdownlint-cli 2>/dev/null || echo "⚠️ markdownlint not installed" - name: Lint Markdown files run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo - - # Ensure standard directories exist - mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" echo "=== Linting Markdown ===" if command -v markdownlint >/dev/null 2>&1; then @@ -98,7 +103,7 @@ jobs: - name: Check documentation structure run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" echo "=== Documentation Structure ===" required_files=( docs/README.md @@ -136,7 +141,6 @@ jobs: if [[ -f "$f" ]]; then echo " $f exists" else - echo " $f missing" echo " ❌ $f missing" exit 1 fi @@ -144,7 +148,7 @@ jobs: - name: Validate master index structure run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" echo "=== Master Index Structure ===" master_index_markers=( @@ -165,7 +169,7 @@ jobs: - name: Validate priority docs metadata run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" echo "=== Priority Documentation Metadata ===" priority_docs=( @@ -208,7 +212,7 @@ jobs: - name: Documentation stats if: always() run: | - cd /var/lib/aitbc-workspaces/docs-validation/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation/repo" echo "=== Documentation Statistics ===" echo " Markdown files: $(find docs -name '*.md' 2>/dev/null | wc -l)" echo " Total size: $(du -sh docs 2>/dev/null | cut -f1)" @@ -216,7 +220,7 @@ jobs: - name: Cleanup if: always() - run: rm -rf /var/lib/aitbc-workspaces/docs-validation + run: rm -rf "${{ env.WORKSPACE_BASE }}/docs-validation" validate-policies-strict: runs-on: debian @@ -225,27 +229,27 @@ jobs: steps: - name: Clone repository run: | - WORKSPACE="/var/lib/aitbc-workspaces/docs-validation-policies" + WORKSPACE="${{ env.WORKSPACE_BASE }}/docs-validation-policies" rm -rf "$WORKSPACE" mkdir -p "$WORKSPACE" cd "$WORKSPACE" - git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo + git clone --depth 1 "${{ env.REPO_URL }}" repo - name: Initialize job logging run: | - cd /var/lib/aitbc-workspaces/docs-validation-policies/repo + cd "${{ env.WORKSPACE_BASE }}/docs-validation-policies/repo" bash scripts/ci/setup-job-logging.sh + - name: Ensure standard directories + run: mkdir -p ${{ env.STANDARD_DIRS }} + - name: Install markdownlint run: | npm install -g markdownlint-cli - name: Strict lint policy docs run: | - cd /var/lib/aitbc-workspaces/docs-validation-policies/repo - - # Ensure standard directories exist - mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc + cd "${{ env.WORKSPACE_BASE }}/docs-validation-policies/repo" shopt -s globstar nullglob mapfile -t targets < <(printf '%s\n' docs/policies/*.md docs/policies/**/*.md | awk '!seen[$0]++') @@ -261,4 +265,4 @@ jobs: - name: Cleanup if: always() - run: rm -rf /var/lib/aitbc-workspaces/docs-validation-policies + run: rm -rf "${{ env.WORKSPACE_BASE }}/docs-validation-policies" diff --git a/feature_flags.json b/feature_flags.json new file mode 100644 index 00000000..74e8e17d --- /dev/null +++ b/feature_flags.json @@ -0,0 +1,10 @@ +{ + "test-feature": { + "enabled": true, + "description": "", + "rollout_percentage": 50, + "whitelisted_users": [], + "blacklisted_users": [], + "enabled_since": "2026-05-09T17:37:36.659721" + } +} \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index f812fe21..c593840d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.3.3 and should not be changed by hand. [[package]] name = "aiofiles" @@ -2190,6 +2190,39 @@ http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] zstd = ["zstandard (>=0.18.0)"] +[[package]] +name = "hypothesis" +version = "6.152.4" +description = "The property-based testing library for Python" +optional = false +python-versions = ">=3.10" +groups = ["main"] +files = [ + {file = "hypothesis-6.152.4-py3-none-any.whl", hash = "sha256:e730fd93c7578182efadc7f90b3c5437ee4d55edf738930eb5043c81ac1d97e8"}, + {file = "hypothesis-6.152.4.tar.gz", hash = "sha256:31c8f9ce619716f543e2710b489b1633c833586641d9e6c94cee03f109a5afc4"}, +] + +[package.dependencies] +sortedcontainers = ">=2.1.0,<3.0.0" + +[package.extras] +all = ["black (>=20.8b0)", "click (>=7.0)", "crosshair-tool (>=0.0.102)", "django (>=4.2)", "dpcontracts (>=0.4)", "hypothesis-crosshair (>=0.0.27)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.21.6)", "pandas (>=1.1)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2026.1) ; sys_platform == \"win32\" or sys_platform == \"emscripten\"", "watchdog (>=4.0.0)"] +cli = ["black (>=20.8b0)", "click (>=7.0)", "rich (>=9.0.0)"] +codemods = ["libcst (>=0.3.16)"] +crosshair = ["crosshair-tool (>=0.0.102)", "hypothesis-crosshair (>=0.0.27)"] +dateutil = ["python-dateutil (>=1.4)"] +django = ["django (>=4.2)"] +dpcontracts = ["dpcontracts (>=0.4)"] +ghostwriter = ["black (>=20.8b0)"] +lark = ["lark (>=0.10.1)"] +numpy = ["numpy (>=1.21.6)"] +pandas = ["pandas (>=1.1)"] +pytest = ["pytest (>=4.6)"] +pytz = ["pytz (>=2014.1)"] +redis = ["redis (>=3.0.0)"] +watchdog = ["watchdog (>=4.0.0)"] +zoneinfo = ["tzdata (>=2026.1) ; sys_platform == \"win32\" or sys_platform == \"emscripten\""] + [[package]] name = "identify" version = "2.6.19" @@ -5129,6 +5162,18 @@ files = [ {file = "snowballstemmer-3.0.1.tar.gz", hash = "sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895"}, ] +[[package]] +name = "sortedcontainers" +version = "2.4.0" +description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" +optional = false +python-versions = "*" +groups = ["main"] +files = [ + {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, + {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, +] + [[package]] name = "sqlalchemy" version = "2.0.49" @@ -6248,4 +6293,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = ">=3.13,<3.14" -content-hash = "de7898f0ee193c995ce1d053cc03902eaf4a487b00beab46f8c15afb7d6629e3" +content-hash = "c586f59a4fc433e921602f452228dae1ec6aa18bfdaa751688e848a6ce1702c4" diff --git a/pyproject.toml b/pyproject.toml index 87639a03..0cc68141 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,7 @@ redis = ">=5.2.1" psutil = ">=6.1.0" tenseal = ">=0.3.0" idna = ">=3.7" +hypothesis = "^6.152.4" [tool.poetry.group.dev.dependencies] pytest = "9.0.3" diff --git a/tests/verification/test_import_surface.py b/tests/verification/test_import_surface.py index 906433a0..937ecd71 100644 --- a/tests/verification/test_import_surface.py +++ b/tests/verification/test_import_surface.py @@ -74,7 +74,7 @@ def test_agent_coordinator_wrapper_bootstrap(monkeypatch) -> None: with monkeypatch.context() as m: m.setattr(os, "execvp", fake_execvp) - m.setattr(aitbc_paths, "ensure_dir", lambda path: path) + m.setattr(aitbc.utils.paths, "ensure_dir", lambda path: path) m.setenv("AITBC_ENV_FILE", "placeholder") m.setenv("AITBC_NODE_ENV_FILE", "placeholder") m.setenv("PYTHONPATH", "placeholder")