diff --git a/.github/workflows/declared-source-scope.yml b/.github/workflows/declared-source-scope.yml new file mode 100644 index 000000000..4051d4506 --- /dev/null +++ b/.github/workflows/declared-source-scope.yml @@ -0,0 +1,65 @@ +name: Declared Source Scope Inventory + +on: + pull_request: + paths: + - "registered-imports.json" + - ".gitmodules" + - "config/template-consumers.yml" + - "config/live-chain-manifest.json" + - "config/subtree-manifest.yml" + - "config/shell-tools-registry.yml" + - "config/gitlab-mirror-sources.yml" + - "config/gitlab-subgroups.yml" + - "config/gitlab-subgroups-ooc.yml" + - "scripts/build-declared-source-scope.py" + - "tests/test_declared_source_scope.py" + - "docs/declared-source-scope-inventory.md" + - ".github/workflows/declared-source-scope.yml" + push: + branches: [main] + paths: + - "registered-imports.json" + - ".gitmodules" + - "config/template-consumers.yml" + - "config/live-chain-manifest.json" + - "config/subtree-manifest.yml" + - "config/shell-tools-registry.yml" + - "scripts/build-declared-source-scope.py" + - "tests/test_declared_source_scope.py" + - "docs/declared-source-scope-inventory.md" + - ".github/workflows/declared-source-scope.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: declared-source-scope-${{ github.ref }} + cancel-in-progress: false + +jobs: + inventory: + name: Offline declared source scope inventory + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + - name: Install YAML parser + run: python3 -m pip install --disable-pip-version-check PyYAML + - name: Run offline tests + run: python3 -m unittest discover -s tests -p "test_declared_source_scope.py" -v + - name: Build deterministic declaration inventory (no network) + run: | + python3 scripts/build-declared-source-scope.py \ + --json-out "$RUNNER_TEMP/declared-source-scope.json" \ + --markdown-out "$RUNNER_TEMP/declared-source-scope.md" + - name: Upload declaration evidence + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 + with: + name: declared-source-scope-inventory + path: | + ${{ runner.temp }}/declared-source-scope.json + ${{ runner.temp }}/declared-source-scope.md + if-no-files-found: error + retention-days: 14 diff --git a/.github/workflows/hw-detect-ci.yml b/.github/workflows/hw-detect-ci.yml index c3a544a4d..b327898a7 100644 --- a/.github/workflows/hw-detect-ci.yml +++ b/.github/workflows/hw-detect-ci.yml @@ -25,6 +25,7 @@ on: - scripts/kport/kport-build-flags.sh - scripts/kport/kport-toolchain.sh - config/hardware.conf.tpl + - .github/workflows/hw-detect-ci.yml pull_request: paths: - scripts/hw-detect.sh @@ -33,6 +34,7 @@ on: - scripts/kport/kport-build-flags.sh - scripts/kport/kport-toolchain.sh - config/hardware.conf.tpl + - .github/workflows/hw-detect-ci.yml schedule: - cron: '19 6 * * 1' # weekly Monday 06:19 UTC workflow_dispatch: {} diff --git a/.github/workflows/manage-subtrees.yml b/.github/workflows/manage-subtrees.yml index 5896de469..8f050d459 100644 --- a/.github/workflows/manage-subtrees.yml +++ b/.github/workflows/manage-subtrees.yml @@ -4,7 +4,7 @@ name: Manage Subtrees # declared in config/subtree-manifest.yml current. # # Runs weekly (Sunday 01:00 UTC) and on manual dispatch. -# All operations are idempotent — safe to re-run at any time. +# This workflow is intentionally read-only until the legacy writer is replaced. # # Commands: # sync — add/update all subtrees + submodules per manifest @@ -22,20 +22,15 @@ on: description: 'Operation to run' required: false type: choice - options: [sync, umbrella-init, update-submodules, status] - default: sync - dry_run: - description: 'Log actions without executing git operations' - required: false - type: boolean - default: false + options: [status] + default: status concurrency: group: manage-subtrees cancel-in-progress: false permissions: - contents: write + contents: read jobs: quota: @@ -48,7 +43,7 @@ jobs: - name: Check quota id: check env: - GH_TOKEN: ${{ secrets.SYNC_TOKEN }} + GH_TOKEN: ${{ github.token }} run: | source scripts/includes/budget.sh source scripts/includes/quota-snapshot.sh @@ -57,7 +52,7 @@ jobs: quota_snapshot run: - name: ${{ inputs.command || 'sync' }} + name: ${{ inputs.command || 'status' }} runs-on: ubuntu-latest needs: quota if: needs.quota.outputs.skip == 'false' @@ -66,7 +61,6 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 with: fetch-depth: 0 - token: ${{ secrets.SYNC_TOKEN }} - name: Configure git run: | @@ -78,23 +72,10 @@ jobs: - name: Run manage-subtrees env: - GH_TOKEN: ${{ secrets.SYNC_TOKEN }} - DRY_RUN: ${{ inputs.dry_run || 'false' }} + GH_TOKEN: ${{ github.token }} MANIFEST: config/subtree-manifest.yml - run: bash scripts/manage-subtrees.sh ${{ inputs.command || 'sync' }} - - - name: Commit changes - if: inputs.command != 'status' && inputs.dry_run != true - run: | - if git diff --quiet && git diff --staged --quiet; then - echo "No changes to commit" >&2 - else - git add -A - git commit -m "chore(subtrees): ${{ inputs.command || 'sync' }} [skip ci]" \ - -m "Automated by Manage Subtrees workflow." \ - -m "Co-authored-by: Ona " - git push - fi + COMMAND: ${{ inputs.command || 'status' }} + run: bash scripts/manage-subtrees.sh "$COMMAND" - name: Write summary if: always() diff --git a/.github/workflows/readme-subsystem.yml b/.github/workflows/readme-subsystem.yml index 37a5c8b6d..d8bf1259b 100644 --- a/.github/workflows/readme-subsystem.yml +++ b/.github/workflows/readme-subsystem.yml @@ -14,6 +14,7 @@ on: - 'scripts/readme_policy.py' - 'scripts/check_rendered_links.py' - 'scripts/check-markdown-links.py' + - 'scripts/external_services.py' - 'tests/fixtures/readme-subsystem/**' - 'tests/test_readme_subsystem.py' - '.github/workflows/readme-subsystem.yml' @@ -30,6 +31,7 @@ on: - 'scripts/readme_policy.py' - 'scripts/check_rendered_links.py' - 'scripts/check-markdown-links.py' + - 'scripts/external_services.py' - 'tests/fixtures/readme-subsystem/**' - 'tests/test_readme_subsystem.py' - '.github/workflows/readme-subsystem.yml' @@ -223,7 +225,7 @@ jobs: config/readme-subsystem.lock.json schema/readme-subsystem.schema.json \ readme-subsystem/VERSION readme-subsystem/CHANGELOG.md \ scripts/readme-subsystem.py scripts/readme_policy.py \ - scripts/check_rendered_links.py scripts/check-markdown-links.py + scripts/check_rendered_links.py scripts/check-markdown-links.py scripts/external_services.py git commit -m "chore(readme): sync canonical README subsystem" git push origin "HEAD:refs/heads/$branch" --force-with-lease existing="$(gh pr list --repo Interested-Deving-1896/Interested-Deving-1896 \ diff --git a/.github/workflows/readme-updater-validation.yml b/.github/workflows/readme-updater-validation.yml index b0f428696..28ab7c24a 100644 --- a/.github/workflows/readme-updater-validation.yml +++ b/.github/workflows/readme-updater-validation.yml @@ -4,6 +4,7 @@ on: pull_request: paths: - 'scripts/update-readmes.sh' + - 'scripts/trigger-readme-update.sh' - 'scripts/includes/**' - '.github/workflows/readme-updater-validation.yml' - '.github/workflows/update-readmes.yml' @@ -24,10 +25,17 @@ jobs: shell: bash run: | bash -n scripts/update-readmes.sh + bash -n scripts/trigger-readme-update.sh bash -n scripts/includes/gh-api.sh bash -n scripts/includes/readme-badges.sh bash -n scripts/includes/readme-llm.sh + - name: Smoke-test README badge helper initialization + shell: bash + run: | + source scripts/includes/readme-badges.sh + test -n "$README_AGENT_BADGE_MARKER" + - name: Install ShellCheck run: | sudo apt-get update @@ -35,4 +43,4 @@ jobs: - name: Run ShellCheck run: | - shellcheck --severity=warning --exclude=SC1073,SC1054,SC1083,SC1056,SC1072 scripts/update-readmes.sh scripts/includes/gh-api.sh scripts/includes/readme-badges.sh scripts/includes/readme-llm.sh + shellcheck --severity=warning --exclude=SC1073,SC1054,SC1083,SC1056,SC1072 scripts/update-readmes.sh scripts/trigger-readme-update.sh scripts/includes/gh-api.sh scripts/includes/readme-badges.sh scripts/includes/readme-llm.sh diff --git a/.github/workflows/registered-consumer-inventory.yml b/.github/workflows/registered-consumer-inventory.yml new file mode 100644 index 000000000..0c678c8a2 --- /dev/null +++ b/.github/workflows/registered-consumer-inventory.yml @@ -0,0 +1,62 @@ +name: Registered Consumer Submodule Inventory + +on: + pull_request: + paths: + - "config/template-consumers.yml" + - "scripts/audit-registered-consumers.py" + - "scripts/directory_inventory.py" + - "tests/test_directory_inventory.py" + - "tests/test_audit_registered_consumers.py" + - ".github/workflows/registered-consumer-inventory.yml" + push: + branches: [main] + paths: + - "config/template-consumers.yml" + - "scripts/audit-registered-consumers.py" + - "scripts/directory_inventory.py" + - "tests/test_directory_inventory.py" + - "tests/test_audit_registered_consumers.py" + - ".github/workflows/registered-consumer-inventory.yml" + schedule: + - cron: "37 4 * * 1" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: registered-consumer-inventory-${{ github.ref }} + cancel-in-progress: false + +jobs: + inventory: + name: Read-only remote consumer inventory + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + - name: Install registry parser + run: python3 -m pip install --disable-pip-version-check PyYAML + - name: Run offline regression tests + run: | + python3 -m unittest discover -s tests -p "test_audit_registered_consumers.py" -v + python3 -m unittest discover -s tests -p "test_directory_inventory.py" -v + - name: Scan registered repositories (GET only) + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + python3 scripts/audit-registered-consumers.py \ + --registry config/template-consumers.yml \ + --json-out "$RUNNER_TEMP/registered-consumer-inventory.json" \ + --markdown-out "$RUNNER_TEMP/registered-consumer-inventory.md" + - name: Upload inventory evidence + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 + with: + name: registered-consumer-submodule-inventory + path: | + ${{ runner.temp }}/registered-consumer-inventory.json + ${{ runner.temp }}/registered-consumer-inventory.md + if-no-files-found: warn + retention-days: 14 diff --git a/.github/workflows/submodule-directory-audit.yml b/.github/workflows/submodule-directory-audit.yml new file mode 100644 index 000000000..188f0f591 --- /dev/null +++ b/.github/workflows/submodule-directory-audit.yml @@ -0,0 +1,49 @@ +name: Submodule and Directory Inventory + +on: + pull_request: + paths: + - ".gitmodules" + - "config/subtree-manifest.yml" + - "scripts/audit-submodule-directory.py" + - "tests/test_audit_submodule_directory.py" + - ".github/workflows/submodule-directory-audit.yml" + push: + branches: [main] + paths: + - ".gitmodules" + - "config/subtree-manifest.yml" + - "scripts/audit-submodule-directory.py" + - "tests/test_audit_submodule_directory.py" + - ".github/workflows/submodule-directory-audit.yml" + workflow_dispatch: + +permissions: + contents: read + +jobs: + inventory: + name: Read-only inventory and reconciliation + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + - name: Install manifest parser + run: python3 -m pip install --disable-pip-version-check PyYAML + - name: Run offline regression tests + run: python3 -m unittest discover -s tests -p "test_audit_submodule_directory.py" -v + - name: Generate inventory report + run: | + python3 scripts/audit-submodule-directory.py \ + --repo-root . \ + --json-out "$RUNNER_TEMP/submodule-directory-inventory.json" \ + --markdown-out "$RUNNER_TEMP/submodule-directory-inventory.md" + - name: Upload read-only audit report + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 + with: + name: submodule-directory-inventory + path: | + ${{ runner.temp }}/submodule-directory-inventory.json + ${{ runner.temp }}/submodule-directory-inventory.md + if-no-files-found: error + retention-days: 14 diff --git a/.github/workflows/validate-config.yml b/.github/workflows/validate-config.yml index 405cd139c..86b6264ea 100644 --- a/.github/workflows/validate-config.yml +++ b/.github/workflows/validate-config.yml @@ -14,6 +14,7 @@ on: - config/workflow-sync.yml - config/workflow-cost-profiles.yml - config/agent-budget.yml + - config/accessibility/** - config/workflow-priority-tiers.yml - config/template-manifest.yml - config/template-consumers.yml @@ -330,6 +331,33 @@ jobs: INPUTS_JSON: ${{ toJSON(inputs) }} run: bash scripts/write-summary.sh + validate-accessibility-integration: + name: Validate accessibility/rendering/evidence contract + needs: fsa-check + if: needs.fsa-check.outputs.managed == 'true' + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Harden runner + uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # ratchet:step-security/harden-runner@v2 + with: + egress-policy: audit + disable-sudo: false + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + + - name: Validate accessibility integration contract + run: python3 scripts/validate-accessibility-integration.py + + - name: Validate rendering target profiles and fixtures + run: python3 scripts/validate-rendering-profiles.py + + - name: Write summary + if: always() + env: + JOB_STATUS: ${{ job.status }} + INPUTS_JSON: ${{ toJSON(inputs) }} + run: bash scripts/write-summary.sh + pytest: name: Validator unit tests runs-on: ubuntu-latest @@ -579,6 +607,7 @@ jobs: - validate-agent-budget - validate-priority-tiers - validate-template-config + - validate-accessibility-integration - pytest - lint-yaml - scan-agent-configs diff --git a/.github/workflows/validate-readme-render.yml b/.github/workflows/validate-readme-render.yml index 2a2253d63..b0803192f 100644 --- a/.github/workflows/validate-readme-render.yml +++ b/.github/workflows/validate-readme-render.yml @@ -12,6 +12,18 @@ on: push: paths: - 'README.md' + - 'config/rendering/**' + - 'scripts/validate-rendering-profiles.py' + - 'DOCS/rendering-compatibility.md' + pull_request: + paths: + - 'README.md' + - 'config/rendering/**' + - 'scripts/check-readme-render.sh' + - 'scripts/tests/test-check-readme-render-mobile.sh' + - 'scripts/validate-rendering-profiles.py' + - '.github/workflows/validate-readme-render.yml' + - 'DOCS/rendering-compatibility.md' # README update completions are aggregated by workflow-completion-router.yml. workflow_dispatch: inputs: @@ -48,6 +60,7 @@ jobs: if: > !contains(github.event.head_commit.message, '[skip ci]') && ( github.event_name == 'push' || + github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.repos == '' && inputs.osp_bound != true) ) @@ -55,6 +68,9 @@ jobs: steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + - name: Validate presentation target registry and fixture references + run: python3 scripts/validate-rendering-profiles.py + - name: Self-test check-readme-render.sh run: bash scripts/tests/test-check-readme-render-mobile.sh diff --git a/DOCS/accessibility-rendering-evidence.md b/DOCS/accessibility-rendering-evidence.md new file mode 100644 index 000000000..f2b788770 --- /dev/null +++ b/DOCS/accessibility-rendering-evidence.md @@ -0,0 +1,56 @@ +# Accessibility, Rendering and Visual Evidence Integration + +FSA reuses the existing Accessibility Workflow group as orchestrator. It consumes +specialist capabilities rather than duplicating the Rendering Engine, Visual +Capture service, Git platform connector or status-check system. + +## Ownership + +| Capability | Owner | Responsibility | +|---|---|---| +| Policy and orchestration | Accessibility Workflow group | Select checks, apply severity policy and aggregate results | +| Source/static checks | Accessibility engines | README structure, CODEOWNERS, alt text, links, tables and source findings | +| Rendered semantics | Accessibility engines + Rendering Engine | DOM checks on supported rendered targets | +| Presentation profiles and fixtures | Rendering Engine (#1160) | Provider/client profiles, fixtures, comparisons and compatibility findings | +| Screenshot/recording acquisition | Visual Capture (#1174) | Permissioned adapters, media lifecycle, redaction, integrity and retention | +| Provider identity | Connector (#1149) | Provider and instance identity | +| Status aggregation | Existing status-check system | Map unified findings to existing status contracts | + +## Pipeline + +1. Discover changed content and configured presentation targets. +2. Run source/static checks (README, CODEOWNERS, metadata, links and structure). +3. Render supported fixtures and run axe-core/pa11y only where target DOM is available. +4. Run keyboard/focus, zoom/reflow and assistive-technology checks only when runner + capability is positively discovered; otherwise report unknown or skipped with reason. +5. Request a screenshot only for an explicitly selected checkpoint and verified, + authorized capture backend. Bounded recording is a separate opt-in request. +6. Correlate findings with commit SHA, workflow run, target profile, fixture and test step. +7. Aggregate deterministic reports and use existing status checks. Visual diffs + are diagnostic evidence, not substitutes for accessibility assertions. + +## Evidence and safety + +Findings distinguish static, rendered-DOM, visual, assistive-technology and human +observations. Automated scans do not establish complete WCAG conformance. Unknown +target or runner coverage is not a pass. + +The machine-readable contract at +`config/accessibility/integration-contract.json` is read-only. Capture is disabled +by default; no hidden capture, permission bypass, public upload, unbounded recording +or silent baseline update is permitted. Live viewing requires explicit consent, +authenticated access, a visible indicator, expiry, revocation and audit events. + +The existing `check-accessibility.yml` still has repository-write permissions and +a generated-artifact commit path. This first integration slice does not silently +change that legacy behavior. A separate least-privilege migration is required +before treating it as a strictly read-only audit workflow. + +## Validation + +Run `python3 scripts/validate-accessibility-integration.py` and +`python3 -m pytest tests/test_accessibility_integration.py -q`. + +The validator checks configuration and ownership boundaries only. It does not +claim that browser, OS, device, screen-reader, screenshot or recording backends +have been tested. diff --git a/DOCS/ai-agent-badges.md b/DOCS/ai-agent-badges.md index 89a7affe3..32a1ca026 100644 --- a/DOCS/ai-agent-badges.md +++ b/DOCS/ai-agent-badges.md @@ -6,11 +6,47 @@ ready** badge describes repository compatibility; the badges beside it are shortcuts to supported agent surfaces, not claims that a provider authored or endorses the project. -The machine-readable registry is `config/ai-agent-badges.json`. Add or retire a -provider there rather than adding provider-specific conditionals to README -scripts. `scripts/agent-badge-registry.py` validates the registry, renders the -managed Markdown, and removes both current managed badges and legacy Ona badges -during migration. +The machine-readable registry is `config/ai-agent-badges.json`. Add or retire an +entry there rather than adding provider-specific conditionals to README scripts. +The first badge is the repository compatibility marker; **Cohere is second** as +a model-provider badge, followed by the existing coding-agent launch badges. +Cohere is a model/API provider, not itself a coding-agent interface. The badge +links to Cohere's model catalogue and does not assert that every model is +available through every agent, plan, region, or deployment. + +Each registry entry carries a `kind` where known (`model-provider` versus an +agent/product integration), a synopsis, model families, strengths, evidence +level, official evidence URL, verification date, and caveats. Provider model +availability changes; treat the official catalogue as authoritative and the +registry timestamp as the date of last review. `scripts/agent-badge-registry.py` +validates and renders the managed Markdown and removes legacy Ona badges. + +## Agent and model catalogue + +| Badge / integration | Kind | Synopsis | Supported model families / models | Best-fit workloads | Evidence | +|---|---|---|---|---|---| +| Cohere | Model provider | API/model platform; not a standalone coding agent | Command, North, Embed, Rerank, Aya, Parse, Transcribe | Tool use, agentic coding, RAG, embeddings, reranking, multilingual generation, document parsing, transcription | [Official model catalogue](https://docs.cohere.com/docs/models); availability is deployment-dependent | +| OpenAI Codex | Coding agent | Repository agent available through cloud, connected hosts, CLI and IDE surfaces | OpenAI models selectable in Codex; documented current families include GPT-6.2 Astra/Sol, GPT-6.1 Sol/Terra and GPT-6 Luna | Multi-step repository changes, implementation, tests, code review, delegated work | [Codex model guide](https://learn.chatgpt.com/docs/models?surface=app); account and surface dependent | +| Claude Code | Coding agent | Terminal-centric coding agent with supported remote/cloud session workflows | Claude model families selectable by Claude Code (Opus, Sonnet, Haiku; exact versions change) | Codebase exploration, implementation, debugging, refactoring, terminal workflows | [Model selection guidance](https://claude.com/resources/articles/claude-model-and-effort-level-in-claude-code); plan dependent | +| GitHub Copilot | Coding agent | GitHub-native assistant across GitHub, IDE and CLI surfaces | Dynamic catalog spanning OpenAI, Anthropic, Google, xAI, Microsoft and other providers; see official list | Inline coding, repository chat, PR/code review, agentic coding tasks | [Supported model catalogue](https://docs.github.com/en/copilot/reference/ai-models/supported-models); plan/surface dependent | +| Cursor | Coding agent/editor | Code editor and background-agent product with selectable first- and third-party models | Cursor Composer and provider models; exact list changes by plan and entitlement | Interactive codebase editing, agentic implementation, review and background tasks | [Available models](https://prod.cursor.com/help/models-and-usage/available-models); plan dependent | +| Gemini CLI | Coding agent/CLI | Open-source terminal agent with tool-assisted repository workflows | Gemini model family configured for the CLI; exact supported IDs depend on release/configuration | Terminal coding, repository inspection, scripted tool use | [Gemini CLI documentation](https://github.com/google-gemini/gemini-cli/blob/main/docs/index.md) | + +**Important:** this table distinguishes the *agent interface* from the *model provider*. A product badge does not prove that every model from that provider is selectable in that product. Model lists, access, context windows, pricing, regions, and preview status change; official live catalogues are authoritative. The registry's evidence status is about what FSA has verified, not a provider endorsement. + +## Provider and agent glossary + +| Term | Meaning | Best suited for | +|---|---|---| +| Agent | Product/runtime that plans and performs tasks using tools | Repository-level workflows, tool execution, iterative implementation | +| Model provider | Organization/API supplying model inference | Model selection, inference, embeddings, reranking, hosted model services | +| Command / North | Cohere generation and agentic model families | Tool use, reasoning/generation, coding and enterprise workflows | +| Embed | Cohere embedding models | Semantic search, retrieval and classification | +| Rerank | Cohere relevance-ranking models | Improving retrieval ordering without replacing the search index | +| Aya | Cohere multilingual model family | Multilingual generation and language coverage | +| Parse / Transcribe | Document extraction and audio transcription services | Structured document ingestion and speech-to-text | +| RAG | Retrieval-augmented generation | Grounding responses in indexed documents and project evidence | +| Evidence level | FSA's verification state for a capability claim | Preventing inferred or untested support from appearing as verified | ## Desktop and mobile capabilities diff --git a/DOCS/cover.md b/DOCS/cover.md index c826791b7..7a76b578e 100644 --- a/DOCS/cover.md +++ b/DOCS/cover.md @@ -17,7 +17,7 @@ syncs upstream forks, and runs org-wide maintenance workflows.
-191 Workflows +194 Workflows GitHub Pages AI agent ready @@ -35,7 +35,7 @@ syncs upstream forks, and runs org-wide maintenance workflows.

Architecture

Three-org mirror chain, data flow, GitLab subgroup map, token model, quota layers.

-

Workflow Triggers

All 191 workflows — schedules, triggers, cross-workflow dependencies, index + glossary.

+

Workflow Triggers

All 194 workflows — schedules, triggers, cross-workflow dependencies, index + glossary.

Operations

GitHub Actions limits, quota management, concurrency groups, schedule summary.

Quota Costs

Per-workflow REST call cost table, daily budget, REST→GraphQL savings.

Runbooks

Quota exhaustion, queue pile-up, token expiry, mirror chain broken, incident response.

diff --git a/DOCS/fleet-engine.md b/DOCS/fleet-engine.md new file mode 100644 index 000000000..4ec4d5990 --- /dev/null +++ b/DOCS/fleet-engine.md @@ -0,0 +1,126 @@ +# Fleet Engine + +The Fleet Engine is Fork-Sync-All's provider-neutral portfolio control plane. It +reconciles repository identity and evidence, evaluates policy, plans work across +domain engines, and verifies that intended postconditions were reached. + +It does **not** replace or absorb README, template synchronization, fork/sync, +mirror, import, project-creation, CI, build, release, Production-Ready, or +Verification engines. Those remain domain capabilities. Provider adapters +handle forge-specific transport; the Fleet Engine coordinates them through a +common contract. + +## Current delivery state + +The checked-in contract is deliberately configured as `audit-only`. The +repository inventory is empty until Phase 1 reconciliation has deterministic +source mappings and tests. This is intentional: an incomplete inventory must +not be mistaken for a complete or authorized target list. + +| Phase | Scope | Gate | +|---|---|---| +| 0 — contract | Identity, evidence, source semantics, dispositions, ownership and deny-by-default policy | Schema and policy tests pass | +| 1 — inventory | Read-only reconciliation of declared registries and dynamic targets | Every record is resolved or explicitly unresolved with evidence | +| 2 — planning | Deterministic per-repository plans and operation capability decisions | No implicit write permission; stable dry-run output | +| 3 — controlled execution | Provider adapters, approvals, bounded retries, idempotency and recovery | Explicitly authorized plan plus pre/postcondition verification | +| 4 — fleet operations | Scheduled drift detection, dashboards, alerts and lifecycle management | Provenance and audit history retained | + +## Source registry semantics + +The initial source map is in `config/fleet-engine.json`. Each source has a +narrow meaning and an explicit set of facts it may establish. A source may +provide evidence for one dimension without deciding another. + +| Source | Establishes | Does not establish | +|---|---|---| +| `config/template-consumers.yml` | Template membership and template sync tier/profile | README ownership or general write authority | +| `registered-imports.json` | Upstream URL, import platform and declared target name | Destination namespace when not explicitly present | +| `config/live-chain-manifest.json` | Mirror-chain membership and README audit policy | Permission to write mirror contents | +| `config/readme-subsystem.json` | Profile project roles and artifact ownership/direction | General fleet write permission | +| `config/gitlab-subgroups.yml` | GitLab subgroup placement; unlisted repositories fall back to `ops` | README ownership, lifecycle or write permission | +| Runtime workflow discovery | Dynamic targets observed in workflow configuration/execution | Static completeness or authorization without resolution | + +The five concepts below must remain separate: + +1. **Identity** — provider, namespace, project and default branch. +2. **Placement** — where a project resides on a forge, including GitLab subgroup + fallback. Placement is not ownership. +3. **Provenance and role** — import origin, fork/mirror relationship, template + membership and generated-consumer role. +4. **Content ownership** — who owns README content, template-managed files and + other generated artifacts. +5. **Operation authority** — the specific actions permitted for this project. + +An import's `target_name` is not sufficient to infer its destination namespace. +An unlisted GitLab project may be placed in `ops`, but that fallback must not +be interpreted as content ownership. A dynamic workflow target must retain +its discovery source and be marked unresolved until verified. + +## Dispositions and policy + +Each repository receives one explicit disposition: + +- `managed` — eligible for operations that are separately authorized. +- `protected` — writes are denied. +- `delegated` — another named publisher/owner controls the operation. +- `external` / `upstream-owned` — preserve upstream ownership. +- `disabled`, `archived`, `opt-out` — do not schedule normal work. +- `exception` — follow a documented, scoped exception. +- `unresolved` — identity, ownership or policy evidence is incomplete. + +Unknown facts default to `unresolved`; unknown operations are denied. Conflicts +must be recorded, not silently resolved by source precedence. Registry +membership is evidence of a relationship, never a grant of write access. +Protected, delegated, external, upstream-owned, disabled, archived, opt-out, +exception and unresolved records are non-writable unless a narrowly scoped +policy explicitly defines otherwise. + +For the README profile chain, the dedicated profile subsystem remains the +content owner: Fork-Sync-All owns reusable engines, the Interested-Deving-1896 +profile repository is the content source, and OSP/OOC profile repositories are +generated consumers. No generic fleet operation may become a competing README +writer. + +## Execution and verification boundary + +A plan must record the target identity, operation, owning subsystem, evidence, +policy decision, dependencies, expected preconditions and postconditions, and +approval requirement. Execution must be idempotent, bounded by rate/concurrency +budgets, cancellable, resumable, and safe under concurrent repository changes. + +A dispatch accepted by a provider is not proof of completion. Verification must +inspect the resulting commit, pull request, artifact, workflow result or other +operation-specific postcondition at the intended repository and ref. Partial +failure must remain visible and recoverable; never convert an unknown result +into success. + +- **Production-Ready Engine:** evaluates whether a component/workflow meets its + release-readiness criteria. +- **Verification Engine:** checks evidence and actual postconditions. +- **Fleet Engine:** chooses and coordinates work under portfolio policy, then + consumes verification results. + +The Fleet Engine must use the existing status/dashboard surfaces rather than +creating a competing dashboard. + +## Safety constraints for the initial implementation + +- Phase 0 and Phase 1 are read-only. +- No bulk README rewrite, forced template overwrite, protected-mirror write, + or broad workflow dispatch is implied by this contract. +- A mutation requires resolved identity and ownership, explicit operation + permission, a reviewable plan, required approval, and pre/postcondition + checks. +- Fleet-wide or destructive actions require separate approval. +- Preserve human-owned README sections and existing downstream mirror write + restrictions. +- Inventory completeness must be reported with unresolved counts and source + coverage; do not present partial registries as a complete repository fleet. + +## Validation + +The contract is stored in `config/fleet-engine.json` and described by +`schema/fleet-engine.schema.json`. Tests assert the deny-by-default policy, +the separation of registry dimensions, and the absence of pre-authorized +repository entries. Phase 1 will add deterministic reconciliation and fixture +coverage before any operational target is considered. diff --git a/DOCS/generated/eco-audit.md b/DOCS/generated/eco-audit.md index 392bc58b9..2e73cf329 100644 --- a/DOCS/generated/eco-audit.md +++ b/DOCS/generated/eco-audit.md @@ -1,6 +1,6 @@ # Eco Audit -> Generated 2026-11-22 by `scripts/eco/eco-audit.sh` +> Generated 2026-11-23 by `scripts/eco/eco-audit.sh` > Aligned with [KDE Eco](https://eco.kde.org/) / [Blue Angel DE-UZ 215](https://www.blauer-engel.de/en/certification/criteria) criteria. ## Score: 🟡 14/20 (70%) — B — Good @@ -11,7 +11,7 @@ | ✅ foss license | 2/2 | FOSS license present (LICENSE) + REUSE/SPDX compliant (.reuse/dep5 + LICENSES/) | | ✅ no telemetry | 2/2 | No telemetry/tracking found | | ⚠️ no forced updates | 1/2 | Possible forced update patterns (21 hits — review manually) | -| ✅ concurrency groups | 2/2 | Concurrency groups: 175/188 workflows (93%) | +| ✅ concurrency groups | 2/2 | Concurrency groups: 175/189 workflows (92%) | | ✅ graphql adoption | 2/2 | GraphQL adopted in 35 scripts (reduces API quota consumption) | | ✅ dep minimalism | 2/2 | Low dependency footprint: 0.3 installs/workflow avg | | ⚠️ carbon estimate | 1/2 | Carbon estimate available: ~27.13 kg CO2e/year (stub — KEcoLab needed for precision) | @@ -75,11 +75,11 @@ infrastructure. The stub below is ready to activate when hosted on GitLab. | Metric | Value | |---|---| -| Total workflows | 188 | -| Workflows with concurrency groups | 175 (93%) | +| Total workflows | 189 | +| Workflows with concurrency groups | 175 (92%) | | Scripts using GraphQL | 35 | | apt-get install calls | 22 | -| pip install calls | 20 | +| pip install calls | 21 | | npm/yarn/bun install calls | 6 | --- diff --git a/DOCS/generated/glossary.md b/DOCS/generated/glossary.md index 714b48bf0..47e14e4ed 100644 --- a/DOCS/generated/glossary.md +++ b/DOCS/generated/glossary.md @@ -1,6 +1,6 @@ # Glossary -> Auto-generated 2026-11-03 by `scripts/generate-book-pages.py` +> Auto-generated 2026-11-26 by `scripts/generate-book-pages.py` Definitions for every term, acronym, and concept used across fork-sync-all. diff --git a/DOCS/generated/registered-imports.md b/DOCS/generated/registered-imports.md index c65bea0ce..39770eb2c 100644 --- a/DOCS/generated/registered-imports.md +++ b/DOCS/generated/registered-imports.md @@ -2,7 +2,7 @@ All 156 upstream repositories tracked in `registered-imports.json`. These are synced to `Interested-Deving-1896` by `sync-registered-imports.yml` daily at 04:55 UTC. -> Auto-generated on 2026-11-03 from `registered-imports.json`. +> Auto-generated on 2026-11-26 from `registered-imports.json`. ## GitHub (155) diff --git a/DOCS/generated/source-tree.md b/DOCS/generated/source-tree.md index 53e33d030..c81bbb43c 100644 --- a/DOCS/generated/source-tree.md +++ b/DOCS/generated/source-tree.md @@ -1,6 +1,6 @@ # Source Tree -> Auto-generated 2026-11-03 by `scripts/generate-book-pages.py` +> Auto-generated 2026-11-26 by `scripts/generate-book-pages.py` Complete directory and file index of the fork-sync-all source hierarchy. Click any path to view it on GitHub. @@ -202,6 +202,7 @@ Click any path to view it on GitHub. | [`critical-deploy-gitlab.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/critical-deploy-gitlab.yml) | | | [`critical-deploy-stub.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/critical-deploy-stub.yml) | | | [`critical-deploy.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/critical-deploy.yml) | | +| [`declared-source-scope.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/declared-source-scope.yml) | | | [`delete-stale-repos.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/delete-stale-repos.yml) | | | [`dependency-risk-audit.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/dependency-risk-audit.yml) | | | [`deploy-book.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/deploy-book.yml) | | @@ -290,6 +291,7 @@ Click any path to view it on GitHub. | [`reconcile-identity-assets.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-identity-assets.yml) | | | [`reconcile-org-refs.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-org-refs.yml) | | | [`refresh-notebooklm-auth.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/refresh-notebooklm-auth.yml) | | +| [`registered-consumer-inventory.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/registered-consumer-inventory.yml) | | | [`release.yaml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/release.yaml) | | | [`repo-manifest.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/repo-manifest.yml) | | | [`resolve-ci.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/resolve-ci.yml) | | @@ -301,6 +303,7 @@ Click any path to view it on GitHub. | [`setup-gitlab-schedules.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-gitlab-schedules.yml) | | | [`setup-osp-mirrors.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-osp-mirrors.yml) | | | [`shallow-reclone-chromium.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/shallow-reclone-chromium.yml) | | +| [`submodule-directory-audit.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/submodule-directory-audit.yml) | | | [`support-bundle.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/support-bundle.yml) | | | [`sync-agent-prices.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-agent-prices.yml) | | | [`sync-btrfs-devel-branches.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-btrfs-devel-branches.yml) | | @@ -402,6 +405,7 @@ Click any path to view it on GitHub. | [`OPERATIONS.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/OPERATIONS.md) | | | [`README.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/README.md) | Project overview, mirror chain diagram, workflow count | | [`SUMMARY.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/SUMMARY.md) | | +| [`accessibility-rendering-evidence.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/accessibility-rendering-evidence.md) | | | [`accessibility.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/accessibility.md) | | | [`agent-budget-governor.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/agent-budget-governor.md) | | | [`agent-skills-api.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/agent-skills-api.md) | | @@ -412,9 +416,11 @@ Click any path to view it on GitHub. | [`contributing.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/contributing.md) | | | [`cover.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/cover.md) | | | [`dependency-risk-audit.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/dependency-risk-audit.md) | | +| [`fleet-engine.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/fleet-engine.md) | | | [`forge-capacity-governor.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/forge-capacity-governor.md) | | | [`forge-readme-parity.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/forge-readme-parity.md) | | | [`fsa-api-deployment.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/fsa-api-deployment.md) | | +| [`linktree-engine.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/linktree-engine.md) | | | [`mirror-readme-audit.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/mirror-readme-audit.md) | | | [`ota-reconcile.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/ota-reconcile.md) | | | [`ota-system.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/ota-system.md) | | @@ -422,6 +428,7 @@ Click any path to view it on GitHub. | [`profile-readmes.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/profile-readmes.md) | | | [`quota-costs.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/quota-costs.md) | | | [`readme-subsystem.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/readme-subsystem.md) | | +| [`rendering-compatibility.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/rendering-compatibility.md) | | | [`runbooks.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/runbooks.md) | | | [`support-bundles.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/support-bundles.md) | | | [`update-pr-branches.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/update-pr-branches.md) | | @@ -518,6 +525,7 @@ Click any path to view it on GitHub. | [`ci-check-targets.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/ci-check-targets.yml) | | | [`defaults.yaml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/defaults.yaml) | | | [`dependency-risk-policy.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/dependency-risk-policy.json) | | +| [`fleet-engine.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/fleet-engine.json) | | | [`flush-stage-contracts.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/flush-stage-contracts.yml) | | | [`forge-capacity.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/forge-capacity.yml) | | | [`fsa-deployments.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/fsa-deployments.yml) | | @@ -554,6 +562,21 @@ Click any path to view it on GitHub. | [`workflow-quota-costs.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/workflow-quota-costs.yml) | Per-workflow REST call cost estimates | | [`workflow-sync.yml`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/workflow-sync.yml) | Workflow sync registry (github_only vs paired) | +### [accessibility/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/config/accessibility) {#config-accessibility} + +| File | Description | +|---|---| +| [`integration-contract.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/accessibility/integration-contract.json) | | +| [`integration-contract.schema.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/accessibility/integration-contract.schema.json) | | + +### [rendering/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/config/rendering) {#config-rendering} + +| File | Description | +|---|---| +| [`fixtures.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/rendering/fixtures.json) | | +| [`presentation-target.schema.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/rendering/presentation-target.schema.json) | | +| [`presentation-targets.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/config/rendering/presentation-targets.json) | | + ## [data/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/data) {#data} | File | Description | @@ -573,6 +596,11 @@ Click any path to view it on GitHub. | File | Description | |---|---| +| [`declared-source-scope-inventory.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/declared-source-scope-inventory.md) | | +| [`external-services-engine.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/external-services-engine.md) | | +| [`registered-consumer-submodule-inventory.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/registered-consumer-submodule-inventory.md) | | +| [`submodule-directory-inventory.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/submodule-directory-inventory.md) | | +| [`submodule-repair-plans.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/submodule-repair-plans.md) | | | [`workflow-triggers.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/workflow-triggers.md) | | | [`workflow-triggers.txt`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/workflow-triggers.txt) | | @@ -1071,6 +1099,12 @@ Click any path to view it on GitHub. |---|---| | [`README.md`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/docs/openbooklm/reports/README.md) | Project overview, mirror chain diagram, workflow count | +## [examples/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/examples) {#examples} + +| File | Description | +|---|---| +| [`linktree-profile.example.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/examples/linktree-profile.example.json) | | + ## [fsa-api/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/fsa-api) {#fsa-api} | File | Description | @@ -1251,6 +1285,8 @@ Click any path to view it on GitHub. | File | Description | |---|---| +| [`fleet-engine.schema.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/schema/fleet-engine.schema.json) | | +| [`linktree-profile.schema.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/schema/linktree-profile.schema.json) | | | [`readme-subsystem.schema.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/schema/readme-subsystem.schema.json) | | ## [scripts/](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/scripts) {#scripts} @@ -1269,6 +1305,8 @@ Click any path to view it on GitHub. | [`audit-dependency-risk.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/audit-dependency-risk.py) | | | [`audit-forge-readme-parity.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/audit-forge-readme-parity.py) | | | [`audit-mirror-readmes.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/audit-mirror-readmes.py) | | +| [`audit-registered-consumers.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/audit-registered-consumers.py) | | +| [`audit-submodule-directory.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/audit-submodule-directory.py) | | | [`auto-merge-prs.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/auto-merge-prs.sh) | | | [`bdfs-dev-btrfs.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/bdfs-dev-btrfs.sh) | | | [`bdfs-dev-dwarfs.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/bdfs-dev-dwarfs.sh) | | @@ -1277,6 +1315,7 @@ Click any path to view it on GitHub. | [`bootstrap-org.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/bootstrap-org.sh) | | | [`branch-name-conv.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/branch-name-conv.sh) | | | [`branch-topology.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/branch-topology.py) | | +| [`build-declared-source-scope.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/build-declared-source-scope.py) | | | [`check-accessibility.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/check-accessibility.sh) | | | [`check-ci.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/check-ci.sh) | | | [`check-markdown-links.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/check-markdown-links.py) | | @@ -1303,9 +1342,11 @@ Click any path to view it on GitHub. | [`devcontainer-build.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/devcontainer-build.sh) | | | [`devcontainer-publish-features.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/devcontainer-publish-features.sh) | | | [`devcontainer-validate.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/devcontainer-validate.py) | | +| [`directory_inventory.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/directory_inventory.py) | | | [`dispatch-and-wait.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/dispatch-and-wait.sh) | | | [`docker-to-incus.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/docker-to-incus.sh) | | | [`dwarfs-pack.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/dwarfs-pack.sh) | | +| [`external_services.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/external_services.py) | | | [`file-bugzilla-report.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/file-bugzilla-report.sh) | | | [`flush-sentinel.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/flush-sentinel.sh) | | | [`flush-stage-dispatch.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/flush-stage-dispatch.sh) | | @@ -1327,6 +1368,7 @@ Click any path to view it on GitHub. | [`inject-badges.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/inject-badges.sh) | | | [`inject-motto.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/inject-motto.sh) | | | [`kde-path-to-gl-id.json`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/kde-path-to-gl-id.json) | | +| [`linktree_engine.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/linktree_engine.py) | | | [`list-active-runs.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/list-active-runs.sh) | | | [`list-chromium-gl-repos.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/list-chromium-gl-repos.py) | | | [`list-ci-targets.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/list-ci-targets.py) | | @@ -1370,6 +1412,7 @@ Click any path to view it on GitHub. | [`pin-profile.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/pin-profile.sh) | | | [`pin-version.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/pin-version.sh) | | | [`pipeline-telemetry.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/pipeline-telemetry.sh) | | +| [`plan-submodule-repairs.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/plan-submodule-repairs.py) | | | [`post-flush-prep.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/post-flush-prep.sh) | | | [`post-rotation-cleanup.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/post-rotation-cleanup.py) | | | [`pr-automation.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/pr-automation.sh) | | @@ -1441,6 +1484,7 @@ Click any path to view it on GitHub. | [`upstream-commits.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/upstream-commits.sh) | | | [`upstream-prs.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/upstream-prs.sh) | | | [`upstream-workflow-proposal.sh`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/upstream-workflow-proposal.sh) | | +| [`validate-accessibility-integration.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-accessibility-integration.py) | | | [`validate-agent-budget-config.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-agent-budget-config.py) | | | [`validate-cost-profiles.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-cost-profiles.py) | | | [`validate-flush-stage-contracts.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-flush-stage-contracts.py) | | @@ -1448,6 +1492,7 @@ Click any path to view it on GitHub. | [`validate-live-chain-manifest.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-live-chain-manifest.py) | | | [`validate-priority-tiers.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-priority-tiers.py) | | | [`validate-registered-imports.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-registered-imports.py) | | +| [`validate-rendering-profiles.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-rendering-profiles.py) | | | [`validate-template-config.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-template-config.py) | | | [`validate-workflow-guards.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-workflow-guards.py) | Validates all 112 workflow files (5 checks) | | [`validate-workflow-shell.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/scripts/validate-workflow-shell.py) | | @@ -1525,6 +1570,7 @@ Click any path to view it on GitHub. | File | Description | |---|---| | [`conftest.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/conftest.py) | | +| [`test_accessibility_integration.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_accessibility_integration.py) | | | [`test_add_mirror_repo.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_add_mirror_repo.py) | | | [`test_agent_badge_registry.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_agent_badge_registry.py) | | | [`test_agent_budget_governor.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_agent_budget_governor.py) | | @@ -1534,11 +1580,17 @@ Click any path to view it on GitHub. | [`test_audit_dependency_risk.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_audit_dependency_risk.py) | | | [`test_audit_forge_readme_parity.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_audit_forge_readme_parity.py) | | | [`test_audit_mirror_readmes.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_audit_mirror_readmes.py) | | +| [`test_audit_registered_consumers.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_audit_registered_consumers.py) | | +| [`test_audit_submodule_directory.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_audit_submodule_directory.py) | | | [`test_auto_merge_protection_detection.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_auto_merge_protection_detection.py) | | | [`test_bdfs_safety.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_bdfs_safety.py) | | | [`test_check_markdown_links.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_check_markdown_links.py) | | | [`test_critical_deploy_all.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_critical_deploy_all.py) | | +| [`test_declared_source_scope.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_declared_source_scope.py) | | +| [`test_directory_inventory.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_directory_inventory.py) | | | [`test_dispatch_and_full_chain.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_dispatch_and_full_chain.py) | | +| [`test_external_services.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_external_services.py) | | +| [`test_fleet_engine_contract.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_fleet_engine_contract.py) | | | [`test_flush_lifecycle.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_flush_lifecycle.py) | | | [`test_flush_rehearsal_contracts.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_flush_rehearsal_contracts.py) | | | [`test_forge_capacity_manager.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_forge_capacity_manager.py) | | @@ -1548,16 +1600,20 @@ Click any path to view it on GitHub. | [`test_gh_api_transport.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_gh_api_transport.py) | | | [`test_git_platform_sync.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_git_platform_sync.py) | | | [`test_hw_detect_ci.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_hw_detect_ci.py) | | +| [`test_linktree_engine.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_linktree_engine.py) | | | [`test_live_chain_manifest.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_live_chain_manifest.py) | | | [`test_llm_response.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_llm_response.py) | | +| [`test_manage_subtrees_safety.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_manage_subtrees_safety.py) | | | [`test_managed_estate_queue_drain.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_managed_estate_queue_drain.py) | | | [`test_merge_strategy_classifier.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_merge_strategy_classifier.py) | | | [`test_mirror_orgs.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_mirror_orgs.py) | | | [`test_new_scripts.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_new_scripts.py) | | | [`test_notifications.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_notifications.py) | | +| [`test_onboard_detect.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_onboard_detect.py) | | | [`test_ota_reconcile.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_ota_reconcile.py) | | | [`test_pipeline_guard.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_pipeline_guard.py) | | | [`test_pipeline_telemetry_issue.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_pipeline_telemetry_issue.py) | | +| [`test_plan_submodule_repairs.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_plan_submodule_repairs.py) | | | [`test_platform_adapter_capacity.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_platform_adapter_capacity.py) | | | [`test_post_flush_blocking.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_post_flush_blocking.py) | | | [`test_pr_backlog_prevention.py`](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/tests/test_pr_backlog_prevention.py) | | diff --git a/DOCS/generated/subgroup-map.md b/DOCS/generated/subgroup-map.md index 21a05a0ff..612bc27d5 100644 --- a/DOCS/generated/subgroup-map.md +++ b/DOCS/generated/subgroup-map.md @@ -2,7 +2,7 @@ All 228 OSP-bound repositories mapped to their GitLab subgroup under [`openos-project`](https://gitlab.com/openos-project). This is the single source of truth used by `mirror-osp-to-gitlab.sh`. -> Auto-generated on 2026-11-03 from `config/gitlab-subgroups.yml`. +> Auto-generated on 2026-11-26 from `config/gitlab-subgroups.yml`. | Subgroup | GitLab ID | Repos | GitLab URL | |---|---|---|---| diff --git a/DOCS/generated/workflow-reference.md b/DOCS/generated/workflow-reference.md index 6c8b8fb02..af7d45ceb 100644 --- a/DOCS/generated/workflow-reference.md +++ b/DOCS/generated/workflow-reference.md @@ -3,7 +3,7 @@ All workflows in `.github/workflows/`, grouped by priority tier. For trigger details and schedules see [Workflow Triggers](../workflow-triggers.md). -> Auto-generated on 2026-11-03 from `config/workflow-quota-costs.yml` +> Auto-generated on 2026-11-26 from `config/workflow-quota-costs.yml` > and `config/workflow-priority-tiers.yml`. **Quota cost columns:** Low = fast/cached run · Mid = typical (p50) · High = large/uncached (p95) @@ -53,7 +53,7 @@ For trigger details and schedules see [Workflow Triggers](../workflow-triggers.m | [Mirror Chain Dispatch](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-chain-dispatch.yml) | Agnostic mirror-chain backend. Dispatch-only on canonical instance — dedicated mirror workflows own schedules. Downstream forks without dedicated workflows may add a schedule. | | 1200 | 5 | 50 | 800 | | [Mirror Flatpak Repo](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-flatpak.yml) | Builds and publishes a self-hosted Flatpak repo on GitHub Pages. Downloads Flatpak bundles from OSP/OOC releases and imports them into the org flatpak-repo. | Daily 05:00 UTC | 300 | 20 | 60 | 150 | | [Mirror GHCR Images](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-ghcr.yml) | Re-tags and pushes GHCR container images from an upstream owner into OSP and OOC orgs. Daily schedule. | Daily 03:00 UTC | 200 | 10 | 40 | 100 | -| [Mirror Interested-Deving-1896 → OSP](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-to-osp.yml) | Bare-clones every repo in Interested-Deving-1896 and git push --mirror into OpenOS-Project-OSP, syncing all branches, tags, and refs exactly. | 17 1/6 * * * | 500 | 1 | 1 ✦ | 1 | +| [Mirror Interested-Deving-1896 → OSP](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-to-osp.yml) | Bare-clones every repo in Interested-Deving-1896 and git push --mirror into OpenOS-Project-OSP, syncing all branches, tags, and refs exactly. | 17 1/6 * * * | 500 | 1 | 1 ✦ | 2 | | [Mirror OSP → GitLab](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-osp-to-gitlab.yml) | Mirrors every repo in OpenOS-Project-OSP to its GitLab counterpart under openos-project, creating the GitLab project in the correct subgroup if it does not exist yet. | Daily 01:23 UTC | 1500 | 5 | 20 | 50 | | [Mirror PyPI Packages](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-pypi.yml) | Re-publishes PyPI packages from upstream repos to OSP/OOC with org-prefixed package names (e.g. osp-linux-kernel-manager). | Manual | 100 | 5 | 20 | 60 | | [Mirror RPM Repo](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-rpm.yml) | Mirrors RPM packages from OSP/OOC releases to a self-hosted RPM repo on GitHub Pages. Daily schedule. | Daily 04:30 UTC | 200 | 10 | 40 | 100 | @@ -65,11 +65,11 @@ For trigger details and schedules see [Workflow Triggers](../workflow-triggers.m | [Pre-Mirror CI Gate](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/pre-mirror-ci-gate.yml) | Checks CI status on all OSP-bound repos in Interested-Deving-1896 before mirroring. Dispatches resolve-failures for red repos, waits, then re-checks. Blocks the mirror if repos are still failing. | Manual | 800 | 50 | 150 | 300 | | [Push Kernel Content](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/push-kernel-content.yml) | Pushes kernel version metadata (READY, VERSION, config/, patches/, README.md) to the debian-{arch}-kernel-base repos (one per arch, up to 10). | Manual | 100 | 10 | 30 | 80 | | [Seed Patchset Branches](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/seed-patchset-branches.yml) | Seeds 9 patchset branches per debian-{arch}-kernel-base repo for Debian (trixie/forky/sid), Devuan (excalibur/forky/ceres), and Ubuntu (resolute/stonking/devel). | Manual | 200 | 20 | 60 | 150 | -| [Sync All Forks](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-forks.yml) | Syncs all branches of every fork owned by Interested-Deving-1896 with their upstream via the GitHub merge-upstream API, falling back to force-reset on divergence. | Daily 21:07 UTC | 1500 | 0 | 0 ✦ | 222 | +| [Sync All Forks](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-forks.yml) | Syncs all branches of every fork owned by Interested-Deving-1896 with their upstream via the GitHub merge-upstream API, falling back to force-reset on divergence. | Daily 21:07 UTC | 1500 | 0 | 0 ✦ | 250 | | [Sync KDE Groups Mirrors](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-kde-groups-mirrors.yml) | Syncs all KDE group mirror repos under openos-project/kde-ecosystem-deving/kde-groups from invent.kde.org. Daily schedule. | Daily 01:00 UTC | 300 | 20 | 80 | 200 | | [Sync KDE Neon Mirrors](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-kde-neon-mirrors.yml) | Syncs all KDE Neon mirror repos in openos-project/kde-ecosystem-deving/neon-deving from invent.kde.org/neon/. Daily schedule, offset 30 min from Sync KDE Groups Mirrors. | Daily 01:30 UTC | 300 | 20 | 80 | 200 | | [Sync Pieroproietti GitLab Forks](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-pieroproietti-gl-forks.yml) | Syncs the three pieroproietti GitLab forks (penguins-eggs, penguins-eggs-book, oa-tools) from their GitHub upstreams. Mirrors branches, tags, and creates GitLab Releases for new tags. | Daily 02:15 UTC | 100 | 5 | 15 | 40 | -| [Sync Registered Imports](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-registered-imports.yml) | Re-syncs all repos listed in registered-imports.json — bare-clones each source URL and pushes all branches and tags to Interested-Deving-1896. | Daily 04:55 UTC | 1000 | 0 | 4 ✦ | 1150 | +| [Sync Registered Imports](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-registered-imports.yml) | Re-syncs all repos listed in registered-imports.json — bare-clones each source URL and pushes all branches and tags to Interested-Deving-1896. | Daily 04:55 UTC | 1000 | 0 | 5 ✦ | 707 | | [Sync Upstream Mirrors (GitLab)](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-upstream-mirrors.yml) | Syncs all upstream mirror repos in openos-project/upstream-mirrors from their original GitHub sources. Daily schedule. | Daily 00:00 UTC | 200 | 10 | 40 | 100 | | [Sync from GitLab](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-from-gitlab.yml) | DEPRECATED. Superseded by Git Platform Sync (direction=pull). Stub kept for backwards compatibility. | Manual | 100 | 0 | 0 | 0 | | [Sync to GitLab Variant](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-to-gitlab-variant.yml) | Variant of Sync to GitLab that uses a different token and push strategy — used when the primary sync is blocked or for testing. | Daily 01:50 UTC | 1000 | 5 | 20 | 50 | @@ -91,10 +91,10 @@ For trigger details and schedules see [Workflow Triggers](../workflow-triggers.m | [Build x86-64](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/build-x86.yml) | Builds the project for x86-64 architecture. | Manual | 20 | 1 | 2 | 5 | | [CI](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/ci.yaml) | Runs CI checks on push and pull request events. | On push | 20 | 1 | 2 | 5 | | [Check Accessibility](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/check-accessibility.yml) | Multi-layer accessibility audit — CODEOWNERS coverage, README screen-reader scan, WCAG 2.1 AA HTML check, audio overview (espeak-ng), and Braille output (liblouis). Commits README.audio.mp3 and README.brl artifacts. | Weekly Mon 04:29 UTC | 500 | 5 | 15 | 40 | -| [Check CI Status](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/check-ci.yml) | Agnostic CI status checker. Runs check-ci.sh for each enabled target in config/ci-check-targets.yml (GitHub orgs and GitLab groups). | Daily 17:05 UTC | 1500 | 0 | 0 ✦ | 32 | +| [Check CI Status](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/check-ci.yml) | Agnostic CI status checker. Runs check-ci.sh for each enabled target in config/ci-check-targets.yml (GitHub orgs and GitLab groups). | Daily 17:05 UTC | 1500 | 0 | 0 ✦ | 16 | | [Check OOC CI Status](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/check-ooc-ci.yml) | Daily check of CI status on the default branch HEAD for every OOC-bound repo. Reports failing repos to the step summary. | Daily 21:30 UTC | 500 | 50 | 150 | 300 | | [Check Shell Tools CI](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/check-shell-tools-ci.yml) | Batch-fetches CI run status for all 24 shell-tools repos via a single GraphQL query. Minimal quota cost. Weekly Monday 06:30 UTC. | Weekly Mon 06:30 UTC | 300 | 1 | 2 | 3 | -| [Cleanup Stale Branches](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-branches.yml) | Deletes branches that have been merged into the default branch across all repos in Interested-Deving-1896, OSP, and OOC. | 29 4 1 * * | 200 | 90 | 98 ✦ | 315 | +| [Cleanup Stale Branches](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-branches.yml) | Deletes branches that have been merged into the default branch across all repos in Interested-Deving-1896, OSP, and OOC. | 29 4 1 * * | 200 | 107 | 130 ✦ | 513 | | [Cleanup Template Pollution](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-pollution.yml) | Removes files incorrectly propagated from fork-sync-all to consumer repos via the template sync pipeline, across all three GitHub orgs and GitLab. | Manual | 200 | 20 | 80 | 200 | | [Clone Org](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/clone-org.yml) | Clones all repositories from an org or user on any supported platform (GitHub, GitLab, Bitbucket, Gitea) into Interested-Deving-1896. | Manual | 200 | 20 | 80 | 200 | | [Create Missing READMEs](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/create-readmes.yml) | Creates README.md from the standard template for OSP-bound repos that have no README, with placeholder sections for human-owned content. | Daily 15:08 UTC | 1500 | 20 | 80 | 200 | @@ -110,7 +110,7 @@ For trigger details and schedules see [Workflow Triggers](../workflow-triggers.m | [Generate Book Pages](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/generate-book-pages.yml) | Regenerates DOCS/generated/ pages from config sources (workflow-quota-costs.yml, priority-tiers.yml, gitlab-subgroups.yml, registered-imports.json) and commits the result. | Manual | 50 | 1 | 2 | 5 | | [Generate Repo Descriptions](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/generate-repo-descriptions.yml) | AI-powered per-file description generator. Fetches file tree (1 REST call) then reads each file for context (1 REST call per file) before calling GitHub Models. Cost scales with MAX_FILES setting. | Weekly Sun 03:30 UTC | 300 | 20 | 100 | 300 | | [HW Detect CI](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/hw-detect-ci.yml) | Runs CI for hardware detection tooling on schedule and push. | Weekly Mon 06:19 UTC | 50 | 2 | 5 | 15 | -| [Inject AI Agent Badges](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-badges.yml) | Adds provider-neutral AI-agent badges to managed README files that are missing it. Skips repos that already have the badge. | 15 8 */2 * * | 1500 | 90 | 532 ✦ | 1769 | +| [Inject AI Agent Badges](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-badges.yml) | Adds provider-neutral AI-agent badges to managed README files that are missing it. Skips repos that already have the badge. | 15 8 */2 * * | 1500 | 108 | 552 ✦ | 1507 | | [List Active Runs](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/list-active-runs.yml) | Lists all active workflow runs with clickable web and API URLs. | 7,37 * * * * | 50 | 2 | 3 | 5 | | [Manage Repo Settings](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/manage-repo-settings.yml) | Declarative repo settings drift detection and enforcement. Check mode reads current state (1 REST call per repo) and reports drift. Apply mode patches drifted fields (1-3 REST calls per drifted repo). | Weekly Mon 04:30 UTC | 200 | 10 | 60 | 150 | | [Mirror README Audit](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-readme-audit.yml) | Audits every live mirror-chain README against the neutral managed baseline and reports downstream drift and documented exceptions. | Weekly Tue 07:23 UTC | 300 | 100 | 150 | 200 | @@ -130,7 +130,7 @@ For trigger details and schedules see [Workflow Triggers](../workflow-triggers.m | [README Subsystem Status](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem-status.yml) | Audits engine and profile drift across all three README repositories, checks every Pages site, and maintains a status dashboard. | Daily 06:37 UTC | 10 | 4 | 7 | 10 | | [Rebuild LTS Branch (penguins-eggs)](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/rebase-lts.yml) | Rebases the all-features branch onto the upstream master after each pieroproietti sync, then force-pushes the result to the lts branch. | Manual | 50 | 5 | 15 | 30 | | [Reconcile Identity Assets](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-identity-assets.yml) | Detects the current FSA instance, selects the matching brand variant, writes active assets to assets/brand/.active/, and injects identity content into DOCS/cover.md. | Manual | 10 | 1 | 3 | 5 | -| [Reconcile Org References](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-org-refs.yml) | Rewrites org/repo references in OSP and OOC mirrors to point at the correct org, fixing stale Interested-Deving-1896 references left by the mirror process. | 50 5 */2 * * | 300 | 114 | 181 ✦ | 2771 | +| [Reconcile Org References](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-org-refs.yml) | Rewrites org/repo references in OSP and OOC mirrors to point at the correct org, fixing stale Interested-Deving-1896 references left by the mirror process. | 50 5 */2 * * | 300 | 120 | 393 ✦ | 2731 | | [Release](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/release.yaml) | Creates a GitHub release and uploads build artifacts on tag push. | Manual | 100 | 5 | 15 | 30 | | [Resolve CI Failures](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/resolve-failures.yml) | Analyses CI failure patterns across OSP-bound repos and applies automated fixes (dependency updates, config corrections, workflow patches) where possible. | Manual | 100 | 10 | 40 | 100 | | [Resolve CI Failures (Agnostic)](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/resolve-ci.yml) | Agnostic CI failure resolver. Runs resolve-ci.sh for each enabled target in config/ci-check-targets.yml. GitHub targets use LLM analysis and auto-fix; GitLab targets retry failed/canceled pipelines. | Daily 15:53 UTC | 100 | 10 | 120 | 400 | diff --git a/DOCS/linktree-engine.md b/DOCS/linktree-engine.md new file mode 100644 index 000000000..04d08653a --- /dev/null +++ b/DOCS/linktree-engine.md @@ -0,0 +1,61 @@ +# Linktree Engine + +The FSA Linktree Engine is a provider-neutral link-in-bio profile pipeline. “Linktree” is a convenient project name, not a dependency on the commercial Linktree service. + +## Current implementation + +The initial offline core provides: + +- A versioned canonical JSON profile (`schema/linktree-profile.schema.json`). +- A dependency-free validator and static HTML/CSS renderer (`scripts/linktree_engine.py`). +- An example profile (`examples/linktree-profile.example.json`). +- Offline unit tests (`tests/test_linktree_engine.py`). +- Escaped user content, HTTP(S)-only destinations, no embedded URL credentials, accessible navigation, responsive styling, `noopener noreferrer`, a restrictive page CSP, and analytics disabled by default. + +## Use + +Validate a profile: + +```sh +python3 scripts/linktree_engine.py validate examples/linktree-profile.example.json +``` + +Render a static site: + +```sh +python3 scripts/linktree_engine.py render examples/linktree-profile.example.json --output /tmp/linktree-site +``` + +The renderer writes only `index.html` and `style.css` to the requested output directory. It does not publish, modify a remote repository, change DNS, or replace an existing profile. + +Run tests: + +```sh +python3 -m unittest tests.test_linktree_engine -v +``` + +## Architecture and next adapters + +The canonical profile is the source of truth. Provider adapters translate it into target-specific formats without changing profile semantics: + +- Static HTML/CSS and GitHub Pages. +- LittleLink and LittleLink-Server. +- LinkFree and its theme format. +- linkyee and other static profile generators. +- Self-hosted deployments where the application exposes a documented, permitted configuration interface. +- Commercial Linktree only through documented public interfaces or user-authorized exports; never bypass authentication or scrape private account data. + +Link audits must call the shared External Services Engine from issue #1067 rather than implementing a second HTTP client. A 403, CAPTCHA, bot restriction, or rate limit is inconclusive, not proof that a destination is dead. + +## Safety and privacy + +- Analytics provider is `none` in this core. No third-party scripts, pixels, cookies, or telemetry are emitted. +- Only HTTP(S) destinations are accepted; embedded URL credentials and unsafe schemes are rejected. +- All user-controlled text and attribute values are HTML-escaped. +- External links opened in a new tab include `noopener noreferrer`. +- The renderer never embeds secrets and never performs network requests. +- Publishing adapters must be dry-run-first, least-privilege, auditable, idempotent, and must produce reviewable diffs. Domain/DNS changes and destructive replacement remain separate approval-gated actions. + +## Current limitations + +This is a working validator/static renderer, not yet the complete multi-provider engine. Repository discovery, upstream/fork divergence analysis, URL revalidation, provider import/export adapters, deployment automation, visual/accessibility testing, and cross-port integration remain follow-up work tracked by issue #1124. No existing Linktree URL or profile repository is modified by this initial core. diff --git a/DOCS/rendering-compatibility.md b/DOCS/rendering-compatibility.md new file mode 100644 index 000000000..8852096cd --- /dev/null +++ b/DOCS/rendering-compatibility.md @@ -0,0 +1,55 @@ +# Git platform presentation compatibility + +FSA's existing Rendering Engine remains the owner of Markdown/content analysis, +preview and accessibility checks. This registry describes the provider, content +surface and client against which an observation was made. It is not a second +Git-hosting connector: provider identity and API capabilities belong to the +Agnostic Git Platform Connector Engine (#1149). + +## Evidence model + +- unknown: no reproducible observation is recorded; this is the default. +- verified: behavior was reproduced for the exact target and version. +- partially-verified: only a subset of features or environments was tested. +- unsupported: a feature was tested and shown not to work for that target. +- stale: prior evidence no longer describes the tested version/environment. + +A static fixture proves only that the fixture exists and can be supplied to a +test. It does not prove how a hosted renderer or native mobile app displays it. +Browser/device observations should record provider instance, surface, client, +app/browser version, OS, viewport/device, fixture revision, date, and evidence +location. Never promote a target from unknown based on parser support, a +user-agent guess, or a test against a different client. + +## Registry and fixtures + +- config/rendering/presentation-targets.json contains versioned target profiles. +- config/rendering/presentation-target.schema.json defines the JSON Schema. +- config/rendering/fixtures.json is the shared fixture inventory. +- scripts/validate-rendering-profiles.py checks structure and fixture references. + It intentionally does not claim visual compatibility. + +Run locally: + + python3 scripts/validate-rendering-profiles.py + bash scripts/tests/test-check-readme-render-mobile.sh + bash scripts/check-readme-render.sh README.md + +## Existing mobile heuristics + +The legacy README checker remains in place. Its mobile rules are static-analysis +heuristics, not verified claims about every GitHub Android release or WebKit +version. Assertions about parser crashes, memory pressure, CSP allowlists, image +extension case sensitivity, and table scrolling require versioned reproduction. +Do not convert these warnings into hard errors solely because a pattern matched. +Do not expand an image-host allowlist as a substitute for checking redirects, +response content type, asset availability, and the actual client policy. + +## Safe rollout + +The initial delivery is registry, fixture inventory, and structural validation. +No README content, repository settings, badges, mirror configuration, or +production rendering behavior is changed. Browser screenshot automation and +physical/emulated Android/iOS coverage are follow-on work and must record their +actual tested environments. Any content remediation remains reviewable and +subject to existing README ownership and Global Authorization Gate. diff --git a/DOCS/workflow-triggers.md b/DOCS/workflow-triggers.md index d18a65c5a..8d30b467e 100644 --- a/DOCS/workflow-triggers.md +++ b/DOCS/workflow-triggers.md @@ -4,7 +4,7 @@ All workflows in `.github/workflows/`. Grouped by function, with every trigger l > Plain-text version: [`DOCS/workflow-triggers.txt`](workflow-triggers.txt) > Published: [interested-deving-1896.github.io/fork-sync-all/workflow-triggers.html](https://interested-deving-1896.github.io/fork-sync-all/workflow-triggers.html) -> Auto-generated on 2026-11-03 from `.github/workflows/` and `config/workflow-quota-costs.yml` +> Auto-generated on 2026-11-26 from `.github/workflows/` and `config/workflow-quota-costs.yml` --- @@ -34,7 +34,7 @@ Jump to any section: | [Quota & Queue Management](#quota--queue-management) | 5 | | [README Management](#readme-management) | 10 | | [Security & Compliance](#security--compliance) | 6 | -| [Utility / On-Demand](#utility--on-demand) | 30 | +| [Utility / On-Demand](#utility--on-demand) | 33 | **Quick links:** [Glossary](#glossary) · [Schedule Summary](#schedule-summary-utc) · [Source](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/.github/workflows) @@ -212,7 +212,7 @@ Jump to any section: |---|---|---|---|---| | Reconcile Identity Assets [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-identity-assets.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/reconcile-identity-assets.yml) | Detects the current FSA instance, selects the matching brand variant, writes active assets to assets/brand/.active/, and injects identity content into DOCS/cover.md. | `reconcile-identity-assets.yml` | — | push to `assets/brand/**`, `config/identity-assets.yml`, `DOCS/cover.md` · dispatch | | Cleanup Stale Branches [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-branches.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/cleanup-branches.yml) | Deletes branches that have been merged into the default branch across all repos in Interested-Deving-1896, OSP, and OOC. | `cleanup-branches.yml` | Monthly 1st 04:29 | `Sync All Forks` completes · dispatch | -| Validate Config [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-config.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-config.yml) | Validates all config files (gitlab-subgroups.yml, workflow-sync.yml, priority-tiers.yml, registered-imports.json) on every push that touches them. Blocks merges on invalid config. | `validate-config.yml` | — | push to `config/gitlab-subgroups.yml`, `config/live-chain-manifest.json`, `config/flush-stage-contracts.yml` (+30 more) · pull_request · dispatch | +| Validate Config [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-config.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-config.yml) | Validates all config files (gitlab-subgroups.yml, workflow-sync.yml, priority-tiers.yml, registered-imports.json) on every push that touches them. Blocks merges on invalid config. | `validate-config.yml` | — | push to `config/gitlab-subgroups.yml`, `config/live-chain-manifest.json`, `config/flush-stage-contracts.yml` (+31 more) · pull_request · dispatch | | Reconcile Org References [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-org-refs.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/reconcile-org-refs.yml) | Rewrites org/repo references in OSP and OOC mirrors to point at the correct org, fixing stale Interested-Deving-1896 references left by the mirror process. | `reconcile-org-refs.yml` | 50 5 */2 * * | dispatch | | Cleanup Template Pollution [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-pollution.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/cleanup-pollution.yml) | Removes files incorrectly propagated from fork-sync-all to consumer repos via the template sync pipeline, across all three GitHub orgs and GitLab. | `cleanup-pollution.yml` | — | `Sync Template` completes · dispatch | | Sync Template [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-template.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/sync-template.yml) | Syncs fork-sync-all's file tree into target repos. Three modes — create (new repo + mirror chain), inject (copy into existing repo), propagate (push-triggered sync to all consumers in template-consumers.yml). | `sync-template.yml` | — | push to `.devcontainer/**`, `.ona/**`, `config/readme-subsystem*.json` (+8 more) · dispatch | @@ -309,7 +309,7 @@ Jump to any section: |---|---|---|---|---| | Create Missing READMEs [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/create-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/create-readmes.yml) | Creates README.md from the standard template for OSP-bound repos that have no README, with placeholder sections for human-owned content. | `create-readmes.yml` | Daily 15:08 | dispatch | | Update READMEs [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/update-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/update-readmes.yml) | Regenerates AI-owned sections (what-it-does, architecture, ci, mirror-chain, etc.) in README.md for all OSP-bound repos, preserving human-owned sections. | `update-readmes.yml` | Daily 02:50 | push to `config/gitlab-subgroups.yml`, `config/template-manifest.yml` · `Sync Registered Imports` completes · dispatch | -| Validate README Render [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-readme-render.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-readme-render.yml) | Checks README.md for rendering issues — leaked log lines, unclosed fences, bare brackets, raw angle brackets, unclosed AI markers, missing H1, and empty sections. | `validate-readme-render.yml` | — | push to `README.md` · dispatch | +| Validate README Render [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-readme-render.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-readme-render.yml) | Checks README.md for rendering issues — leaked log lines, unclosed fences, bare brackets, raw angle brackets, unclosed AI markers, missing H1, and empty sections. | `validate-readme-render.yml` | — | push to `README.md`, `config/rendering/**`, `scripts/validate-rendering-profiles.py` (+1 more) · pull_request · dispatch | | Inject AI Agent Badges [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-badges.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/inject-badges.yml) | Adds provider-neutral AI-agent badges to managed README files that are missing it. Skips repos that already have the badge. | `inject-badges.yml` | 15 8 */2 * * | dispatch | | LTS README Standardisation [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/lts-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/lts-readmes.yml) | Standardises README.md structure for LTS-tagged repos, ensuring they follow the LTS template with correct version badges and support tables. | `lts-readmes.yml` | Monthly 1st 03:19 | dispatch | | Inject Repo Motto [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-motto.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/inject-motto.yml) | Injects repo motto/slogan into README.md files across all orgs. | `inject-motto.yml` | 30 8 */2 * * | dispatch | @@ -346,23 +346,26 @@ Jump to any section: | CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/ci.yaml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/ci.yaml) | Runs CI checks on push and pull request events. | `ci.yaml` | push to `tests/run-tests.sh`, `profiles/**`, `.github/workflows/ci.yaml` · pull_request | | Clear All Notifications [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/clear-notifications.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/clear-notifications.yml) | Safely marks repository-scoped or explicitly confirmed global GitHub notifications as read. | `clear-notifications.yml` | dispatch | | Clone Org [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/clone-org.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/clone-org.yml) | Clones all repositories from an org or user on any supported platform (GitHub, GitLab, Bitbucket, Gitea) into Interested-Deving-1896. | `clone-org.yml` | dispatch | +| Declared Source Scope Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/declared-source-scope.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/declared-source-scope.yml) | | `declared-source-scope.yml` | push to `registered-imports.json`, `.gitmodules`, `config/template-consumers.yml` (+7 more) · pull_request · dispatch | | Dependency Risk Audit [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/dependency-risk-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/dependency-risk-audit.yml) | Produces a severity-prioritized dependency vulnerability backlog and blocks on non-exempt critical alerts. | `dependency-risk-audit.yml` | push to `config/dependency-risk-policy.json`, `scripts/audit-dependency-risk.py`, `.github/workflows/dependency-risk-audit.yml` · dispatch | | Forge README Parity [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/forge-readme-parity.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/forge-readme-parity.yml) | Compares README content across enabled GitHub and GitLab surfaces and checks profile Markdown links. | `forge-readme-parity.yml` | push to `config/fsa-deployments.yml`, `config/mirror-readme-baseline.json`, `scripts/audit-forge-readme-parity.py` (+4 more) · dispatch | | Fork KDE Neon Repos [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/fork-neon-repos.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/fork-neon-repos.yml) | One-shot workflow that clones the 6 KDE Invent neon repos into Interested-Deving-1896 and pushes them through the OSP mirror chain. Ongoing re-sync handled by sync-registered-imports. | `fork-neon-repos.yml` | dispatch | | GitLab Storage Scan [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/gl-storage-scan.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/gl-storage-scan.yml) | Scans all projects under openos-project on GitLab and reports storage usage. Useful for diagnosing when the namespace approaches its 10 GiB limit. | `gl-storage-scan.yml` | dispatch | -| HW Detect CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/hw-detect-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/hw-detect-ci.yml) | Runs CI for hardware detection tooling on schedule and push. | `hw-detect-ci.yml` | push to `scripts/hw-detect.sh`, `scripts/hw-build-env.sh`, `scripts/kport/kport-detect*.sh` (+3 more) · pull_request · dispatch | +| HW Detect CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/hw-detect-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/hw-detect-ci.yml) | Runs CI for hardware detection tooling on schedule and push. | `hw-detect-ci.yml` | push to `scripts/hw-detect.sh`, `scripts/hw-build-env.sh`, `scripts/kport/kport-detect*.sh` (+4 more) · pull_request · dispatch | | List Chromium GitLab Repos [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/list-chromium-repos.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/list-chromium-repos.yml) | Lists all projects under the Chromium_Browser_OS_Deving GitLab group. Informational only — used to audit what has been mirrored. | `list-chromium-repos.yml` | dispatch | | Merge Repos into Monorepo [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/merge-to-monorepo.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/merge-to-monorepo.yml) | Merges multiple git repositories into a single monorepo, preserving full commit history, tags, and Git LFS objects. Manual dispatch only. | `merge-to-monorepo.yml` | dispatch | | Mirror README Audit [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-readme-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/mirror-readme-audit.yml) | Audits every live mirror-chain README against the neutral managed baseline and reports downstream drift and documented exceptions. | `mirror-readme-audit.yml` | push to `config/mirror-readme-baseline.json`, `config/live-chain-manifest.json`, `scripts/audit-mirror-readmes.py` (+4 more) · dispatch | | Pre-Mirror CI Gate [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/pre-mirror-ci-gate.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/pre-mirror-ci-gate.yml) | Checks CI status on all OSP-bound repos in Interested-Deving-1896 before mirroring. Dispatches resolve-failures for red repos, waits, then re-checks. Blocks the mirror if repos are still failing. | `pre-mirror-ci-gate.yml` | `Reconcile Org References` completes · dispatch | | README Subsystem Status [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem-status.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem-status.yml) | Audits engine and profile drift across all three README repositories, checks every Pages site, and maintains a status dashboard. | `readme-subsystem-status.yml` | push to `config/readme-subsystem.json`, `scripts/readme-subsystem-status.py`, `.github/workflows/readme-subsystem-status.yml` · dispatch | -| README Subsystem [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem.yml) | Validates and cross-ports the forge-neutral README subsystem from its canonical owner into the profile publication chain. | `readme-subsystem.yml` | push to `DOCS/readme-subsystem.md`, `config/readme-policy.json`, `config/readme-subsystem.json` (+10 more) · pull_request · dispatch | +| README Subsystem [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem.yml) | Validates and cross-ports the forge-neutral README subsystem from its canonical owner into the profile publication chain. | `readme-subsystem.yml` | push to `DOCS/readme-subsystem.md`, `config/readme-policy.json`, `config/readme-subsystem.json` (+11 more) · pull_request · dispatch | | README Updater Validation [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-updater-validation.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-updater-validation.yml) | | `readme-updater-validation.yml` | pull_request · dispatch | +| Registered Consumer Submodule Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/registered-consumer-inventory.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/registered-consumer-inventory.yml) | | `registered-consumer-inventory.yml` | push to `config/template-consumers.yml`, `scripts/audit-registered-consumers.py`, `scripts/directory_inventory.py` (+3 more) · pull_request · dispatch | | Repo Manifest [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/repo-manifest.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/repo-manifest.yml) | Exports a manifest of all repos in an org, or imports repos from a manifest into a target GitHub org. Supports multi-platform bulk import. | `repo-manifest.yml` | dispatch | | Resolve CI Failures (Agnostic) [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/resolve-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/resolve-ci.yml) | Agnostic CI failure resolver. Runs resolve-ci.sh for each enabled target in config/ci-check-targets.yml. GitHub targets use LLM analysis and auto-fix; GitLab targets retry failed/canceled pipelines. | `resolve-ci.yml` | dispatch | | Setup Dashboard Variables [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-dashboard-vars.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/setup-dashboard-vars.yml) | Sets all VITE_* repository variables required by the infra-dashboard public-dashboard build. Safe to re-run — blank inputs leave existing variables unchanged. | `setup-dashboard-vars.yml` | dispatch | | Setup GitLab CI Schedules [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-gitlab-schedules.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/setup-gitlab-schedules.yml) | Replaces all existing GitLab pipeline schedules in openos-project/ops/fork-sync-all with the 3 consolidated CADENCE-based schedules. Safe to re-run. | `setup-gitlab-schedules.yml` | dispatch | | Shallow Reclone Large GitLab Mirrors [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/shallow-reclone-chromium.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/shallow-reclone-chromium.yml) | Reduces GitLab storage usage by replacing full git history on large mirror projects with a shallow clone. Run when openos-project approaches its 10 GiB storage limit. | `shallow-reclone-chromium.yml` | dispatch | +| Submodule and Directory Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/submodule-directory-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/submodule-directory-audit.yml) | | `submodule-directory-audit.yml` | push to `.gitmodules`, `config/subtree-manifest.yml`, `scripts/audit-submodule-directory.py` (+2 more) · pull_request · dispatch | | Support Bundle [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/support-bundle.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/support-bundle.yml) | Creates a redacted, checksum-verified diagnostic archive for download or explicit HTTPS delivery. | `support-bundle.yml` | dispatch | | Trigger Artifact Mirror [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/trigger-artifact-mirror.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/trigger-artifact-mirror.yml) | Dispatches mirror-artifacts immediately when a release is published in this repo, so OSP and OOC receive the release without waiting for the next scheduled run. | `trigger-artifact-mirror.yml` | dispatch | | Upload Asset [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upload-asset.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upload-asset.yml) | Uploads files from URLs, artifacts, or repo paths to a release, repo directory, or issue comment. | `upload-asset.yml` | dispatch | @@ -465,6 +468,7 @@ Jump to any section: | Mon 04:30 | Weekly | Manage Repo Settings [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/manage-repo-settings.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/manage-repo-settings.yml) | | 04:30 | Daily | Mirror RPM Repo [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-rpm.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/mirror-rpm.yml) | | at :32 | Every 4h | Notification Poller [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/notify-poller.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/notify-poller.yml) | +| Mon 04:37 | Weekly | Registered Consumer Submodule Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/registered-consumer-inventory.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/registered-consumer-inventory.yml) | | 04:37 | Daily | Upstream PRs from OSP + OOC [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upstream-prs.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upstream-prs.yml) | | 04:47 | Daily | Upstream Direct Commits from OSP + OOC [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upstream-commits.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upstream-commits.yml) | | 04:55 | Daily | Sync Registered Imports [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-registered-imports.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/sync-registered-imports.yml) | diff --git a/README.md b/README.md index 2346646f3..96bd19f55 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # fork-sync-all [![AI agent ready](https://img.shields.io/badge/AI_agent-ready-2ea44f?style=flat-square)](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/DOCS/ai-agent-badges.md) +[![Cohere models](https://img.shields.io/badge/AI_models-Cohere-39594D?style=flat-square)](https://docs.cohere.com/docs/models) [![Open in Codex](https://img.shields.io/badge/Open_in-Codex-000000?style=flat-square&logo=openai&logoColor=white)](https://openai.com/codex/) [![Open in Claude Code](https://img.shields.io/badge/Open_in-Claude_Code-d97757?style=flat-square&logo=anthropic&logoColor=white)](https://claude.ai/code) [![Open in GitHub Copilot](https://img.shields.io/badge/Open_in-GitHub_Copilot-181717?style=flat-square&logo=githubcopilot&logoColor=white)](https://github.com/copilot) @@ -37,12 +38,12 @@ Control plane for the `Interested-Deving-1896` GitHub org. Runs 147 GitHub Actio > See the [Codex Cloud migration guide](DOCS/codex-cloud-migration.md) for the > checked-in installation command, start instructions, and credential handoff. - + | | | |---|---| -| Workflows | **191** | +| Workflows | **194** | | Registered imports | **156** | -| Template consumers | **86** | +| Template consumers | **88** | | GitLab subgroups | **14** | | GitLab repos mirrored | **228** | @@ -121,7 +122,7 @@ This project automates repository management tasks for git-based platforms, addr ## Workflow groups - + 159 workflows across 20 functional groups. Full detail in [DOCS/workflow-triggers.md](DOCS/workflow-triggers.md). | Group | Workflows | Description | @@ -423,7 +424,7 @@ origin(s), as declared in each repo's `## Origins` README section. ## Accessibility -No was found when this README was generated. Check the +No `accessibility-report.json` was found when this README was generated. Check the [Actions tab](https://github.com/Interested-Deving-1896/fork-sync-all/actions) for repository-specific checks, and document an accessibility status only when a report or workflow provides evidence for it. @@ -457,8 +458,8 @@ Direct commits to OSP or OOC are detected and opened as PRs back to `Interested- | Contributor | Commits | |---|---| -| [@Interested-Deving-1896](https://github.com/Interested-Deving-1896) | 1133 | -| [@github-actions[bot]](https://github.com/apps/github-actions) | 275 | +| [@Interested-Deving-1896](https://github.com/Interested-Deving-1896) | 1159 | +| [@github-actions[bot]](https://github.com/apps/github-actions) | 298 | | [@dependabot[bot]](https://github.com/apps/dependabot) | 18 | | [@actions-user](https://github.com/actions-user) | 7 | | [@web-flow](https://github.com/web-flow) | 5 | diff --git a/config/accessibility/integration-contract.json b/config/accessibility/integration-contract.json new file mode 100644 index 000000000..1ae205504 --- /dev/null +++ b/config/accessibility/integration-contract.json @@ -0,0 +1,24 @@ +{ + "$schema":"./integration-contract.schema.json", + "schema_version":"1.0.0", + "mode":"read-only", + "orchestrator":{"workflow_group":"accessibility","workflow":".github/workflows/check-accessibility.yml","policy_owner":"accessibility-workflow","report_format":"fsa-accessibility-evidence/1"}, + "consumers":{ + "rendering":{"issue":1160,"registry":"config/rendering/presentation-targets.json","fixtures":"config/rendering/fixtures.json","owner":"rendering-engine"}, + "capture":{"issue":1174,"owner":"visual-capture-session-evidence","capabilities":["screenshot","recording","live-view","audio"],"defaults":{"screenshot":false,"recording":false,"live_view":false,"audio":false},"live_view_requires":["explicit_consent","authenticated_viewer","visible_indicator","expiry","revocation","audit_event"]} + }, + "actions":[ + {"id":"codeowners-audit","owner":"accessibility-engine","method":"static","enabled":true,"writes_repository":false}, + {"id":"readme-structure","owner":"accessibility-engine","method":"static","enabled":true,"writes_repository":false}, + {"id":"html-wcag-pa11y","owner":"accessibility-engine","method":"rendered-dom","enabled":true,"writes_repository":false}, + {"id":"axe-core","owner":"accessibility-engine","method":"rendered-dom","enabled":true,"writes_repository":false}, + {"id":"audio-overview","owner":"accessibility-derived-artifact","method":"derived-output","enabled":true,"writes_repository":false}, + {"id":"braille-output","owner":"accessibility-derived-artifact","method":"derived-output","enabled":true,"writes_repository":false}, + {"id":"rendering-compatibility","owner":"rendering-engine","method":"target-render","enabled":true,"writes_repository":false}, + {"id":"visual-screenshot","owner":"visual-capture-session-evidence","method":"capture","enabled":false,"writes_repository":false}, + {"id":"visual-recording","owner":"visual-capture-session-evidence","method":"capture","enabled":false,"writes_repository":false}, + {"id":"live-visual-session","owner":"visual-capture-session-evidence","method":"live-session","enabled":false,"writes_repository":false} + ], + "evidence":{"finding_classes":["static","rendered-dom","visual","assistive-technology","human-observation"],"confidence_levels":["measured","observed","heuristic","unknown"],"required_identity":["commit_sha","workflow_run_id","target_profile_id","fixture_id","test_step_id"],"media_policy":{"private_by_default":true,"redaction_required_before_sharing":true,"public_upload":false,"unbounded_recording":false,"baseline_auto_update":false}}, + "status_policy":{"unknown_target_is_not_pass":true,"unsupported_capability_is_skipped_with_reason":true,"automated_scan_does_not_claim_full_wcag_conformance":true} +} \ No newline at end of file diff --git a/config/accessibility/integration-contract.schema.json b/config/accessibility/integration-contract.schema.json new file mode 100644 index 000000000..289823481 --- /dev/null +++ b/config/accessibility/integration-contract.schema.json @@ -0,0 +1,17 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema", + "title":"FSA Accessibility Rendering and Visual Evidence Integration Contract", + "type":"object", + "required":["schema_version","mode","orchestrator","consumers","actions","evidence","status_policy"], + "properties":{ + "$schema":{"type":"string"}, + "schema_version":{"type":"string","pattern":"^[0-9]+\\.[0-9]+\\.[0-9]+$"}, + "mode":{"const":"read-only"}, + "orchestrator":{"type":"object","required":["workflow_group","workflow","policy_owner","report_format"],"properties":{"workflow_group":{"const":"accessibility"},"workflow":{"type":"string"},"policy_owner":{"type":"string"},"report_format":{"type":"string"}},"additionalProperties":false}, + "consumers":{"type":"object"}, + "actions":{"type":"array","items":{"type":"object","required":["id","owner","method","enabled","writes_repository"],"properties":{"id":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]*$"},"owner":{"type":"string"},"method":{"enum":["static","rendered-dom","derived-output","target-render","capture","live-session"]},"enabled":{"type":"boolean"},"writes_repository":{"const":false}},"additionalProperties":false}, + "evidence":{"type":"object"}, + "status_policy":{"type":"object"} + }, + "additionalProperties":false +} \ No newline at end of file diff --git a/config/agent-cost-profiles.yml b/config/agent-cost-profiles.yml index e28fd5cc0..bbb2e5372 100644 --- a/config/agent-cost-profiles.yml +++ b/config/agent-cost-profiles.yml @@ -31,8 +31,8 @@ # LiteLLM source pin — updated weekly by sync-agent-prices.yml # Pinning to a specific commit SHA ensures reproducible price lookups. litellm_pin: - sha: "f91774e2f9e4" - date: "2026-11-02" + sha: "e7603a736a6d" + date: "2026-11-23" url: "https://raw.githubusercontent.com/BerriAI/litellm/{sha}/model_prices_and_context_window.json" agents: @@ -144,7 +144,7 @@ agents: cost_per_1m_out: 15.0 litellm_key: "claude-sonnet-4-6" price_source: litellm - prices_last_verified: "2026-11-02" + prices_last_verified: "2026-11-23" notes: > Direct Anthropic API usage via ANTHROPIC_API_KEY. No OCU cost. Log ocu_estimate as 0; use anthropic_input_tokens + anthropic_output_tokens @@ -163,7 +163,7 @@ agents: cost_per_1m_out: 5.0 litellm_key: "claude-haiku-4-5" price_source: litellm - prices_last_verified: "2026-11-02" + prices_last_verified: "2026-11-23" notes: > Faster, cheaper Claude model for high-volume direct API tasks. Updated from claude-3-5-haiku to claude-haiku-4-5 (current generation). @@ -181,7 +181,7 @@ agents: cost_per_1m_out: 10.0 litellm_key: "gemini/gemini-2.5-pro" price_source: litellm - prices_last_verified: "2026-11-02" + prices_last_verified: "2026-11-23" notes: > Not currently used in fork-sync-all scripts. Included for completeness. Updated to Gemini 2.5 Pro (current generation). 1M token context window diff --git a/config/ai-agent-badges.json b/config/ai-agent-badges.json index 9a51741da..7d02e38c9 100644 --- a/config/ai-agent-badges.json +++ b/config/ai-agent-badges.json @@ -8,6 +8,42 @@ "enabled": true }, "providers": [ + { + "id": "cohere", + "kind": "model-provider", + "label": "Cohere models", + "image_url": "https://img.shields.io/badge/AI_models-Cohere-39594D?style=flat-square", + "launch_url": "https://docs.cohere.com/docs/models", + "enabled": true, + "surfaces": [ + "api", + "model-vault" + ], + "mobile_mode": "not-applicable", + "docs_url": "https://docs.cohere.com/docs/models", + "synopsis": "Model provider for tool use, retrieval-augmented generation, embeddings, reranking, multilingual generation, and agentic coding models.", + "model_families": [ + "Command", + "North", + "Embed", + "Rerank", + "Aya", + "Parse", + "Transcribe" + ], + "strengths": [ + "tool-use", + "retrieval-augmented-generation", + "embeddings", + "reranking", + "multilingual", + "agentic-coding" + ], + "evidence_level": "documented", + "evidence_url": "https://docs.cohere.com/docs/models", + "last_verified": "2026-11-26", + "caveat": "Provider badge only; does not claim that every FSA agent or account can access every Cohere model." + }, { "id": "codex", "label": "Open in Codex", diff --git a/config/fleet-engine.json b/config/fleet-engine.json new file mode 100644 index 000000000..876d902f3 --- /dev/null +++ b/config/fleet-engine.json @@ -0,0 +1,70 @@ +{ + "schema_version": 1, + "mode": "audit-only", + "providers": ["github", "gitlab", "gitea", "forgejo", "codeberg", "generic"], + "sources": [ + { + "id": "template-consumers", + "kind": "template-consumers", + "path": "config/template-consumers.yml", + "meaning": "Declares template membership and sync-template tier/profile behavior; does not independently establish README ownership or write permission.", + "platform": "github", + "authoritative_for": ["template-membership"] + }, + { + "id": "registered-imports", + "kind": "import-registry", + "path": "registered-imports.json", + "meaning": "Declares upstream import provenance and target names; destination namespace must be independently resolved.", + "authoritative_for": ["import-provenance"] + }, + { + "id": "live-chain-manifest", + "kind": "mirror-manifest", + "path": "config/live-chain-manifest.json", + "meaning": "Declares mirror-chain membership and README audit policy, not permission to write repository content.", + "platform": "github", + "authoritative_for": ["mirror-role"] + }, + { + "id": "readme-subsystem", + "kind": "readme-subsystem", + "path": "config/readme-subsystem.json", + "meaning": "Declares profile subsystem project roles and artifact ownership/direction.", + "platform": "github", + "authoritative_for": ["readme-ownership", "artifact-ownership"] + }, + { + "id": "gitlab-subgroups", + "kind": "platform-placement", + "path": "config/gitlab-subgroups.yml", + "meaning": "Declares GitLab subgroup placement; unlisted projects fall back to ops. Placement is not ownership or write authority.", + "platform": "gitlab", + "authoritative_for": ["placement"] + }, + { + "id": "runtime-workflow-targets", + "kind": "workflow-discovery", + "path": "runtime-discovery", + "meaning": "Runtime-derived targets are discovered separately and marked dynamic until their identity and permissions are verified.", + "authoritative_for": ["identity"] + } + ], + "policy": { + "default_disposition": "unresolved", + "default_write_authority": "none", + "registry_membership_grants_write": false, + "unknown_operation": "deny", + "protected_or_conflicted_write": "deny", + "required_evidence_for_mutation": [ + "resolved_identity", + "resolved_owner", + "explicit_operation_permission", + "reviewable_plan", + "approval", + "precondition_check", + "postcondition_check" + ] + }, + "repositories": [] +} diff --git a/config/readme-subsystem.json b/config/readme-subsystem.json index 402063789..d995beaf1 100644 --- a/config/readme-subsystem.json +++ b/config/readme-subsystem.json @@ -205,6 +205,17 @@ "path": "README.md" } ] + }, + { + "id": "external-services-engine", + "owner": "fork-sync-all", + "source": "scripts/external_services.py", + "destinations": [ + { + "project": "interested-deving-1896", + "path": "scripts/external_services.py" + } + ] } ] } diff --git a/config/readme-subsystem.lock.json b/config/readme-subsystem.lock.json index eb4407bc4..e75e71cf9 100644 --- a/config/readme-subsystem.lock.json +++ b/config/readme-subsystem.lock.json @@ -1,9 +1,14 @@ { "artifacts": [ + { + "id": "external-services-engine", + "path": "scripts/external_services.py", + "sha256": "e490efab3715fb77cc0562b69a11ff0998212bf87317b83b9a180cd23fc61418" + }, { "id": "markdown-link-engine", "path": "scripts/check-markdown-links.py", - "sha256": "1d13c3e461c949e1fccd278b07fcb9caf247e2b619f1a6dbfc7130316686c361" + "sha256": "6ae58c58eeaf56603058c26f9f5a3fbd23d68a46aeed0aea1c302a201da0a11c" }, { "id": "readme-policy-engine", @@ -23,7 +28,7 @@ { "id": "subsystem-contract", "path": "config/readme-subsystem.json", - "sha256": "01e72e5e147879ecdff38a0a73ae9ff9e0876896e3ea266f8983ee89fbb72194" + "sha256": "db6550a1c53a33766cdcfa81c5df404f8b9d0a325ffddc4e7103492206f9aacf" }, { "id": "subsystem-documentation", @@ -52,7 +57,7 @@ } ], "canonical_project": "fork-sync-all", - "contract_sha256": "01e72e5e147879ecdff38a0a73ae9ff9e0876896e3ea266f8983ee89fbb72194", + "contract_sha256": "db6550a1c53a33766cdcfa81c5df404f8b9d0a325ffddc4e7103492206f9aacf", "schema_version": 1, "source_revision": "readme-subsystem-v1.1.0", "subsystem_version": "1.1.0" diff --git a/config/rendering/fixtures.json b/config/rendering/fixtures.json new file mode 100644 index 000000000..fbb28c8d5 --- /dev/null +++ b/config/rendering/fixtures.json @@ -0,0 +1,23 @@ +{ + "schema_version":"1.0.0", + "fixtures":[ + {"id":"markdown-basic","kind":"markdown","description":"Headings, paragraphs, emphasis and lists","evidence_class":"static-fixture"}, + {"id":"gfm-table-narrow","kind":"table","description":"Three-column GFM table","evidence_class":"static-fixture"}, + {"id":"gfm-table-wide","kind":"table","description":"Six-column GFM table for viewport inspection","evidence_class":"static-fixture"}, + {"id":"image-markdown-lowercase","kind":"image","description":"Markdown image with lowercase extension and alt text","evidence_class":"static-fixture"}, + {"id":"image-markdown-uppercase","kind":"image","description":"Uppercase image extension; no platform failure assumed","evidence_class":"static-fixture"}, + {"id":"image-url-encoded-space","kind":"image","description":"Image URL with percent-encoded space","evidence_class":"static-fixture"}, + {"id":"image-url-unencoded-space","kind":"image","description":"Image URL with unencoded space","evidence_class":"static-fixture"}, + {"id":"html-details-nested","kind":"html","description":"Nested details and summary blocks","evidence_class":"static-fixture"}, + {"id":"html-inline-semantic","kind":"html","description":"kbd, sub and sup elements outside tables","evidence_class":"static-fixture"}, + {"id":"html-semantic-in-table","kind":"html","description":"kbd, sub and sup elements inside table cells","evidence_class":"static-fixture"}, + {"id":"html-div-layout","kind":"html","description":"Div wrapper with ordinary text","evidence_class":"static-fixture"}, + {"id":"svg-image","kind":"image","description":"SVG image reference; host and content type require testing","evidence_class":"static-fixture"}, + {"id":"badge-link","kind":"badge","description":"Linked status badge image","evidence_class":"static-fixture"}, + {"id":"relative-anchor-link","kind":"link","description":"Relative repository link and heading anchor","evidence_class":"static-fixture"}, + {"id":"unicode-long-line","kind":"text","description":"Unicode and long unbroken text for responsive inspection","evidence_class":"static-fixture"}, + {"id":"accessibility-alt-heading","kind":"accessibility","description":"Image alt text, heading hierarchy and descriptive links","evidence_class":"static-fixture"}, + {"id":"raw-html-sanitization","kind":"html","description":"Allowlisted and non-allowlisted HTML comparison","evidence_class":"static-fixture"}, + {"id":"code-fence-markdown","kind":"code","description":"Markdown-looking content inside fenced code blocks","evidence_class":"static-fixture"} + ] +} diff --git a/config/rendering/presentation-target.schema.json b/config/rendering/presentation-target.schema.json new file mode 100644 index 000000000..ac1802c96 --- /dev/null +++ b/config/rendering/presentation-target.schema.json @@ -0,0 +1,28 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema", + "title":"FSA Git Platform Presentation Target Registry", + "type":"object", + "required":["schema_version","targets"], + "properties":{ + "schema_version":{"type":"string","pattern":"^[0-9]+\\.[0-9]+\\.[0-9]+$"}, + "targets":{"type":"array","items":{ + "type":"object", + "required":["id","provider","surface","client","status","features","evidence"], + "properties":{ + "id":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]*$"}, + "provider":{"enum":["github","gitlab","gitea","forgejo","codeberg","other"]}, + "instance":{"type":["string","null"],"format":"uri"}, + "surface":{"enum":["repository-readme","issue","pull-request","wiki","pages","release-notes"]}, + "client":{"enum":["web","mobile-web","android","ios"]}, + "tested_version":{"type":["string","null"]}, + "status":{"enum":["verified","partially-verified","unsupported","unknown","stale"]}, + "renderer":{"type":["string","null"]}, + "features":{"type":"object","additionalProperties":{"enum":["supported","partial","unsupported","unknown"]}}, + "evidence":{"type":"array","items":{"type":"string"}}, + "notes":{"type":"string"} + }, + "additionalProperties":false + }} + }, + "additionalProperties":false +} diff --git a/config/rendering/presentation-targets.json b/config/rendering/presentation-targets.json new file mode 100644 index 000000000..4c9bac5c8 --- /dev/null +++ b/config/rendering/presentation-targets.json @@ -0,0 +1,10 @@ +{ + "$schema": "./presentation-target.schema.json", + "schema_version": "1.0.0", + "targets": [ + {"id":"github-com-readme-web","provider":"github","instance":"https://github.com","surface":"repository-readme","client":"web","tested_version":null,"status":"unknown","renderer":"GitHub Markdown (version not exposed)","features":{"gfm_tables":"unknown","alerts":"unknown","details_summary":"unknown","raw_html_sanitization":"unknown","svg_images":"unknown","relative_links":"unknown"},"evidence":[],"notes":"Baseline target declaration only; populate verified behavior from reproducible observations."}, + {"id":"github-com-readme-android","provider":"github","instance":"https://github.com","surface":"repository-readme","client":"android","tested_version":null,"status":"unknown","renderer":"GitHub for Android (version not recorded)","features":{"gfm_tables":"unknown","alerts":"unknown","details_summary":"unknown","raw_html_sanitization":"unknown","svg_images":"unknown","relative_links":"unknown"},"evidence":[],"notes":"Do not infer native-app rendering behavior from GitHub web behavior or static source assertions."}, + {"id":"gitlab-com-readme-web","provider":"gitlab","instance":"https://gitlab.com","surface":"repository-readme","client":"web","tested_version":null,"status":"unknown","renderer":"GitLab Markdown (version not recorded)","features":{"gfm_tables":"unknown","alerts":"unknown","details_summary":"unknown","raw_html_sanitization":"unknown","svg_images":"unknown","relative_links":"unknown"},"evidence":[],"notes":"Provider-specific semantics must be measured; do not assume GitHub parity."}, + {"id":"forgejo-readme-web","provider":"forgejo","instance":null,"surface":"repository-readme","client":"web","tested_version":null,"status":"unknown","renderer":"Forgejo instance renderer (version not recorded)","features":{"gfm_tables":"unknown","alerts":"unknown","details_summary":"unknown","raw_html_sanitization":"unknown","svg_images":"unknown","relative_links":"unknown"},"evidence":[],"notes":"Instance URL and exact version are required before a result can be marked verified."} + ] +} diff --git a/config/workflow-quota-costs.yml b/config/workflow-quota-costs.yml index 43395ce3d..31aa3ac1b 100644 --- a/config/workflow-quota-costs.yml +++ b/config/workflow-quota-costs.yml @@ -272,7 +272,7 @@ workflows: min_quota: 1500 cost_low: 0 cost_mid: 0 - cost_high: 32 + cost_high: 16 basis: observed notes: 'Matrix over ci-check-targets.yml (5 targets: 3 GitHub, 2 GitLab). GitHub targets: 1 GraphQL prefetch + 2 REST calls per repo (check-runs, statuses). GitLab @@ -280,8 +280,8 @@ workflows: 5 targets run against ~225 repos each. ' synopsis: Agnostic CI status checker. Runs check-ci.sh for each enabled target in config/ci-check-targets.yml (GitHub orgs and GitLab groups). - samples: 125 - updated_at: '2026-11-02T17:47:34Z' + samples: 121 + updated_at: '2026-11-23T19:49:49Z' - name: Check GitLab CI Sync min_quota: 50 cost_low: 2 @@ -329,16 +329,16 @@ workflows: synopsis: Runs CI checks on push and pull request events. - name: Cleanup Stale Branches min_quota: 200 - cost_low: 90 - cost_mid: 98 - cost_high: 315 + cost_low: 107 + cost_mid: 130 + cost_high: 513 basis: observed notes: '1 GraphQL for repo list + default branch + branch names. Per-branch: 1 REST compare call (unavoidable — write decision). High end: many repos with many branches. ' synopsis: Deletes branches that have been merged into the default branch across all repos in Interested-Deving-1896, OSP, and OOC. - samples: 28 - updated_at: '2026-11-02T17:47:34Z' + samples: 29 + updated_at: '2026-11-23T19:49:49Z' - name: Cleanup Template Pollution min_quota: 200 cost_low: 20 @@ -707,16 +707,16 @@ workflows: and registers for ongoing sync. - name: Inject AI Agent Badges min_quota: 1500 - cost_low: 90 - cost_mid: 532 - cost_high: 1769 + cost_low: 108 + cost_mid: 552 + cost_high: 1507 basis: observed notes: '1 GraphQL for repo list + README content (converted from REST). Per-repo: 1 REST PUT only when badge is missing. Low end: most repos already have badge. ' synopsis: Adds provider-neutral AI-agent badges to managed README files that are missing it. Skips repos that already have the badge. - samples: 24 - updated_at: '2026-11-02T17:47:34Z' + samples: 23 + updated_at: '2026-11-23T19:49:49Z' - name: Inject Repo Motto workflow_file: inject-motto.yml min_quota: 200 @@ -845,7 +845,7 @@ workflows: min_quota: 500 cost_low: 1 cost_mid: 1 - cost_high: 1 + cost_high: 2 basis: observed notes: '1 GraphQL for OSP repo list + 1 GraphQL for upstream metadata. Per-repo: 1 REST check-runs call (only for repos passing PR gate). High end assumes all @@ -853,7 +853,7 @@ workflows: synopsis: Bare-clones every repo in Interested-Deving-1896 and git push --mirror into OpenOS-Project-OSP, syncing all branches, tags, and refs exactly. samples: 30 - updated_at: '2026-11-02T17:47:34Z' + updated_at: '2026-11-23T19:49:49Z' - name: Mirror Orgs min_quota: 250 cost_low: 20 @@ -1257,16 +1257,16 @@ workflows: DOCS/cover.md. - name: Reconcile Org References min_quota: 300 - cost_low: 114 - cost_mid: 181 - cost_high: 2771 + cost_low: 120 + cost_mid: 393 + cost_high: 2731 basis: observed notes: '1 GraphQL for OSP repo list (converted from REST). Per-repo: pushedAt from prefetch cache (0 REST). File reads/writes only for repos pushed since last run. ' synopsis: Rewrites org/repo references in OSP and OOC mirrors to point at the correct org, fixing stale Interested-Deving-1896 references left by the mirror process. - samples: 21 - updated_at: '2026-11-02T17:47:34Z' + samples: 23 + updated_at: '2026-11-23T19:49:49Z' - name: Refresh NotebookLM Auth min_quota: 10 cost_low: 1 @@ -1397,7 +1397,7 @@ workflows: min_quota: 1500 cost_low: 0 cost_mid: 0 - cost_high: 222 + cost_high: 250 basis: observed notes: '1 GraphQL for fork list. Per-fork: 1 REST merge-upstream call. With ~200+ forks, high end approaches 500 calls. Quota check every 50 repos provides early @@ -1406,7 +1406,7 @@ workflows: their upstream via the GitHub merge-upstream API, falling back to force-reset on divergence. samples: 29 - updated_at: '2026-11-02T17:47:34Z' + updated_at: '2026-11-23T19:49:49Z' - name: Sync btrfs-devel Branches min_quota: 1000 cost_low: 5 @@ -1503,16 +1503,16 @@ workflows: - name: Sync Registered Imports min_quota: 1000 cost_low: 0 - cost_mid: 4 - cost_high: 1150 + cost_mid: 5 + cost_high: 707 basis: observed notes: '1 GraphQL prefetch for all ~50 target repos (existence + pushedAt). Per-repo: 0 REST calls if recently synced (idempotency gate). Only creates repos via REST when target doesn''t exist yet. ' synopsis: Re-syncs all repos listed in registered-imports.json — bare-clones each source URL and pushes all branches and tags to Interested-Deving-1896. - samples: 21 - updated_at: '2026-11-02T17:47:34Z' + samples: 24 + updated_at: '2026-11-23T19:49:49Z' - name: Sync Registry Backend min_quota: 100 cost_low: 10 diff --git a/config/workflow-sync.yml b/config/workflow-sync.yml index 1ab2f3f39..608992298 100644 --- a/config/workflow-sync.yml +++ b/config/workflow-sync.yml @@ -668,6 +668,9 @@ github_only: - workflow_file: bdfs-dev-overlay.yml reason: bdfs overlay backend — local runner tool, no GitLab equivalent + - workflow_file: registered-consumer-inventory.yml + reason: Read-only remote submodule/gitlink inventory across registered consumers; GitHub API GET only, no GitLab writer counterpart + gitlab_only: - job: secret-scan reason: Scans for secrets in GitLab repo — GitLab-native security stage diff --git a/docs/declared-source-scope-inventory.md b/docs/declared-source-scope-inventory.md new file mode 100644 index 000000000..728d711a2 --- /dev/null +++ b/docs/declared-source-scope-inventory.md @@ -0,0 +1,31 @@ +# Declared repository source-scope inventory + +`scripts/build-declared-source-scope.py` builds a deterministic, offline union of repository identities declared by the current FSA registries: + +- `registered-imports.json`: upstream source repositories and their FSA sync targets; +- `config/template-consumers.yml`: template consumers and their tier/profile metadata; +- `config/live-chain-manifest.json`: source projects and declared OSP/OOC mirror counterparts; +- `.gitmodules`: submodule source URLs and paths; +- `config/subtree-manifest.yml`: submodule, subtree, and enabled umbrella declarations; +- `config/shell-tools-registry.yml`: vendored shell-tool upstreams; +- `config/gitlab-mirror-sources.yml` and its referenced subgroup registries: explicitly mapped GitLab mirror targets. + +The output deduplicates identities by platform and canonical repository path while preserving every declaration and relationship. Each input is SHA-256 fingerprinted so reports can be tied to the exact registry contents. + +## Run + +```sh +python3 -m pip install PyYAML +python3 scripts/build-declared-source-scope.py \ + --json-out declared-source-scope.json \ + --markdown-out declared-source-scope.md +python3 -m unittest discover -s tests -p "test_declared_source_scope.py" -v +``` + +## Evidence semantics and safety + +This phase performs no network access. It does not establish that a declared repository exists, is accessible, is owned by the declaring project, or contains the expected source. It does not fetch trees or contents, initialize submodules, execute source, change pins or directories, dispatch workflows, write repositories, publish artifacts, or propagate mirrors. + +A declaration is not authorization. Mirror counterparts and sync targets are relationship records only. Non-GitHub namespaces remain visible for a future provider-specific read-only adapter; they are not silently discarded or called clean. Immutable revision, provenance, license, ownership, and remote availability remain unknown until a separate read-only evidence phase establishes them. + +The workflow uploads the generated JSON and Markdown as a short-lived artifact. It uses `contents: read` and has no mutation permissions. diff --git a/docs/external-services-engine.md b/docs/external-services-engine.md new file mode 100644 index 000000000..f80572468 --- /dev/null +++ b/docs/external-services-engine.md @@ -0,0 +1,31 @@ +# External Services Engine + +Fork-Sync-All uses a shared result vocabulary so automated requests are not +mistaken for definitive statements about remote destinations. + +| Classification | Meaning | Default audit treatment | +|---|---|---| +| `reachable` | Successful response or valid redirect | Pass | +| `not_found` | HTTP 404 or 410 | Blocking failure | +| `blocked_or_restricted` | HTTP 401, 403, or 407 | Visible, inconclusive | +| `rate_limited` | HTTP 429 | Visible, inconclusive | +| `transient_failure` | Retryable server or transport failure | Bounded retries, then failure | +| `invalid_destination` | Malformed URL or unsupported scheme | URL validation | +| `indeterminate` | Response does not establish destination validity | Visible, inconclusive | + +A blocked or rate-limited response describes the request, not necessarily the +destination. It remains visible in reports and is not silently converted into +a successful reachability assertion. Confirmed 404/410 responses remain +blocking failures. + +## Initial implementation + +The first recovery slice provides shared HTTP/transport classification, +`Retry-After` parsing for delta-seconds and HTTP dates, and integration with +the Markdown link checker. This is not yet the complete adaptive engine. + +Per-host concurrency and budgets, cache/TTL, circuit breakers, safe +HEAD-to-GET fallback, redirect/SSRF validation, bounded response handling, +and runtime/live revalidation remain follow-up work. No mode may bypass +authentication, CAPTCHA, bot protection, access controls, or provider terms. +Host-specific overrides must be narrow, justified, reviewable, and time-limited. diff --git a/docs/registered-consumer-submodule-inventory.md b/docs/registered-consumer-submodule-inventory.md new file mode 100644 index 000000000..cb846c3d3 --- /dev/null +++ b/docs/registered-consumer-submodule-inventory.md @@ -0,0 +1,76 @@ +# Registered consumer submodule and directory inventory + +The scripts/audit-registered-consumers.py tool extends the local inventory with +a read-only scan of GitHub repositories listed in config/template-consumers.yml. + +## Run locally + +Install PyYAML and provide a GitHub token with read-only repository contents +access for private repositories in the registry: + + python3 -m pip install PyYAML + export GITHUB_TOKEN=... + python3 scripts/audit-registered-consumers.py \ + --registry config/template-consumers.yml \ + --json-out inventory.json \ + --markdown-out inventory.md + +Unqualified repository names resolve under Interested-Deving-1896. +Explicit owner/repository entries preserve their owner. Disabled entries +remain visible in the report but are not queried. The scanner reads each +repository's actual default branch, records the branch commit and tree SHA, +then inventories mode-160000 gitlinks and the .gitmodules blob. + +## Evidence and status + +Each successful record includes the default branch, immutable HEAD commit SHA, +tree SHA, gitlink paths and target commit SHAs, and .gitmodules presence and +content. not_found_or_inaccessible intentionally does not claim a repository +is absent: GitHub can return 404 for resources the token cannot access. +forbidden_or_rate_limited, unavailable, api_error, and partial remain separate +outcomes. A truncated tree is not accepted as complete evidence. + +The JSON report includes coverage counts and preserves registry metadata such +as tier, profile, disabled, and delegated_to. Registry membership is discovery +metadata only; it does not establish ownership, provenance, or authorization. + +## Safety + +The scanner uses GitHub GET requests only. It never clones repositories, +initializes or fetches submodules, executes source content, changes directories, +updates pins, or writes to any scanned repository. The workflow has +contents: read permissions and runs weekly plus on relevant changes. +It uploads JSON and Markdown evidence as a workflow artifact. + + +## Tracked directory evidence + +The remote scan also derives directory paths from the immutable recursive Git +tree returned for each repository's default-branch commit. It records tracked +entry, blob, and gitlink counts per directory and applies coarse path-only +classifications such as documentation, tests, configuration, generated/cache +candidate, vendored/imported candidate, and source candidate. + +These labels are **heuristics only**. They do not inspect or execute file +contents and do not establish ownership, provenance, license, source identity, +or whether a directory is safe to synchronize. Ownership remains +`unassigned`, provenance remains `unknown`, and unclassified paths remain +visible. Content-level and manifest reconciliation is a later review phase. + + +## Remote manifest reconciliation + +When a consumer's immutable recursive tree contains +`config/subtree-manifest.yml`, the scanner fetches that blob through the +GitHub Git Data API (GET only) and compares its declared submodule paths with +`.gitmodules` paths and mode-160000 gitlink paths. Enabled umbrella children +are evaluated under the declared umbrella prefix. Declared subtree prefixes +are checked against tracked directory paths. + +The JSON record preserves the manifest blob SHA, parse/fetch errors, declared +counts, and explicit path-level findings. Divergence is a warning; inaccessible +or malformed manifest evidence remains partial. Absence of the manifest is +reported as absence, not as a clean reconciliation. URL/name similarity is +not treated as proof of source identity, and subtree paths are not content- +or history-verified. This stage produces evidence only: it does not repair, +initialize, fetch, move, pin, execute, or write anything. diff --git a/docs/submodule-directory-inventory.md b/docs/submodule-directory-inventory.md new file mode 100644 index 000000000..dab092848 --- /dev/null +++ b/docs/submodule-directory-inventory.md @@ -0,0 +1,50 @@ +# Submodule and directory inventory + +The read-only inventory tool extends the existing `config/subtree-manifest.yml` +control plane. It does not create a second dependency registry. + +## Run locally + +```sh +python3 -m pip install PyYAML +python3 scripts/audit-submodule-directory.py --repo-root . +``` + +Optional report files: + +```sh +python3 scripts/audit-submodule-directory.py \ + --repo-root . \ + --json-out inventory.json \ + --markdown-out inventory.md +``` + +## Reconciliation + +The tool compares three sources of submodule state: + +1. `config/subtree-manifest.yml` declarations; +2. `.gitmodules` path and URL declarations; +3. mode-`160000` gitlink entries in the checked-out `HEAD` tree. + +It also reports declared subtree prefixes and classifies tracked directories +using conservative path heuristics. Directory ownership is deliberately +reported as `unassigned` until an explicit ownership contract is adopted; +classification is not proof of ownership or provenance. + +## Status semantics + +- `clean`: all inspected sources reconcile. +- `warning`: non-blocking metadata drift, such as a .gitmodules declaration + not represented in the manifest. +- `blocked`: conflicting declarations, missing gitlinks, orphan gitlinks, + duplicate paths, or managed-path collisions. +- `partial`: Git or manifest evidence could not be read completely. + +A partial inventory is never treated as clean. The tool is offline and +read-only: it does not initialize submodules, fetch upstreams, run source code, +move directories, update pins, dispatch workflows, or change files. + +The existing `scripts/manage-subtrees.sh` and +`.github/workflows/manage-subtrees.yml` remain separate mutation mechanisms. +This validator does not authorize or invoke them. diff --git a/docs/submodule-repair-plans.md b/docs/submodule-repair-plans.md new file mode 100644 index 000000000..96f4bc03b --- /dev/null +++ b/docs/submodule-repair-plans.md @@ -0,0 +1,50 @@ +# Deterministic submodule repair review plans + +`scripts/plan-submodule-repairs.py` consumes the JSON artifact produced by +`scripts/audit-registered-consumers.py`. It performs no network calls and +does not clone, initialize, or fetch source repositories. + +## Run + +```sh +python3 scripts/plan-submodule-repairs.py \ + --inventory registered-consumer-inventory.json \ + --json-out submodule-repair-plan.json \ + --markdown-out submodule-repair-plan.md +``` + +The generator compares committed `.gitmodules` declarations with mode-160000 +gitlinks. It reports declaration-without-gitlink and gitlink-without-declaration +as human-review suggestions. Inaccessible, incomplete, malformed, truncated, +or unsafe evidence is blocked rather than called clean. + +## Evidence binding and determinism + +Each repository record is bound to the exact inventory HEAD and tree SHA, +`.gitmodules` blob SHA, and observed gitlink paths/commit SHAs. The plan ID is +a SHA-256 digest over canonicalized source identity and generated suggestions; +generation time is not part of the digest. Re-running against identical evidence +therefore produces the same plan ID. + +A gitlink does not encode its remote URL. The generator does not infer source +identity, desired pins, ownership, licenses, or whether a stale declaration +should be removed or a gitlink restored. It does not automatically classify +directories or resolve URL mismatches. + +## Safety boundary + +This is a review aid, not an executable mutation plan. Every suggestion has +`review_action: human_review_required` and `proposed_mutation: null`. +No authorization is granted. No repository writes, network access, source +execution, submodule initialization/fetch, pin changes, directory changes, +workflow dispatch, or mirror propagation occur. + +Any future mutation adapter must revalidate the expected HEAD, tree, +`.gitmodules` blob and gitlink state, then pass through the shared +discover → plan → authorize → execute → verify → reconcile lifecycle. +Manual subtree writer-safety remediation remains a separate prerequisite. + + +## Legacy subtree writer status + +The legacy `Manage Subtrees` workflow and `scripts/manage-subtrees.sh` are intentionally fail-closed. Only read-only `status` is enabled. All mutation commands are rejected until a separate reviewed implementation provides exact path allowlists, least-privilege credentials and permissions, immutable authorization-plan binding, expected-old-state checks, and post-write verification. Do not manually dispatch legacy mutation commands or restore write permissions as a workaround. diff --git a/docs/workflow-triggers.md b/docs/workflow-triggers.md index d18a65c5a..8d30b467e 100644 --- a/docs/workflow-triggers.md +++ b/docs/workflow-triggers.md @@ -4,7 +4,7 @@ All workflows in `.github/workflows/`. Grouped by function, with every trigger l > Plain-text version: [`DOCS/workflow-triggers.txt`](workflow-triggers.txt) > Published: [interested-deving-1896.github.io/fork-sync-all/workflow-triggers.html](https://interested-deving-1896.github.io/fork-sync-all/workflow-triggers.html) -> Auto-generated on 2026-11-03 from `.github/workflows/` and `config/workflow-quota-costs.yml` +> Auto-generated on 2026-11-26 from `.github/workflows/` and `config/workflow-quota-costs.yml` --- @@ -34,7 +34,7 @@ Jump to any section: | [Quota & Queue Management](#quota--queue-management) | 5 | | [README Management](#readme-management) | 10 | | [Security & Compliance](#security--compliance) | 6 | -| [Utility / On-Demand](#utility--on-demand) | 30 | +| [Utility / On-Demand](#utility--on-demand) | 33 | **Quick links:** [Glossary](#glossary) · [Schedule Summary](#schedule-summary-utc) · [Source](https://github.com/Interested-Deving-1896/fork-sync-all/tree/main/.github/workflows) @@ -212,7 +212,7 @@ Jump to any section: |---|---|---|---|---| | Reconcile Identity Assets [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-identity-assets.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/reconcile-identity-assets.yml) | Detects the current FSA instance, selects the matching brand variant, writes active assets to assets/brand/.active/, and injects identity content into DOCS/cover.md. | `reconcile-identity-assets.yml` | — | push to `assets/brand/**`, `config/identity-assets.yml`, `DOCS/cover.md` · dispatch | | Cleanup Stale Branches [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-branches.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/cleanup-branches.yml) | Deletes branches that have been merged into the default branch across all repos in Interested-Deving-1896, OSP, and OOC. | `cleanup-branches.yml` | Monthly 1st 04:29 | `Sync All Forks` completes · dispatch | -| Validate Config [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-config.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-config.yml) | Validates all config files (gitlab-subgroups.yml, workflow-sync.yml, priority-tiers.yml, registered-imports.json) on every push that touches them. Blocks merges on invalid config. | `validate-config.yml` | — | push to `config/gitlab-subgroups.yml`, `config/live-chain-manifest.json`, `config/flush-stage-contracts.yml` (+30 more) · pull_request · dispatch | +| Validate Config [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-config.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-config.yml) | Validates all config files (gitlab-subgroups.yml, workflow-sync.yml, priority-tiers.yml, registered-imports.json) on every push that touches them. Blocks merges on invalid config. | `validate-config.yml` | — | push to `config/gitlab-subgroups.yml`, `config/live-chain-manifest.json`, `config/flush-stage-contracts.yml` (+31 more) · pull_request · dispatch | | Reconcile Org References [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/reconcile-org-refs.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/reconcile-org-refs.yml) | Rewrites org/repo references in OSP and OOC mirrors to point at the correct org, fixing stale Interested-Deving-1896 references left by the mirror process. | `reconcile-org-refs.yml` | 50 5 */2 * * | dispatch | | Cleanup Template Pollution [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/cleanup-pollution.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/cleanup-pollution.yml) | Removes files incorrectly propagated from fork-sync-all to consumer repos via the template sync pipeline, across all three GitHub orgs and GitLab. | `cleanup-pollution.yml` | — | `Sync Template` completes · dispatch | | Sync Template [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-template.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/sync-template.yml) | Syncs fork-sync-all's file tree into target repos. Three modes — create (new repo + mirror chain), inject (copy into existing repo), propagate (push-triggered sync to all consumers in template-consumers.yml). | `sync-template.yml` | — | push to `.devcontainer/**`, `.ona/**`, `config/readme-subsystem*.json` (+8 more) · dispatch | @@ -309,7 +309,7 @@ Jump to any section: |---|---|---|---|---| | Create Missing READMEs [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/create-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/create-readmes.yml) | Creates README.md from the standard template for OSP-bound repos that have no README, with placeholder sections for human-owned content. | `create-readmes.yml` | Daily 15:08 | dispatch | | Update READMEs [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/update-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/update-readmes.yml) | Regenerates AI-owned sections (what-it-does, architecture, ci, mirror-chain, etc.) in README.md for all OSP-bound repos, preserving human-owned sections. | `update-readmes.yml` | Daily 02:50 | push to `config/gitlab-subgroups.yml`, `config/template-manifest.yml` · `Sync Registered Imports` completes · dispatch | -| Validate README Render [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-readme-render.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-readme-render.yml) | Checks README.md for rendering issues — leaked log lines, unclosed fences, bare brackets, raw angle brackets, unclosed AI markers, missing H1, and empty sections. | `validate-readme-render.yml` | — | push to `README.md` · dispatch | +| Validate README Render [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/validate-readme-render.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/validate-readme-render.yml) | Checks README.md for rendering issues — leaked log lines, unclosed fences, bare brackets, raw angle brackets, unclosed AI markers, missing H1, and empty sections. | `validate-readme-render.yml` | — | push to `README.md`, `config/rendering/**`, `scripts/validate-rendering-profiles.py` (+1 more) · pull_request · dispatch | | Inject AI Agent Badges [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-badges.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/inject-badges.yml) | Adds provider-neutral AI-agent badges to managed README files that are missing it. Skips repos that already have the badge. | `inject-badges.yml` | 15 8 */2 * * | dispatch | | LTS README Standardisation [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/lts-readmes.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/lts-readmes.yml) | Standardises README.md structure for LTS-tagged repos, ensuring they follow the LTS template with correct version badges and support tables. | `lts-readmes.yml` | Monthly 1st 03:19 | dispatch | | Inject Repo Motto [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/inject-motto.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/inject-motto.yml) | Injects repo motto/slogan into README.md files across all orgs. | `inject-motto.yml` | 30 8 */2 * * | dispatch | @@ -346,23 +346,26 @@ Jump to any section: | CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/ci.yaml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/ci.yaml) | Runs CI checks on push and pull request events. | `ci.yaml` | push to `tests/run-tests.sh`, `profiles/**`, `.github/workflows/ci.yaml` · pull_request | | Clear All Notifications [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/clear-notifications.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/clear-notifications.yml) | Safely marks repository-scoped or explicitly confirmed global GitHub notifications as read. | `clear-notifications.yml` | dispatch | | Clone Org [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/clone-org.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/clone-org.yml) | Clones all repositories from an org or user on any supported platform (GitHub, GitLab, Bitbucket, Gitea) into Interested-Deving-1896. | `clone-org.yml` | dispatch | +| Declared Source Scope Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/declared-source-scope.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/declared-source-scope.yml) | | `declared-source-scope.yml` | push to `registered-imports.json`, `.gitmodules`, `config/template-consumers.yml` (+7 more) · pull_request · dispatch | | Dependency Risk Audit [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/dependency-risk-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/dependency-risk-audit.yml) | Produces a severity-prioritized dependency vulnerability backlog and blocks on non-exempt critical alerts. | `dependency-risk-audit.yml` | push to `config/dependency-risk-policy.json`, `scripts/audit-dependency-risk.py`, `.github/workflows/dependency-risk-audit.yml` · dispatch | | Forge README Parity [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/forge-readme-parity.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/forge-readme-parity.yml) | Compares README content across enabled GitHub and GitLab surfaces and checks profile Markdown links. | `forge-readme-parity.yml` | push to `config/fsa-deployments.yml`, `config/mirror-readme-baseline.json`, `scripts/audit-forge-readme-parity.py` (+4 more) · dispatch | | Fork KDE Neon Repos [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/fork-neon-repos.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/fork-neon-repos.yml) | One-shot workflow that clones the 6 KDE Invent neon repos into Interested-Deving-1896 and pushes them through the OSP mirror chain. Ongoing re-sync handled by sync-registered-imports. | `fork-neon-repos.yml` | dispatch | | GitLab Storage Scan [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/gl-storage-scan.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/gl-storage-scan.yml) | Scans all projects under openos-project on GitLab and reports storage usage. Useful for diagnosing when the namespace approaches its 10 GiB limit. | `gl-storage-scan.yml` | dispatch | -| HW Detect CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/hw-detect-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/hw-detect-ci.yml) | Runs CI for hardware detection tooling on schedule and push. | `hw-detect-ci.yml` | push to `scripts/hw-detect.sh`, `scripts/hw-build-env.sh`, `scripts/kport/kport-detect*.sh` (+3 more) · pull_request · dispatch | +| HW Detect CI [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/hw-detect-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/hw-detect-ci.yml) | Runs CI for hardware detection tooling on schedule and push. | `hw-detect-ci.yml` | push to `scripts/hw-detect.sh`, `scripts/hw-build-env.sh`, `scripts/kport/kport-detect*.sh` (+4 more) · pull_request · dispatch | | List Chromium GitLab Repos [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/list-chromium-repos.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/list-chromium-repos.yml) | Lists all projects under the Chromium_Browser_OS_Deving GitLab group. Informational only — used to audit what has been mirrored. | `list-chromium-repos.yml` | dispatch | | Merge Repos into Monorepo [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/merge-to-monorepo.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/merge-to-monorepo.yml) | Merges multiple git repositories into a single monorepo, preserving full commit history, tags, and Git LFS objects. Manual dispatch only. | `merge-to-monorepo.yml` | dispatch | | Mirror README Audit [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-readme-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/mirror-readme-audit.yml) | Audits every live mirror-chain README against the neutral managed baseline and reports downstream drift and documented exceptions. | `mirror-readme-audit.yml` | push to `config/mirror-readme-baseline.json`, `config/live-chain-manifest.json`, `scripts/audit-mirror-readmes.py` (+4 more) · dispatch | | Pre-Mirror CI Gate [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/pre-mirror-ci-gate.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/pre-mirror-ci-gate.yml) | Checks CI status on all OSP-bound repos in Interested-Deving-1896 before mirroring. Dispatches resolve-failures for red repos, waits, then re-checks. Blocks the mirror if repos are still failing. | `pre-mirror-ci-gate.yml` | `Reconcile Org References` completes · dispatch | | README Subsystem Status [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem-status.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem-status.yml) | Audits engine and profile drift across all three README repositories, checks every Pages site, and maintains a status dashboard. | `readme-subsystem-status.yml` | push to `config/readme-subsystem.json`, `scripts/readme-subsystem-status.py`, `.github/workflows/readme-subsystem-status.yml` · dispatch | -| README Subsystem [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem.yml) | Validates and cross-ports the forge-neutral README subsystem from its canonical owner into the profile publication chain. | `readme-subsystem.yml` | push to `DOCS/readme-subsystem.md`, `config/readme-policy.json`, `config/readme-subsystem.json` (+10 more) · pull_request · dispatch | +| README Subsystem [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-subsystem.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-subsystem.yml) | Validates and cross-ports the forge-neutral README subsystem from its canonical owner into the profile publication chain. | `readme-subsystem.yml` | push to `DOCS/readme-subsystem.md`, `config/readme-policy.json`, `config/readme-subsystem.json` (+11 more) · pull_request · dispatch | | README Updater Validation [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/readme-updater-validation.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/readme-updater-validation.yml) | | `readme-updater-validation.yml` | pull_request · dispatch | +| Registered Consumer Submodule Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/registered-consumer-inventory.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/registered-consumer-inventory.yml) | | `registered-consumer-inventory.yml` | push to `config/template-consumers.yml`, `scripts/audit-registered-consumers.py`, `scripts/directory_inventory.py` (+3 more) · pull_request · dispatch | | Repo Manifest [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/repo-manifest.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/repo-manifest.yml) | Exports a manifest of all repos in an org, or imports repos from a manifest into a target GitHub org. Supports multi-platform bulk import. | `repo-manifest.yml` | dispatch | | Resolve CI Failures (Agnostic) [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/resolve-ci.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/resolve-ci.yml) | Agnostic CI failure resolver. Runs resolve-ci.sh for each enabled target in config/ci-check-targets.yml. GitHub targets use LLM analysis and auto-fix; GitLab targets retry failed/canceled pipelines. | `resolve-ci.yml` | dispatch | | Setup Dashboard Variables [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-dashboard-vars.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/setup-dashboard-vars.yml) | Sets all VITE_* repository variables required by the infra-dashboard public-dashboard build. Safe to re-run — blank inputs leave existing variables unchanged. | `setup-dashboard-vars.yml` | dispatch | | Setup GitLab CI Schedules [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/setup-gitlab-schedules.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/setup-gitlab-schedules.yml) | Replaces all existing GitLab pipeline schedules in openos-project/ops/fork-sync-all with the 3 consolidated CADENCE-based schedules. Safe to re-run. | `setup-gitlab-schedules.yml` | dispatch | | Shallow Reclone Large GitLab Mirrors [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/shallow-reclone-chromium.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/shallow-reclone-chromium.yml) | Reduces GitLab storage usage by replacing full git history on large mirror projects with a shallow clone. Run when openos-project approaches its 10 GiB storage limit. | `shallow-reclone-chromium.yml` | dispatch | +| Submodule and Directory Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/submodule-directory-audit.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/submodule-directory-audit.yml) | | `submodule-directory-audit.yml` | push to `.gitmodules`, `config/subtree-manifest.yml`, `scripts/audit-submodule-directory.py` (+2 more) · pull_request · dispatch | | Support Bundle [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/support-bundle.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/support-bundle.yml) | Creates a redacted, checksum-verified diagnostic archive for download or explicit HTTPS delivery. | `support-bundle.yml` | dispatch | | Trigger Artifact Mirror [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/trigger-artifact-mirror.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/trigger-artifact-mirror.yml) | Dispatches mirror-artifacts immediately when a release is published in this repo, so OSP and OOC receive the release without waiting for the next scheduled run. | `trigger-artifact-mirror.yml` | dispatch | | Upload Asset [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upload-asset.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upload-asset.yml) | Uploads files from URLs, artifacts, or repo paths to a release, repo directory, or issue comment. | `upload-asset.yml` | dispatch | @@ -465,6 +468,7 @@ Jump to any section: | Mon 04:30 | Weekly | Manage Repo Settings [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/manage-repo-settings.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/manage-repo-settings.yml) | | 04:30 | Daily | Mirror RPM Repo [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/mirror-rpm.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/mirror-rpm.yml) | | at :32 | Every 4h | Notification Poller [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/notify-poller.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/notify-poller.yml) | +| Mon 04:37 | Weekly | Registered Consumer Submodule Inventory [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/registered-consumer-inventory.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/registered-consumer-inventory.yml) | | 04:37 | Daily | Upstream PRs from OSP + OOC [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upstream-prs.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upstream-prs.yml) | | 04:47 | Daily | Upstream Direct Commits from OSP + OOC [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/upstream-commits.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/upstream-commits.yml) | | 04:55 | Daily | Sync Registered Imports [↗](https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/.github/workflows/sync-registered-imports.yml) [▶ Run](https://github.com/Interested-Deving-1896/fork-sync-all/actions/workflows/sync-registered-imports.yml) | diff --git a/docs/workflow-triggers.txt b/docs/workflow-triggers.txt index 071bc8845..6d788524c 100644 --- a/docs/workflow-triggers.txt +++ b/docs/workflow-triggers.txt @@ -1,7 +1,7 @@ FORK-SYNC-ALL — WORKFLOW TRIGGERS =================================== Generated from .github/workflows/ and config/workflow-quota-costs.yml -Last updated: 2026-11-03 +Last updated: 2026-11-26 Legend ------ @@ -677,6 +677,7 @@ Validate Config (validate-config.yml) push config/workflow-sync.yml push config/workflow-cost-profiles.yml push config/agent-budget.yml + push config/accessibility/** push config/workflow-priority-tiers.yml push config/template-manifest.yml push config/template-consumers.yml @@ -1089,6 +1090,10 @@ Validate README Render (validate-readme-render.yml) bare brackets, raw angle brackets, unclosed AI markers, missing H1, and empty sections. push README.md + push config/rendering/** + push scripts/validate-rendering-profiles.py + push DOCS/rendering-compatibility.md + pull_request dispatch Inject AI Agent Badges (inject-badges.yml) @@ -1244,6 +1249,20 @@ Clone Org (clone-org.yml) (GitHub, GitLab, Bitbucket, Gitea) into Interested-Deving-1896. dispatch +Declared Source Scope Inventory (declared-source-scope.yml) + push registered-imports.json + push .gitmodules + push config/template-consumers.yml + push config/live-chain-manifest.json + push config/subtree-manifest.yml + push config/shell-tools-registry.yml + push scripts/build-declared-source-scope.py + push tests/test_declared_source_scope.py + push docs/declared-source-scope-inventory.md + push .github/workflows/declared-source-scope.yml + pull_request + dispatch + Dependency Risk Audit (dependency-risk-audit.yml) Produces a severity-prioritized dependency vulnerability backlog and blocks on non-exempt critical alerts. @@ -1286,6 +1305,7 @@ HW Detect CI (hw-detect-ci.yml) push scripts/kport/kport-build-flags.sh push scripts/kport/kport-toolchain.sh push config/hardware.conf.tpl + push .github/workflows/hw-detect-ci.yml pull_request dispatch @@ -1342,6 +1362,7 @@ README Subsystem (readme-subsystem.yml) push scripts/readme_policy.py push scripts/check_rendered_links.py push scripts/check-markdown-links.py + push scripts/external_services.py push tests/fixtures/readme-subsystem/** push tests/test_readme_subsystem.py push .github/workflows/readme-subsystem.yml @@ -1352,6 +1373,17 @@ README Updater Validation (readme-updater-validation.yml) pull_request dispatch +Registered Consumer Submodule Inventory (registered-consumer-inventory.yml) + schedule Weekly Mon 04:37 (37 4 * * 1) + push config/template-consumers.yml + push scripts/audit-registered-consumers.py + push scripts/directory_inventory.py + push tests/test_directory_inventory.py + push tests/test_audit_registered_consumers.py + push .github/workflows/registered-consumer-inventory.yml + pull_request + dispatch + Repo Manifest (repo-manifest.yml) Exports a manifest of all repos in an org, or imports repos from a manifest into a target GitHub org. Supports multi-platform bulk import. @@ -1381,6 +1413,15 @@ Shallow Reclone Large GitLab Mirrors (shallow-reclone-chromium.yml) storage limit. dispatch +Submodule and Directory Inventory (submodule-directory-audit.yml) + push .gitmodules + push config/subtree-manifest.yml + push scripts/audit-submodule-directory.py + push tests/test_audit_submodule_directory.py + push .github/workflows/submodule-directory-audit.yml + pull_request + dispatch + Support Bundle (support-bundle.yml) Creates a redacted, checksum-verified diagnostic archive for download or explicit HTTPS delivery. @@ -1486,6 +1527,7 @@ Every 6h at :37 Sync-in Daily 10:15 Sync-in Daily 01:37 Sync Upstream Sources Daily 04:37 Upstream PRs from OSP + OOC +Weekly Mon 04:37 Registered Consumer Submodule Inventory Daily 06:37 README Subsystem Status Weekly Mon 08:37 Dependency Risk Audit Daily 06:38 OTA Discover diff --git a/examples/linktree-profile.example.json b/examples/linktree-profile.example.json new file mode 100644 index 000000000..9132b50ba --- /dev/null +++ b/examples/linktree-profile.example.json @@ -0,0 +1,28 @@ +{ + "schema_version": 1, + "slug": "example-profile", + "name": "Example Profile", + "bio": "A sample profile generated by the provider-neutral FSA Linktree Engine.", + "locale": "en", + "theme": { + "background": "#101827", + "foreground": "#f8fafc", + "accent": "#7dd3fc" + }, + "links": [ + { + "id": "source", + "label": "Source code", + "url": "https://github.com/Interested-Deving-1896/fork-sync-all", + "description": "Explore the automation project.", + "position": 0 + }, + { + "id": "documentation", + "label": "Documentation", + "url": "https://interested-deving-1896.github.io/fork-sync-all/", + "position": 1 + } + ], + "analytics": { "provider": "none" } +} diff --git a/schema/fleet-engine.schema.json b/schema/fleet-engine.schema.json new file mode 100644 index 000000000..06cf657e7 --- /dev/null +++ b/schema/fleet-engine.schema.json @@ -0,0 +1,137 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/schema/fleet-engine.schema.json", + "title": "Provider-neutral Fleet Engine inventory and policy contract", + "type": "object", + "required": ["schema_version", "mode", "providers", "sources", "policy", "repositories"], + "properties": { + "schema_version": { "const": 1 }, + "mode": { "enum": ["audit-only", "plan-only", "controlled-execution"] }, + "providers": { + "type": "array", + "uniqueItems": true, + "items": { "enum": ["github", "gitlab", "gitea", "forgejo", "codeberg", "generic"] } + }, + "sources": { + "type": "array", + "items": { "$ref": "#/$defs/source" } + }, + "policy": { "$ref": "#/$defs/policy" }, + "repositories": { + "type": "array", + "items": { "$ref": "#/$defs/repository" } + } + }, + "additionalProperties": false, + "$defs": { + "source": { + "type": "object", + "required": ["id", "kind", "path", "meaning"], + "properties": { + "id": { "type": "string", "minLength": 1 }, + "kind": { "enum": ["template-consumers", "import-registry", "mirror-manifest", "readme-subsystem", "platform-placement", "workflow-discovery", "operator-declaration"] }, + "path": { "type": "string", "minLength": 1 }, + "meaning": { "type": "string", "minLength": 1 }, + "platform": { "enum": ["github", "gitlab", "gitea", "forgejo", "codeberg", "generic"] }, + "authoritative_for": { + "type": "array", + "items": { "enum": ["identity", "placement", "import-provenance", "mirror-role", "template-membership", "readme-ownership", "artifact-ownership", "write-authority", "lifecycle"] } + } + }, + "additionalProperties": false + }, + "policy": { + "type": "object", + "required": ["default_disposition", "default_write_authority", "registry_membership_grants_write", "unknown_operation"], + "properties": { + "default_disposition": { "const": "unresolved" }, + "default_write_authority": { "const": "none" }, + "registry_membership_grants_write": { "const": false }, + "unknown_operation": { "const": "deny" }, + "protected_or_conflicted_write": { "const": "deny" }, + "required_evidence_for_mutation": { + "type": "array", + "uniqueItems": true, + "items": { "enum": ["resolved_identity", "resolved_owner", "explicit_operation_permission", "reviewable_plan", "approval", "precondition_check", "postcondition_check"] } + } + }, + "additionalProperties": false + }, + "repository": { + "type": "object", + "required": ["id", "platform", "namespace", "project", "identity_status", "disposition", "evidence"], + "properties": { + "id": { "type": "string", "pattern": "^[a-z0-9-]+:.+/.+$" }, + "platform": { "enum": ["github", "gitlab", "gitea", "forgejo", "codeberg", "generic"] }, + "namespace": { "type": "string", "minLength": 1 }, + "project": { "type": "string", "minLength": 1 }, + "default_branch": { "type": "string", "minLength": 1 }, + "identity_status": { "enum": ["resolved", "ambiguous", "missing"] }, + "disposition": { "enum": ["managed", "protected", "delegated", "external", "upstream-owned", "disabled", "archived", "opt-out", "exception", "unresolved"] }, + "roles": { + "type": "array", + "uniqueItems": true, + "items": { "enum": ["canonical-source", "mirror", "mirror-consumer", "imported", "template-consumer", "generated-consumer", "engine-owner", "profile-content-source", "downstream-publication", "external-dependency"] } + }, + "placement": { + "type": "object", + "properties": { + "namespace_path": { "type": "string" }, + "source": { "type": "string" }, + "fallback_applied": { "type": "boolean" } + }, + "additionalProperties": false + }, + "provenance": { + "type": "array", + "items": { + "type": "object", + "required": ["kind", "source"], + "properties": { + "kind": { "enum": ["import", "fork", "mirror", "template", "generated", "discovered"] }, + "source": { "type": "string", "minLength": 1 }, + "upstream": { "type": "string" }, + "confidence": { "enum": ["verified", "declared", "inferred", "unknown"] } + }, + "additionalProperties": false + } + }, + "ownership": { + "type": "object", + "properties": { + "readme": { "enum": ["fsa", "repository-owner", "profile-subsystem", "upstream", "delegated", "unknown"] }, + "template_files": { "enum": ["fsa", "repository-owner", "delegated", "none", "unknown"] }, + "artifacts": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": false + }, + "permissions": { + "type": "object", + "properties": { + "allowed": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "denied": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "unresolved": { "type": "array", "uniqueItems": true, "items": { "type": "string" } } + }, + "additionalProperties": false + }, + "lifecycle": { "enum": ["active", "paused", "archived", "unknown"] }, + "evidence": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["source_id", "record"], + "properties": { + "source_id": { "type": "string", "minLength": 1 }, + "record": { "type": "string", "minLength": 1 }, + "observed_at": { "type": "string", "format": "date-time" } + }, + "additionalProperties": false + } + }, + "conflicts": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": false + } + } +} diff --git a/schema/linktree-profile.schema.json b/schema/linktree-profile.schema.json new file mode 100644 index 000000000..8c3f2cd25 --- /dev/null +++ b/schema/linktree-profile.schema.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/Interested-Deving-1896/fork-sync-all/blob/main/schema/linktree-profile.schema.json", + "title": "Provider-neutral Link-in-Bio Profile", + "type": "object", + "required": ["schema_version", "slug", "name", "links"], + "properties": { + "schema_version": { "const": 1 }, + "slug": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$" }, + "name": { "type": "string", "minLength": 1, "maxLength": 120 }, + "bio": { "type": "string", "maxLength": 500 }, + "avatar_url": { "type": "string", "format": "uri", "pattern": "^https?://" }, + "avatar_alt": { "type": "string", "maxLength": 200 }, + "locale": { "type": "string", "default": "en", "pattern": "^[a-z]{2,3}(?:-[A-Z]{2})?$" }, + "theme": { + "type": "object", + "properties": { + "background": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }, + "foreground": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }, + "accent": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" } + }, + "additionalProperties": false + }, + "links": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["id", "label", "url"], + "properties": { + "id": { "type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$" }, + "label": { "type": "string", "minLength": 1, "maxLength": 100 }, + "url": { "type": "string", "format": "uri", "pattern": "^https?://" }, + "description": { "type": "string", "maxLength": 240 }, + "category": { "type": "string", "maxLength": 60 }, + "position": { "type": "integer", "minimum": 0 } + }, + "additionalProperties": false + } + }, + "analytics": { + "type": "object", + "properties": { "provider": { "const": "none" } }, + "additionalProperties": false + } + }, + "additionalProperties": false +} diff --git a/scripts/audit-registered-consumers.py b/scripts/audit-registered-consumers.py new file mode 100644 index 000000000..da7e44319 --- /dev/null +++ b/scripts/audit-registered-consumers.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python3 +"""GET-only inventory of submodules and tracked directories in registered consumers.""" +from __future__ import annotations +import argparse, base64, json, os, sys, urllib.error, urllib.parse, urllib.request +from datetime import datetime, timezone +from pathlib import Path +from typing import Any, Callable + +from directory_inventory import inventory_directories +try: + import yaml +except ImportError: + yaml = None + +API = "https://api.github.com" +OWNER = "Interested-Deving-1896" + +class ApiError(RuntimeError): + def __init__(self, status: int, message: str): + super().__init__(message) + self.status = status + +def github_get(path: str, token: str | None = None) -> dict[str, Any]: + headers = {"Accept":"application/vnd.github+json", "X-GitHub-Api-Version":"2022-11-28", + "User-Agent":"fork-sync-all-readonly-inventory"} + if token: + headers["Authorization"] = "Bearer " + token + req = urllib.request.Request(API + path, headers=headers, method="GET") + try: + with urllib.request.urlopen(req, timeout=30) as response: + data = json.loads(response.read().decode("utf-8")) + except urllib.error.HTTPError as exc: + raise ApiError(exc.code, exc.read().decode("utf-8","replace")[:500] or str(exc)) from exc + except (urllib.error.URLError, TimeoutError, json.JSONDecodeError) as exc: + raise ApiError(0, str(exc)) from exc + if not isinstance(data, dict): + raise ApiError(0, "Non-object GitHub API response") + return data + +def resolve_repository(name: str) -> str: + value = name.strip() + if not value or value.startswith("/") or value.endswith("/") or value.count("/") > 1: + raise ValueError("Invalid consumer repository name: " + repr(name)) + return value if "/" in value else OWNER + "/" + value + +def load_consumers(path: str | Path) -> list[dict[str, Any]]: + if yaml is None: + raise RuntimeError("PyYAML is required") + raw = yaml.safe_load(Path(path).read_text(encoding="utf-8")) + if not isinstance(raw, dict) or not isinstance(raw.get("consumers"), list): + raise ValueError("Registry must contain a consumers list") + out, seen = [], set() + for item in raw["consumers"]: + if not isinstance(item, dict) or not isinstance(item.get("name"), str): + raise ValueError("Each consumer must have a name") + full = resolve_repository(item["name"]) + if full.casefold() in seen: + raise ValueError("Duplicate consumer: " + full) + seen.add(full.casefold()) + out.append({**item, "repository": full}) + return out + +def parse_gitmodules_paths(content: str | None) -> dict[str, dict[str, str]]: + """Parse path/name/url metadata without treating it as proof of source identity.""" + if not content: + return {} + import configparser + parser = configparser.ConfigParser(interpolation=None, strict=False) + parser.read_string(content) + result = {} + for section in parser.sections(): + if not section.startswith('submodule '): + continue + path = parser.get(section, 'path', fallback='').strip() + if path: + result[path] = { + "name": section[len('submodule '):].strip().strip('"'), + "url": parser.get(section, 'url', fallback='').strip(), + } + return result + + +def reconcile_remote_manifest(manifest: dict[str, Any], gitmodules_paths: dict[str, Any], + gitlink_paths: set[str], directory_paths: set[str]) -> dict[str, Any]: + """Compare declared subtree/submodule paths with immutable tree evidence.""" + findings = [] + declared_submodules = {} + for item in manifest.get("submodules") or []: + if isinstance(item, dict) and isinstance(item.get("path"), str): + declared_submodules[item["path"]] = item + umbrella = manifest.get("umbrella") or {} + if isinstance(umbrella, dict) and umbrella.get("enabled") is True: + prefix = str(umbrella.get("prefix") or "").strip("/") + for item in umbrella.get("children") or []: + if isinstance(item, dict) and isinstance(item.get("name"), str): + path = "/".join(part for part in (prefix, item["name"]) if part) + declared_submodules.setdefault(path, item) + declared_paths = set(declared_submodules) + gm_paths = set(gitmodules_paths) + for path in sorted(declared_paths - gm_paths): + findings.append({"kind":"manifest_submodule_missing_gitmodules","path":path}) + for path in sorted(gm_paths - declared_paths): + findings.append({"kind":"gitmodules_submodule_missing_manifest","path":path}) + for path in sorted(declared_paths - gitlink_paths): + findings.append({"kind":"manifest_submodule_missing_gitlink","path":path}) + for path in sorted(gitlink_paths - declared_paths): + findings.append({"kind":"gitlink_missing_manifest_submodule","path":path}) + declared_subtrees = {} + for item in manifest.get("subtrees") or []: + if isinstance(item, dict): + prefix = item.get("prefix") + if isinstance(prefix, str) and prefix: + declared_subtrees[prefix.strip("/")] = item + for path in sorted(set(declared_subtrees) - directory_paths): + findings.append({"kind":"manifest_subtree_prefix_missing_directory","path":path}) + return { + "manifest_present": True, + "declared_submodule_count": len(declared_paths), + "declared_subtree_count": len(declared_subtrees), + "findings": findings, + "consistent": not findings, + "limitations": [ + "Manifest declarations do not prove ownership, provenance, license, or source identity.", + "Subtree presence is checked by path only; content and history are not fetched.", + ], + } + + +def inspect_consumer(entry: dict[str, Any], get: Callable[[str], dict[str, Any]]) -> dict[str, Any]: + rec = {"repository":entry["repository"], "registry_name":entry["name"], + "tier":entry.get("tier","managed"), "profile":entry.get("profile"), + "disabled":bool(entry.get("disabled",False)), "delegated_to":entry.get("delegated_to"), + "read_only":True, "status":"pending"} + if rec["disabled"]: + rec.update(status="disabled", reason="Disabled registry entry; not queried") + return rec + name = urllib.parse.quote(entry["repository"], safe="/") + try: + repo = get("/repos/" + name) + branch = repo.get("default_branch") + if not isinstance(branch,str) or not branch: + raise ApiError(0,"Repository has no default_branch") + commit = get("/repos/" + name + "/commits/" + urllib.parse.quote(branch,safe="")) + head = commit.get("sha") + tree_sha = (commit.get("commit") or {}).get("tree",{}).get("sha") + if not isinstance(head,str) or not isinstance(tree_sha,str): + raise ApiError(0,"Default branch commit/tree identity missing") + tree = get("/repos/" + name + "/git/trees/" + tree_sha + "?recursive=1") + if tree.get("truncated") or not isinstance(tree.get("tree"),list): + raise ApiError(0,"Recursive tree missing or truncated") + entries = tree["tree"] + directory_report = inventory_directories(entries) + links = sorted([{"path":x.get("path"),"commit":x.get("sha")} + for x in entries if x.get("mode")=="160000"], key=lambda x:x["path"] or "") + gm = next((x for x in entries if x.get("path")==".gitmodules" and x.get("type")=="blob"),None) + gm_text, gm_error = None, None + if gm: + try: + blob = get("/repos/" + name + "/git/blobs/" + gm["sha"]) + gm_text = base64.b64decode(blob.get("content","")).decode("utf-8","replace") + except (ApiError, ValueError) as exc: + gm_error = str(exc) + manifest_entry = next((x for x in entries if x.get("path")=="config/subtree-manifest.yml" and x.get("type")=="blob"),None) + manifest_data, manifest_error = None, None + if manifest_entry: + try: + manifest_blob = get("/repos/" + name + "/git/blobs/" + manifest_entry["sha"]) + manifest_text = base64.b64decode(manifest_blob.get("content","")).decode("utf-8","replace") + if yaml is None: + raise ValueError("PyYAML unavailable for remote manifest parsing") + parsed = yaml.safe_load(manifest_text) + if not isinstance(parsed,dict): + raise ValueError("Remote subtree manifest is not a YAML mapping") + manifest_data = parsed + except (ApiError, ValueError, UnicodeError) as exc: + manifest_error = str(exc) + gm_paths = parse_gitmodules_paths(gm_text) + gitlink_paths = {x["path"] for x in links if x.get("path")} + directory_paths = {x["path"] for x in directory_report["directories"]} + reconciliation = None + if manifest_data is not None: + reconciliation = reconcile_remote_manifest(manifest_data,gm_paths,gitlink_paths,directory_paths) + status = "partial" if gm_error or manifest_error else ( + "warning" if bool(gm) != bool(links) or (reconciliation and not reconciliation["consistent"]) else "complete") + rec.update(status=status, default_branch=branch, head=head, tree=tree_sha, + archived=bool(repo.get("archived",False)), private=bool(repo.get("private",False)), + gitlinks=links, directories=directory_report, gitmodules={"present":bool(gm),"blob_sha":gm.get("sha") if gm else None, + "content":gm_text,"error":gm_error,"declared_paths":gm_paths}, + subtree_manifest={"present":bool(manifest_entry),"blob_sha":manifest_entry.get("sha") if manifest_entry else None, + "error":manifest_error,"reconciliation":reconciliation}, + counts={"gitlinks":len(links),"gitmodules_present":bool(gm), + "directories":directory_report["directory_count"], + "manifest_findings":len(reconciliation["findings"]) if reconciliation else None}, + evidence={"repository_api":"success","commit_api":"success","tree_api":"success", + "manifest_api":"success" if manifest_data is not None else "not_present" if not manifest_entry else "incomplete"}) + except ApiError as exc: + status = {404:"not_found_or_inaccessible",403:"forbidden_or_rate_limited",0:"unavailable"}.get(exc.status,"api_error") + rec.update(status=status,http_status=exc.status or None,reason=str(exc), + evidence={"remote_inventory_complete":False}) + return rec + +def build_report(consumers: list[dict[str, Any]], get: Callable[[str],dict[str,Any]]) -> dict[str,Any]: + records = [inspect_consumer(x,get) for x in consumers] + counts = {} + for x in records: + counts[x["status"]] = counts.get(x["status"],0)+1 + queried = len(records)-counts.get("disabled",0) + complete = counts.get("complete",0)+counts.get("warning",0) + return {"schema_version":1,"generated_at":datetime.now(timezone.utc).isoformat(), + "read_only":True,"registry":"config/template-consumers.yml","registry_entries":len(records), + "queried_repositories":queried, + "coverage":{"completed":complete,"incomplete":queried-complete, + "complete_fraction":round(complete/queried,4) if queried else 1.0}, + "status_counts":counts,"repositories":records, + "safety":{"registry_membership_is_not_ownership":True,"no_remote_writes":True, + "no_submodule_initialization_or_fetch":True,"no_directory_or_pin_mutations":True, + "no_source_execution":True}} + +def render_markdown(report: dict[str,Any]) -> str: + lines=["# Registered consumer submodule and directory inventory","", + "- Generated: "+report["generated_at"], + "- Registry entries: "+str(report["registry_entries"]), + "- Queried repositories: "+str(report["queried_repositories"]), + "- Coverage complete: "+str(report["coverage"]["completed"])+"/"+str(report["registry_entries"]), + "- Read-only: yes","","## Repository results","", + "| Repository | Status | Default branch | HEAD | Gitlinks | Directories | .gitmodules |", + "|---|---|---|---|---:|---:|---|"] + for x in report["repositories"]: + gm=x.get("gitmodules",{}) + lines.append("| {0} | {1} | {2} | {3} | {4} | {5} | {6} |".format( + x["repository"],x["status"],x.get("default_branch","—"),(x.get("head") or "—")[:12], + x.get("counts",{}).get("gitlinks","—"),x.get("counts",{}).get("directories","—"), + "yes" if gm.get("present") else "no" if gm else "—")) + lines += ["","## Safety boundaries","", + "Registry membership is discovery metadata, not proof of ownership or provenance.", + "The scan uses GET-only GitHub API calls. It does not initialize or fetch submodules,", + "execute repository content, update pins, change directories, or write to scanned repositories.", + "","## Incomplete and warning results",""] + exceptional=[x for x in report["repositories"] if x["status"] not in ("complete","disabled")] + lines += ["- **{0}** — {1}: {2}".format(x["status"],x["repository"],x.get("reason","metadata differs or is incomplete")) for x in exceptional] or ["- None."] + return "\n".join(lines)+"\n" + +def main() -> int: + p=argparse.ArgumentParser(description=__doc__) + p.add_argument("--registry",default="config/template-consumers.yml") + p.add_argument("--json-out",required=True); p.add_argument("--markdown-out",required=True) + a=p.parse_args() + try: + report=build_report(load_consumers(a.registry),lambda path:github_get(path,os.environ.get("GITHUB_TOKEN"))) + except (OSError,RuntimeError,ValueError) as exc: + print("inventory failed: "+str(exc),file=sys.stderr); return 2 + Path(a.json_out).write_text(json.dumps(report,indent=2,sort_keys=True)+"\n",encoding="utf-8") + Path(a.markdown_out).write_text(render_markdown(report),encoding="utf-8") + print(json.dumps({"coverage":report["coverage"],"status_counts":report["status_counts"]},sort_keys=True)) + return 0 if report["coverage"]["incomplete"]==0 else 1 + +if __name__=="__main__": + raise SystemExit(main()) diff --git a/scripts/audit-submodule-directory.py b/scripts/audit-submodule-directory.py new file mode 100644 index 000000000..f396a2c93 --- /dev/null +++ b/scripts/audit-submodule-directory.py @@ -0,0 +1,245 @@ +#!/usr/bin/env python3 +"""Read-only reconciliation of subtree/submodule declarations and directory inventory. + +This validator intentionally never initializes, updates, fetches, or mutates Git +repositories. It inspects the current checkout and config/subtree-manifest.yml. +""" +from __future__ import annotations + +import argparse +import json +import subprocess +import sys +from urllib.parse import urlsplit +from pathlib import Path +from typing import Any + +try: + import yaml +except ImportError: # pragma: no cover - exercised by CLI error path + yaml = None + + +def git(repo: Path, *args: str) -> bytes: + result = subprocess.run(["git", *args], cwd=repo, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, check=False) + if result.returncode: + message = result.stderr.decode("utf-8", "replace").strip() + raise RuntimeError(message or f"git {' '.join(args)} failed") + return result.stdout + + +def gitmodules(repo: Path) -> dict[str, dict[str, str]]: + if not (repo / ".gitmodules").exists(): + return {} + raw = git(repo, "config", "-f", ".gitmodules", "--null", "--list") + result: dict[str, dict[str, str]] = {} + for item in raw.decode("utf-8", "replace").split("\0"): + if not item or "\n" not in item: + continue + key, value = item.split("\n", 1) + if not key.startswith("submodule.") or "." not in key[9:]: + continue + name, field = key[9:].rsplit(".", 1) + result.setdefault(name, {})[field] = value + return result + + +def gitlinks(repo: Path) -> dict[str, str]: + raw = git(repo, "ls-tree", "-r", "-z", "HEAD") + found: dict[str, str] = {} + for record in raw.split(b"\0"): + if not record: + continue + metadata, path = record.split(b"\t", 1) + mode, _kind, sha = metadata.decode("ascii").split() + if mode == "160000": + found[path.decode("utf-8", "surrogateescape")] = sha + return found + + +def canonical_url(value: str) -> str: + """Normalize URL transport/host without changing case-sensitive path data.""" + value = value.strip() + if value.startswith("git@github.com:"): + value = "https://github.com/" + value.split(":", 1)[1] + elif value.startswith("ssh://git@github.com/"): + value = "https://github.com/" + value.split("/", 3)[-1] + + parsed = urlsplit(value) + if not parsed.scheme or not parsed.netloc: + return value.rstrip("/").removesuffix(".git") + + scheme = parsed.scheme.casefold() + host = (parsed.hostname or "").casefold() + port = parsed.port + default_port = (scheme == "https" and port == 443) or (scheme == "http" and port == 80) + netloc = host if port is None or default_port else f"{host}:{port}" + path = parsed.path.rstrip("/") + if path.endswith(".git"): + path = path[:-4] + return f"{scheme}://{netloc}{path}" + + +def classify(path: str) -> str: + parts = Path(path).parts + name = parts[-1].casefold() if parts else path.casefold() + if name in {"node_modules", "__pycache__", ".pytest_cache", "dist", "build", "out", "target", "cache"}: + return "generated_or_cache" + if any(part.casefold() == "vendor" for part in parts): + return "vendored_or_imported" + if path == ".github" or path.startswith(".github/") or path.startswith("config/"): + return "configuration_and_automation" + if path == "scripts" or path.startswith("scripts/"): + return "first_party_tooling" + if path == "tests" or path.startswith("tests/"): + return "tests" + if path.startswith("docs/") or path == "docs": + return "documentation" + return "unclassified" + + +def audit(repo_root: str | Path, manifest_path: str | Path | None = None) -> dict[str, Any]: + repo = Path(repo_root).resolve() + manifest = Path(manifest_path) if manifest_path else Path("config/subtree-manifest.yml") + if not manifest.is_absolute(): + manifest = repo / manifest + findings: list[dict[str, Any]] = [] + incomplete: list[str] = [] + try: + head = git(repo, "rev-parse", "HEAD").decode().strip() + tree = git(repo, "rev-parse", "HEAD^{tree}").decode().strip() + links = gitlinks(repo) + modules = gitmodules(repo) + tracked = [x.decode("utf-8", "surrogateescape") for x in + git(repo, "ls-tree", "-r", "-z", "--name-only", "HEAD").split(b"\0") if x] + except RuntimeError as exc: + return {"schema_version": 1, "status": "partial", "read_only": True, + "repository": str(repo), "head": None, "gitlinks": [], "gitmodules": [], + "directories": [], "findings": [], "incomplete_reasons": [str(exc)]} + + if yaml is None: + incomplete.append("PyYAML is unavailable; manifest could not be parsed.") + data: dict[str, Any] = {} + elif not manifest.is_file(): + incomplete.append(f"Manifest not found: {manifest}") + data = {} + else: + try: + loaded = yaml.safe_load(manifest.read_text(encoding="utf-8")) + data = loaded if isinstance(loaded, dict) else {} + except (OSError, yaml.YAMLError) as exc: + incomplete.append(f"Manifest parse failed: {exc}") + data = {} + + declared_submodules = data.get("submodules") or [] + declared_subtrees = data.get("subtrees") or [] + if not isinstance(declared_submodules, list) or not isinstance(declared_subtrees, list): + incomplete.append("Manifest submodules/subtrees fields must be lists.") + declared_submodules, declared_subtrees = [], [] + + module_by_path: dict[str, tuple[str, dict[str, str]]] = {} + for name, fields in modules.items(): + path = fields.get("path") + if not path: + findings.append({"code": "gitmodules_missing_path", "severity": "blocked", "name": name}) + continue + if path in module_by_path: + findings.append({"code": "duplicate_gitmodules_path", "severity": "blocked", "path": path}) + module_by_path[path] = (name, fields) + + manifest_by_path: dict[str, dict[str, Any]] = {} + for item in declared_submodules: + if not isinstance(item, dict) or not item.get("name") or not item.get("url") or not item.get("path"): + findings.append({"code": "invalid_manifest_submodule", "severity": "blocked", "entry": item}) + continue + path = str(item["path"]) + if path in manifest_by_path: + findings.append({"code": "duplicate_manifest_path", "severity": "blocked", "path": path}) + manifest_by_path[path] = item + registered = module_by_path.get(path) + if not registered: + findings.append({"code": "manifest_submodule_missing_gitmodules", "severity": "blocked", "path": path}) + elif canonical_url(str(item["url"])) != canonical_url(registered[1].get("url", "")): + findings.append({"code": "submodule_url_mismatch", "severity": "blocked", "path": path, + "manifest_url": item["url"], "gitmodules_url": registered[1].get("url")}) + if path not in links: + findings.append({"code": "manifest_submodule_missing_gitlink", "severity": "blocked", "path": path}) + + for path in module_by_path: + if path not in manifest_by_path: + findings.append({"code": "orphan_gitmodules_declaration", "severity": "warning", "path": path}) + for path, sha in links.items(): + if path not in module_by_path: + findings.append({"code": "orphan_gitlink", "severity": "blocked", "path": path, "sha": sha}) + if path not in manifest_by_path: + findings.append({"code": "gitlink_missing_manifest_entry", "severity": "blocked", "path": path, "sha": sha}) + + declared_prefixes: list[dict[str, str]] = [] + for item in declared_subtrees: + if not isinstance(item, dict) or not item.get("name") or not item.get("remote"): + findings.append({"code": "invalid_manifest_subtree", "severity": "blocked", "entry": item}) + continue + prefix = str(item.get("prefix") or f"vendor/{item['name']}") + declared_prefixes.append({"name": str(item["name"]), "path": prefix}) + if not (repo / prefix).exists(): + findings.append({"code": "manifest_subtree_path_missing", "severity": "warning", "path": prefix}) + + all_paths = list(manifest_by_path) + [x["path"] for x in declared_prefixes] + for i, left in enumerate(all_paths): + for right in all_paths[i + 1:]: + if left == right or left.startswith(right.rstrip("/") + "/") or right.startswith(left.rstrip("/") + "/"): + findings.append({"code": "managed_path_collision_or_nesting", "severity": "blocked", + "paths": sorted([left, right])}) + + directory_set: set[str] = set(links) + for tracked_path in tracked: + parent = Path(tracked_path).parent + while parent != Path("."): + directory_set.add(parent.as_posix()) + parent = parent.parent + directory_records = [{"path": p, "classification": classify(p), "ownership": "unassigned"} + for p in sorted(directory_set)] + severities = {f["severity"] for f in findings} + status = "partial" if incomplete else "blocked" if "blocked" in severities else "warning" if findings else "clean" + return {"schema_version": 1, "status": status, "read_only": True, "repository": str(repo), + "head": head, "tree": tree, + "gitmodules": [{"name": n, **v} for n, v in sorted(modules.items())], + "gitlinks": [{"path": p, "commit": s} for p, s in sorted(links.items())], + "manifest_submodules": sorted(manifest_by_path), + "manifest_subtrees": sorted(declared_prefixes, key=lambda x: x["path"]), + "directories": directory_records, "findings": findings, "incomplete_reasons": incomplete, + "summary": {"gitmodules": len(modules), "gitlinks": len(links), + "manifest_submodules": len(manifest_by_path), "directories": len(directory_records)}} + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--repo-root", default=".") + parser.add_argument("--manifest", default=None) + parser.add_argument("--json-out", default=None) + parser.add_argument("--markdown-out", default=None) + args = parser.parse_args() + report = audit(args.repo_root, args.manifest) + encoded = json.dumps(report, indent=2, sort_keys=True) + "\n" + if args.json_out: + Path(args.json_out).write_text(encoded, encoding="utf-8") + else: + sys.stdout.write(encoded) + if args.markdown_out: + lines = [f"# Submodule and directory inventory: {report['repository']}", "", + f"- Status: **{report['status']}**", "- Read-only: yes", "", + "## Summary", "", "| Resource | Count |", "|---|---:|"] + lines.extend(f"| {key} | {value} |" for key, value in report.get("summary", {}).items()) + lines += ["", "## Findings", ""] + lines.extend(f"- **{x['severity']}** `{x['code']}`: `{x.get('path', '')}`" for x in report["findings"]) + if not report["findings"]: + lines.append("- None.") + lines += ["", "## Incomplete evidence", ""] + lines.extend(f"- {x}" for x in report["incomplete_reasons"] or ["None."]) + Path(args.markdown_out).write_text("\n".join(lines) + "\n", encoding="utf-8") + return 0 if report["status"] in {"clean", "warning"} else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/build-declared-source-scope.py b/scripts/build-declared-source-scope.py new file mode 100644 index 000000000..14ab8de89 --- /dev/null +++ b/scripts/build-declared-source-scope.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +"""Build a deterministic, offline inventory of every declared repository scope.""" +from __future__ import annotations + +import argparse +import configparser +import hashlib +import json +import re +import sys +from collections import Counter +from pathlib import Path +from typing import Any +from urllib.parse import urlparse + +try: + import yaml +except ImportError: + yaml = None + +ROOT = Path(__file__).resolve().parents[1] +INPUTS = ( + "registered-imports.json", + "config/template-consumers.yml", + "config/live-chain-manifest.json", + ".gitmodules", + "config/subtree-manifest.yml", + "config/shell-tools-registry.yml", + "config/gitlab-mirror-sources.yml", + "config/gitlab-subgroups.yml", + "config/gitlab-subgroups-ooc.yml", +) + + +def read_text(root: Path, relative: str) -> str | None: + path = root / relative + return path.read_text(encoding="utf-8") if path.is_file() else None + + +def repo_identity(value: str, default_owner: str = "Interested-Deving-1896") -> tuple[str, str, str]: + raw = value.strip() + if not raw: + raise ValueError("empty repository identity") + if "://" in raw: + parsed = urlparse(raw) + host = (parsed.hostname or "").lower() + path = parsed.path.strip("/") + elif raw.startswith("git@") and ":" in raw: + host, path = raw[4:].split(":", 1) + host = host.lower() + else: + host, path = "github.com", raw + path = re.sub(r"\.git$", "", path).strip("/") + parts = [part for part in path.split("/") if part] + if host in ("github.com", "www.github.com") and len(parts) >= 2: + return "github", "/".join(parts[:2]), "https://github.com/" + "/".join(parts[:2]) + if host in ("gitlab.com", "www.gitlab.com") and len(parts) >= 2: + return "gitlab", "/".join(parts), "https://gitlab.com/" + "/".join(parts) + if len(parts) == 1 and host == "github.com": + parts.insert(0, default_owner) + return "github", "/".join(parts), "https://github.com/" + "/".join(parts) + return (host or "unknown"), path or raw, raw + + +def build_scope(root: Path) -> dict[str, Any]: + if yaml is None: + raise RuntimeError("PyYAML is required") + records: dict[tuple[str, str], dict[str, Any]] = {} + input_hashes: dict[str, str] = {} + missing: list[str] = [] + + for name in INPUTS: + text = read_text(root, name) + if text is None: + missing.append(name) + else: + input_hashes[name] = hashlib.sha256(text.encode("utf-8")).hexdigest() + + def add(value: str, registry: str, relation: str, declared_as: str, + default_owner: str = "Interested-Deving-1896", metadata: dict[str, Any] | None = None) -> None: + platform, repository, canonical_url = repo_identity(value, default_owner) + key = (platform.casefold(), repository.casefold()) + item = records.setdefault(key, { + "platform": platform, "repository": repository, "canonical_url": canonical_url, + "declarations": [], + }) + declaration = {"registry": registry, "relation": relation, "declared_as": declared_as} + if metadata: + declaration.update({k: v for k, v in metadata.items() if v is not None}) + if declaration not in item["declarations"]: + item["declarations"].append(declaration) + + imports_text = read_text(root, "registered-imports.json") + if imports_text: + imports = json.loads(imports_text) + if not isinstance(imports, list): + raise ValueError("registered-imports.json must be a list") + for index, entry in enumerate(imports): + if not isinstance(entry, dict) or not isinstance(entry.get("source_url"), str): + raise ValueError(f"registered-imports.json entry {index} has no source_url") + source = entry["source_url"] + add(source, "registered-imports.json", "upstream_source", source, + metadata={"target_name": entry.get("target_name"), "declared_platform": entry.get("platform")}) + target = entry.get("target_name") + if isinstance(target, str) and target.strip(): + add(target, "registered-imports.json", "sync_target", target, + metadata={"source_url": source, "declared_platform": entry.get("platform")}) + + consumers_text = read_text(root, "config/template-consumers.yml") + if consumers_text: + data = yaml.safe_load(consumers_text) or {} + for entry in data.get("consumers", []): + if not isinstance(entry, dict) or not isinstance(entry.get("name"), str): + continue + add(entry["name"], "config/template-consumers.yml", "template_consumer", + entry["name"], metadata={"tier": entry.get("tier", "managed"), + "profile": entry.get("profile"), "disabled": bool(entry.get("disabled", False))}) + + live_text = read_text(root, "config/live-chain-manifest.json") + if live_text: + data = json.loads(live_text) + source_namespace = (data.get("source") or {}).get("namespace", "Interested-Deving-1896") + mirrors = data.get("mirrors") or [] + for project in data.get("projects") or []: + if not isinstance(project, dict) or not isinstance(project.get("name"), str): + continue + name = project["name"] + add(f"{source_namespace}/{name}", "config/live-chain-manifest.json", + "live_chain_source", name, metadata={"readme_policy": project.get("readme_policy")}) + for mirror in mirrors: + namespace = mirror.get("namespace") + platform = mirror.get("platform", "github") + if namespace and platform == "github": + add(f"{namespace}/{name}", "config/live-chain-manifest.json", + "declared_mirror_counterpart", name, metadata={"source_repository": f"{source_namespace}/{name}"}) + + gitmodules_text = read_text(root, ".gitmodules") + if gitmodules_text: + parser = configparser.ConfigParser(interpolation=None, strict=False) + parser.read_string(gitmodules_text) + for section in parser.sections(): + if not section.startswith("submodule "): + continue + url = parser.get(section, "url", fallback="").strip() + path = parser.get(section, "path", fallback="").strip() + if url: + add(url, ".gitmodules", "submodule_source", section[len("submodule "):].strip().strip('"'), + metadata={"path": path or None}) + + subtree_text = read_text(root, "config/subtree-manifest.yml") + if subtree_text: + data = yaml.safe_load(subtree_text) or {} + for entry in data.get("submodules") or []: + if isinstance(entry, dict) and isinstance(entry.get("url"), str): + add(entry["url"], "config/subtree-manifest.yml", "manifest_submodule", + entry.get("name") or entry["url"], metadata={"path": entry.get("path"), "branch": entry.get("branch")}) + for entry in data.get("subtrees") or []: + if isinstance(entry, dict) and isinstance(entry.get("remote"), str): + add(entry["remote"], "config/subtree-manifest.yml", "subtree_source", + entry.get("name") or entry["remote"], metadata={"prefix": entry.get("prefix"), "branch": entry.get("branch")}) + umbrella = data.get("umbrella") or {} + if umbrella.get("enabled") is True: + for entry in umbrella.get("children") or []: + if isinstance(entry, dict) and isinstance(entry.get("url"), str): + add(entry["url"], "config/subtree-manifest.yml", "umbrella_child", + entry.get("name") or entry["url"], metadata={"prefix": umbrella.get("prefix"), "branch": entry.get("branch")}) + + for registry in ("config/gitlab-subgroups.yml", "config/gitlab-subgroups-ooc.yml"): + group_text = read_text(root, registry) + if group_text: + group_data = yaml.safe_load(group_text) or {} + for subgroup in (group_data.get("subgroups") or {}).values(): + if not isinstance(subgroup, dict): + continue + group_path = subgroup.get("path") + for repo_name in subgroup.get("repos") or []: + if isinstance(group_path, str) and isinstance(repo_name, str): + add(f"https://gitlab.com/{group_path}/{repo_name}", registry, + "declared_gitlab_mirror_target", repo_name, + metadata={"subgroup": group_path}) + + tools_text = read_text(root, "config/shell-tools-registry.yml") + if tools_text: + data = yaml.safe_load(tools_text) or {} + for entry in data.get("tools") or []: + if isinstance(entry, dict) and isinstance(entry.get("upstream"), str): + add(entry["upstream"], "config/shell-tools-registry.yml", "vendored_tool_upstream", + entry.get("repo") or entry["upstream"], metadata={"vendor_path": entry.get("repo")}) + + output = [] + for item in records.values(): + item["declarations"].sort(key=lambda x: (x["registry"], x["relation"], x["declared_as"])) + item["revision_pinned"] = any( + d.get("revision") or d.get("commit") or d.get("sha") for d in item["declarations"] + ) + output.append(item) + output.sort(key=lambda x: (x["platform"].casefold(), x["repository"].casefold())) + platform_counts = dict(sorted(Counter(x["platform"] for x in output).items())) + registry_counts = dict(sorted(Counter(d["registry"] for x in output for d in x["declarations"]).items())) + return { + "schema_version": 1, + "read_only": True, + "network_access": False, + "repository_count": len(output), + "platform_counts": platform_counts, + "declaration_counts_by_registry": registry_counts, + "input_sha256": dict(sorted(input_hashes.items())), + "missing_inputs": sorted(missing), + "repositories": output, + "limitations": [ + "This is a declaration-scope inventory, not proof that a repository exists or is accessible.", + "No remote metadata, tree, content, license, provenance, ownership, or immutable source revision is fetched or inferred.", + "Mirror counterparts and sync targets are declared relationships, not authorization to write or propagate.", + "Non-GitHub platforms require a separate provider adapter and remain explicitly represented.", + ], + } + + +def render_markdown(report: dict[str, Any]) -> str: + lines = [ + "# Declared repository source-scope inventory", "", + "- Schema: " + str(report["schema_version"]), + "- Read-only: yes", + "- Network access: no", + "- Unique declared repository identities: " + str(report["repository_count"]), + "", "## Platforms", "", + "| Platform | Declared repositories |", "|---|---:|", + ] + for platform, count in report["platform_counts"].items(): + lines.append(f"| {platform} | {count} |") + lines += ["", "## Declarations by registry", "", "| Registry | Repository declarations |", "|---|---:|"] + for registry, count in report["declaration_counts_by_registry"].items(): + lines.append(f"| {registry} | {count} |") + lines += ["", "## Repository identities", "", "| Platform | Repository | Declaration sources |", "|---|---|---|"] + for item in report["repositories"]: + sources = ", ".join(sorted({d["registry"] for d in item["declarations"]})) + lines.append(f"| {item['platform']} | {item['repository']} | {sources} |") + lines += ["", "## Limitations", ""] + lines.extend("- " + item for item in report["limitations"]) + return "\n".join(lines) + "\n" + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--root", default=str(ROOT)) + parser.add_argument("--json-out", required=True) + parser.add_argument("--markdown-out", required=True) + args = parser.parse_args() + try: + report = build_scope(Path(args.root)) + except (OSError, ValueError, RuntimeError, json.JSONDecodeError, configparser.Error) as exc: + print(f"scope inventory failed: {exc}", file=sys.stderr) + return 2 + Path(args.json_out).write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8") + Path(args.markdown_out).write_text(render_markdown(report), encoding="utf-8") + print(json.dumps({"repository_count": report["repository_count"], + "platform_counts": report["platform_counts"], + "declaration_counts_by_registry": report["declaration_counts_by_registry"]}, sort_keys=True)) + return 0 if not report["missing_inputs"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/check-markdown-links.py b/scripts/check-markdown-links.py index 7dc3d65e5..af648f115 100755 --- a/scripts/check-markdown-links.py +++ b/scripts/check-markdown-links.py @@ -18,6 +18,11 @@ from urllib.parse import urlsplit from urllib.request import Request, urlopen +try: + from external_services import classify_http_status, classify_transport_failure, is_non_blocking_outcome +except ModuleNotFoundError: + from scripts.external_services import classify_http_status, classify_transport_failure, is_non_blocking_outcome + FENCE = re.compile(r"^ {0,3}(`{3,}|~{3,})") REFERENCE = re.compile( @@ -40,6 +45,8 @@ class LinkResult: status: int | None attempts: int error: str + classification: str + blocking: bool occurrences: list[dict[str, object]] @@ -314,13 +321,15 @@ def audit( status=status, attempts=attempts, error=error, + classification=(classify_http_status(status).outcome.value if status is not None else classify_transport_failure(error).outcome.value), + blocking=(not is_non_blocking_outcome(classify_http_status(status).outcome) if status is not None else True), occurrences=[asdict(item) for item in by_url[url]], ) ) results.sort(key=lambda item: item.url) return { "schema_version": 1, - "healthy": all(item.healthy for item in results), + "healthy": all(item.healthy or not item.blocking for item in results), "links_checked": len(results), "occurrences": len(occurrences), "results": [asdict(item) for item in results], @@ -330,7 +339,8 @@ def audit( def render_markdown(report: dict[str, object]) -> str: results = report["results"] assert isinstance(results, list) - failures = [item for item in results if not item["healthy"]] + failures = [item for item in results if not item["healthy"] and item["blocking"]] + inconclusive = [item for item in results if not item["blocking"] and not item["healthy"]] lines = [ "# Markdown external-link audit", "", @@ -339,6 +349,7 @@ def render_markdown(report: dict[str, object]) -> str: f"Unique links checked: **{report['links_checked']}** ", f"Markdown occurrences: **{report['occurrences']}** ", f"Failures: **{len(failures)}**", + f"Inconclusive or restricted responses: **{len(inconclusive)}**", "", ] if failures: @@ -349,7 +360,12 @@ def render_markdown(report: dict[str, object]) -> str: ) lines.append(f"| {item['url']} | {item['error']} | {locations} |") else: - lines.append("All external Markdown links passed the configured status policy.") + lines.append("No confirmed external Markdown link failures.") + if inconclusive: + lines.extend(["", "## Inconclusive or restricted responses", "", "| URL | Classification | HTTP status | Source |", "|---|---|---:|---|"]) + for item in inconclusive: + locations = ", ".join(f"`{entry['path']}:{entry['line']}`" for entry in item["occurrences"]) + lines.append(f"| {item['url']} | {item['classification']} | {item['status'] or '—'} | {locations} |") lines.append("") return "\n".join(lines) diff --git a/scripts/check-readme-render.sh b/scripts/check-readme-render.sh index 0338813c4..1b04d1e8d 100755 --- a/scripts/check-readme-render.sh +++ b/scripts/check-readme-render.sh @@ -18,20 +18,18 @@ # 11. Bare [text] without a URL — GitHub blanks these out # 12. Raw angle brackets outside code blocks — parsed as HTML, text hidden # -# Cross-platform / mobile rendering checks (GitHub Android app + all browser engines): +# Cross-platform / mobile heuristics (advisories only; verify per provider/client/version): # -# 13. — CSS align stripped by GFM; images stack vertically on mobile -# 14. with no alt text — screen readers and some mobile parsers skip these -# 15. Image URLs with uppercase extensions (.PNG/.JPG/.GIF/.SVG) — Android URL -# parser is case-sensitive and fails to load the image -# 16. Image URLs with unencoded spaces — Android app does not auto-encode spaces -# 17.
layout blocks — stripped by GFM sanitiser on all platforms; content lost -# 18. / / inside table cells — mobile parser memory pressure / -# rendering failure; also broken in some WebKit versions -# 19. Wide tables (> 5 data columns) — no horizontal scroll on mobile; content cut off -# 20. Very long lines (> 500 chars outside code) — mobile parser memory pressure -# 21. Deeply nested
blocks (> 2 levels) — crashes GitHub Android app parser -# 22. SVG src not from raw.githubusercontent.com or camo — CSP-blocked on Android +# 13. — layout behavior is provider/client-specific +# 14. with no alt text — accessibility advisory +# 15. Image URLs with uppercase extensions — asset behavior is host/client-specific +# 16. Image URLs with unencoded spaces — URL handling may vary by target +# 17.
layout blocks — sanitization is provider/surface-specific +# 18. / / inside table cells — target rendering needs verification +# 19. Wide tables (> 5 data columns) — responsive behavior needs viewport testing +# 20. Very long lines (> 500 chars outside code) — wrapping/layout heuristic +# 21. Deeply nested
blocks (> 2 levels) — target behavior needs testing +# 22. External image hosts — verify redirects, content type and client policy # 23. Markdown image syntax with non-lowercase extension — same case-sensitivity issue # # Usage: @@ -238,7 +236,7 @@ _img_align_re=']* align=' for (( i=0; i — align attribute stripped by GFM; images stack on mobile") + WARNINGS+=("line $(( i+1 )): — align attribute detected; rendering is target-specific and needs verification") fi done @@ -250,14 +248,14 @@ for (( i=0; i]+>' || true) done # ── 15 & 23. Image URLs with uppercase extensions ───────────────────────────── # Covers both and ![alt](url) syntax. -# Android's URL parser is case-sensitive; .PNG/.JPG/.SVG fail to load. +# Uppercase extensions are flagged for inspection; do not infer client failure. for (( i=0; i/dev/null || true) done @@ -288,17 +286,17 @@ for (( i=0; i/dev/null || true) done # ── 17.
layout blocks ─────────────────────────────────────────────────── -# GFM sanitiser strips
on all platforms; any content inside is lost. +#
handling is provider/surface-specific; flag for target verification. for (( i=0; i]'; then - WARNINGS+=("line $(( i+1 )):
block — stripped by GFM sanitiser on all platforms; use plain Markdown instead") + WARNINGS+=("line $(( i+1 )):
block — HTML sanitization is provider-specific; consider a portable Markdown fallback") fi done @@ -308,7 +306,7 @@ for (( i=0; i// inside table cell — causes rendering failure on GitHub Android app and some WebKit versions") + WARNINGS+=("line $(( i+1 )): // inside table cell — client-specific rendering needs verification; consider a portable Markdown fallback") fi done @@ -322,7 +320,7 @@ for (( i=0; i 5 )); then - WARNINGS+=("line $(( i+1 )): table has ${col_count} columns — overflows on mobile (no horizontal scroll); consider splitting or simplifying") + WARNINGS+=("line $(( i+1 )): table has ${col_count} columns — may overflow narrow viewports; inspect target viewport and consider simplifying") fi done @@ -333,7 +331,7 @@ for (( i=0; i500 chars)") + WARNINGS+=("line $(( i+1 )): line is ${#line} chars — long line may wrap poorly; inspect target viewport (heuristic only)") done # ── 21. Deeply nested
blocks (> 2 levels) ────────────────────────── @@ -344,7 +342,7 @@ for (( i=0; i 2 )); then - WARNINGS+=("line $(( i+1 )):
nested ${details_depth} levels deep — GitHub Android app parser crashes beyond 2 levels") + WARNINGS+=("line $(( i+1 )):
nested ${details_depth} levels deep — deep nesting may render inconsistently; verify the target client") fi fi if echo "$line" | grep -qP '
' && (( details_depth > 0 )); then @@ -352,10 +350,9 @@ for (( i=0; i/dev/null; then - WARNINGS+=("line $(( i+1 )): image from untrusted host '${host}' — may be CSP-blocked on GitHub Android app") +" "$host" "$KNOWN_IMG_HOSTS" 2>/dev/null; then + WARNINGS+=("line $(( i+1 )): image host '${host}' is outside the legacy advisory list — verify redirects, response content type and client policy") fi done < <(python3 -c "import re,sys; l=sys.argv[1]; [print(u) for u in re.findall(r'src=\"([^\"]+)', l)+re.findall(r'!\[[^\]]*\]\(([^) ]+)', l)]" "$line" 2>/dev/null || true) done diff --git a/scripts/directory_inventory.py b/scripts/directory_inventory.py new file mode 100644 index 000000000..9ae4623be --- /dev/null +++ b/scripts/directory_inventory.py @@ -0,0 +1,94 @@ +"""Conservative path-only inventory for directories in a committed Git tree. + +Classification is heuristic metadata only. It never infers ownership, provenance, +source identity, license, or authorization from a path. +""" +from __future__ import annotations + +from collections import Counter +from pathlib import PurePosixPath +from typing import Any + +GENERATED_NAMES = { + "build", "dist", "out", "target", "node_modules", "__pycache__", + ".pytest_cache", ".mypy_cache", ".ruff_cache", "cache", "coverage", +} +SOURCE_CANDIDATE_NAMES = { + "src", "source", "app", "apps", "lib", "libs", "include", "cmd", "pkg", + "kernel", "drivers", "modules", +} + + +def classify_directory(path: str) -> str: + """Return a deliberately coarse path class; unknown is the safe default.""" + parts = PurePosixPath(path).parts + folded = tuple(part.casefold() for part in parts) + name = folded[-1] if folded else "" + if any(part in GENERATED_NAMES for part in folded): + return "generated_or_cache_candidate" + if any(part in {"vendor", "third_party", "third-party", "external"} for part in folded): + return "vendored_or_imported_candidate" + if any(part in {".github", ".gitlab", ".devcontainer", "config", "schema"} for part in folded): + return "configuration_and_automation" + if any(part in {"test", "tests", "spec", "specs"} for part in folded): + return "tests" + if any(part in {"doc", "docs", "documentation"} for part in folded): + return "documentation" + if any(part in {"scripts", "tools"} for part in folded): + return "first_party_tooling_candidate" + if name in SOURCE_CANDIDATE_NAMES: + return "source_candidate_unverified" + return "unclassified" + + +def inventory_directories(tree_entries: list[dict[str, Any]]) -> dict[str, Any]: + """Summarize tracked directory paths without reading or executing file content.""" + counts: dict[str, dict[str, int]] = {} + + def ensure_directory(path: str) -> dict[str, int]: + return counts.setdefault(path, {"tracked_entries": 0, "blobs": 0, "gitlinks": 0}) + + for entry in tree_entries: + path = entry.get("path") + if not isinstance(path, str) or not path or entry.get("type") == "tree": + continue + parts = PurePosixPath(path).parts + for index in range(1, len(parts)): + directory = "/".join(parts[:index]) + record = ensure_directory(directory) + record["tracked_entries"] += 1 + if entry.get("type") == "blob": + record["blobs"] += 1 + if entry.get("mode") == "160000": + record["gitlinks"] += 1 + + # A gitlink is itself a tracked directory boundary in the parent tree. + # Include that path as a directory, not only its containing directory. + if entry.get("mode") == "160000": + record = ensure_directory(path) + record["tracked_entries"] += 1 + record["gitlinks"] += 1 + + directories = [] + class_counts: Counter[str] = Counter() + for path in sorted(counts): + classification = classify_directory(path) + class_counts[classification] += 1 + directories.append({ + "path": path, + **counts[path], + "classification": classification, + "ownership": "unassigned", + "provenance": "unknown", + "classification_is_heuristic": True, + }) + return { + "directory_count": len(directories), + "classification_counts": dict(sorted(class_counts.items())), + "directories": directories, + "limitations": [ + "Path classification is heuristic and is not proof of content type.", + "Directory ownership and source provenance remain unassigned/unknown.", + "Generated, vendored, and source candidates require content and manifest review.", + ], + } diff --git a/scripts/external_services.py b/scripts/external_services.py new file mode 100644 index 000000000..de42843fe --- /dev/null +++ b/scripts/external_services.py @@ -0,0 +1,91 @@ +"""Provider-neutral classification for external service checks. + +Access restrictions describe the request, not necessarily the destination. +This module never attempts to bypass authentication, CAPTCHA, bot protection, +access controls, or provider terms. +""" +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime, timezone +from email.utils import parsedate_to_datetime +from enum import Enum +from typing import Mapping + + +class Outcome(str, Enum): + REACHABLE = "reachable" + NOT_FOUND = "not_found" + BLOCKED_OR_RESTRICTED = "blocked_or_restricted" + RATE_LIMITED = "rate_limited" + TRANSIENT_FAILURE = "transient_failure" + INVALID_DESTINATION = "invalid_destination" + INDETERMINATE = "indeterminate" + + +@dataclass(frozen=True) +class ServiceResult: + outcome: Outcome + status: int | None = None + retryable: bool = False + reason: str = "" + + +def classify_http_status(status: int) -> ServiceResult: + if 200 <= status < 400: + return ServiceResult(Outcome.REACHABLE, status, reason="successful response") + if status in {404, 410}: + return ServiceResult(Outcome.NOT_FOUND, status, reason="destination not found") + if status in {401, 403, 407}: + return ServiceResult( + Outcome.BLOCKED_OR_RESTRICTED, status, + reason="remote service restricted this request; destination validity is unknown", + ) + if status == 429: + return ServiceResult( + Outcome.RATE_LIMITED, status, retryable=True, + reason="remote service rate-limited this request", + ) + if status in {408, 425, 500, 502, 503, 504}: + return ServiceResult( + Outcome.TRANSIENT_FAILURE, status, retryable=True, + reason="temporary HTTP failure", + ) + if 400 <= status < 500: + return ServiceResult(Outcome.INDETERMINATE, status, reason="unclassified client response") + if 500 <= status < 600: + return ServiceResult(Outcome.TRANSIENT_FAILURE, status, retryable=True, reason="server-side failure") + return ServiceResult(Outcome.INDETERMINATE, status, reason="unexpected HTTP status") + + +def classify_transport_failure(reason: str = "") -> ServiceResult: + return ServiceResult(Outcome.TRANSIENT_FAILURE, retryable=True, reason=reason or "transport failure") + + +def retry_after_seconds(headers: Mapping[str, str] | None, now: datetime | None = None) -> float | None: + """Parse Retry-After delta-seconds or HTTP-date; None means absent/invalid.""" + if not headers: + return None + raw = next((value for key, value in headers.items() if key.casefold() == "retry-after"), None) + if raw is None: + return None + try: + return max(0.0, float(raw.strip())) + except (TypeError, ValueError): + pass + try: + target = parsedate_to_datetime(raw) + if target.tzinfo is None: + target = target.replace(tzinfo=timezone.utc) + current = now or datetime.now(timezone.utc) + if current.tzinfo is None: + current = current.replace(tzinfo=timezone.utc) + return max(0.0, (target - current).total_seconds()) + except (TypeError, ValueError, OverflowError): + return None + + +def is_non_blocking_outcome(outcome: Outcome | str) -> bool: + return Outcome(outcome) in { + Outcome.BLOCKED_OR_RESTRICTED, Outcome.RATE_LIMITED, Outcome.INDETERMINATE, + } diff --git a/scripts/includes/readme-badges.sh b/scripts/includes/readme-badges.sh index 3b5ec13ed..3d80fb125 100644 --- a/scripts/includes/readme-badges.sh +++ b/scripts/includes/readme-badges.sh @@ -11,6 +11,7 @@ README_AGENT_BADGE_TOOL="${_README_BADGES_DIR}/../agent-badge-registry.py" README_AGENT_BADGE_CONFIG="${README_AGENT_BADGE_CONFIG:-${_README_BADGES_DIR}/../../config/ai-agent-badges.json}" README_AGENT_BADGE_MARKER=$(python3 "$README_AGENT_BADGE_TOOL" \ --config "$README_AGENT_BADGE_CONFIG" required-marker) || return 1 +[[ -n "$README_AGENT_BADGE_MARKER" ]] || return 1 README_KDE_ECO_BADGE="[![KDE Eco](https://img.shields.io/badge/KDE%20Eco-certified-brightgreen?logo=kde&logoColor=white&style=flat-square)](https://eco.kde.org/)" README_BLUE_ANGEL_BADGE="[![Blue Angel](https://img.shields.io/badge/Blue%20Angel-DE--UZ%20215-0055a4?style=flat-square)](https://www.blauer-engel.de/en/certification/criteria)" diff --git a/scripts/linktree_engine.py b/scripts/linktree_engine.py new file mode 100644 index 000000000..c4d355a5d --- /dev/null +++ b/scripts/linktree_engine.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 +"""Provider-neutral link-in-bio profile validation and static-site rendering. + +This core is deliberately offline and dependency-free. Network auditing and +publishing are separate adapters; URL checks must use external_services.py. +""" +from __future__ import annotations +import argparse, html, json, re, sys +from pathlib import Path +from urllib.parse import urlsplit + +SLUG = re.compile(r"^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$") +IDENTIFIER = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$") +COLOR = re.compile(r"^#[0-9a-fA-F]{6}$") + +def _valid_web_url(value: object) -> bool: + if not isinstance(value, str) or not value or any(ord(c) < 32 for c in value): + return False + try: + parsed = urlsplit(value) + return parsed.scheme.lower() in {"https", "http"} and bool(parsed.hostname) and parsed.username is None and parsed.password is None and not any(c.isspace() for c in value) + except ValueError: + return False + +def validate_profile(profile: object) -> list[str]: + """Return all validation errors; an empty list means the profile is valid.""" + errors: list[str] = [] + if not isinstance(profile, dict): + return ["profile must be a JSON object"] + if profile.get("schema_version") != 1: + errors.append("schema_version must be 1") + slug = profile.get("slug") + if not isinstance(slug, str) or not SLUG.fullmatch(slug): + errors.append("slug must be lowercase alphanumeric words separated by single hyphens") + name = profile.get("name") + if not isinstance(name, str) or not name.strip() or len(name) > 120: + errors.append("name must be a non-empty string of at most 120 characters") + bio = profile.get("bio", "") + if not isinstance(bio, str) or len(bio) > 500: + errors.append("bio must be a string of at most 500 characters") + locale = profile.get("locale", "en") + if not isinstance(locale, str) or not re.fullmatch(r"[a-z]{2,3}(?:-[A-Z]{2})?", locale): + errors.append("locale must be a language tag such as en or en-CA") + if profile.get("avatar_url") is not None and not _valid_web_url(profile["avatar_url"]): + errors.append("avatar_url must be an absolute HTTP(S) URL without embedded credentials") + theme = profile.get("theme", {}) + if not isinstance(theme, dict): + errors.append("theme must be an object") + else: + for key in ("background", "foreground", "accent"): + if key in theme and (not isinstance(theme[key], str) or not COLOR.fullmatch(theme[key])): + errors.append(f"theme.{key} must be a six-digit hexadecimal color") + links = profile.get("links") + if not isinstance(links, list) or not links: + errors.append("links must be a non-empty array") + links = [] + seen_ids: set[str] = set() + for index, link in enumerate(links): + prefix = f"links[{index}]" + if not isinstance(link, dict): + errors.append(f"{prefix} must be an object") + continue + identifier = link.get("id") + if not isinstance(identifier, str) or not IDENTIFIER.fullmatch(identifier): + errors.append(f"{prefix}.id must be a 1-64 character identifier") + elif identifier in seen_ids: + errors.append(f"{prefix}.id must be unique") + else: + seen_ids.add(identifier) + label = link.get("label") + if not isinstance(label, str) or not label.strip() or len(label) > 100: + errors.append(f"{prefix}.label must be a non-empty string of at most 100 characters") + if not _valid_web_url(link.get("url")): + errors.append(f"{prefix}.url must be an absolute HTTP(S) URL without embedded credentials") + description = link.get("description", "") + if not isinstance(description, str) or len(description) > 240: + errors.append(f"{prefix}.description must be a string of at most 240 characters") + position = link.get("position", index) + if not isinstance(position, int) or isinstance(position, bool) or position < 0: + errors.append(f"{prefix}.position must be a non-negative integer") + analytics = profile.get("analytics", {"provider": "none"}) + if not isinstance(analytics, dict) or analytics.get("provider", "none") != "none": + errors.append("analytics.provider must be none in the core renderer; analytics adapters are not enabled") + return errors + +def render_profile(profile: dict) -> tuple[str, str]: + """Render an accessible static page and separate stylesheet.""" + errors = validate_profile(profile) + if errors: + raise ValueError("; ".join(errors)) + esc = lambda value: html.escape(str(value), quote=True) + theme = profile.get("theme", {}) + background, foreground, accent = (theme.get("background", "#101827"), theme.get("foreground", "#f8fafc"), theme.get("accent", "#7dd3fc")) + avatar = profile.get("avatar_url") + avatar_html = f'{esc(profile.get(' if avatar else "" + links = sorted(profile["links"], key=lambda item: (item.get("position", 0), item["id"])) + link_html = [] + for item in links: + detail = f'{esc(item["description"])}' if item.get("description") else "" + link_html.append(f'
  • {esc(item["label"])}{detail}
  • ') + title, bio = esc(profile["name"]), esc(profile.get("bio", "")) + document = f""" + + + + + + + +{title} + + + + +
    +
    {avatar_html}

    {title}

    {bio}

    + +
    + + +""" + stylesheet = f""":root {{ + color-scheme: light dark; + --background: {background}; + --foreground: {foreground}; + --accent: {accent}; + font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; +}} +* {{ box-sizing: border-box; }} +body {{ margin: 0; min-height: 100vh; background: var(--background); color: var(--foreground); }} +.profile {{ width: min(100% - 2rem, 42rem); margin: 0 auto; padding: 3rem 0; }} +.profile-header {{ text-align: center; margin-bottom: 2rem; }} +.avatar {{ width: 7rem; height: 7rem; object-fit: cover; border-radius: 50%; }} +h1 {{ margin: 1rem 0 .5rem; font-size: clamp(1.8rem, 6vw, 2.5rem); }} +.bio {{ line-height: 1.6; }} +.links {{ list-style: none; padding: 0; display: grid; gap: .8rem; }} +.link {{ display: grid; gap: .25rem; padding: 1rem 1.2rem; border: 1px solid currentColor; border-radius: .8rem; color: var(--foreground); text-decoration: none; }} +.link:hover, .link:focus-visible {{ outline: 2px solid var(--accent); outline-offset: 2px; }} +.description {{ font-size: .9rem; opacity: .8; }} +.skip-link {{ position: absolute; left: -9999px; }} +.skip-link:focus {{ left: 1rem; top: 1rem; z-index: 1; padding: .6rem; background: var(--background); color: var(--foreground); }} +@media (prefers-reduced-motion: reduce) {{ *, *::before, *::after {{ scroll-behavior: auto !important; transition: none !important; }} }} +""" + return document, stylesheet + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + sub = parser.add_subparsers(dest="command", required=True) + validate = sub.add_parser("validate", help="validate a canonical profile JSON file") + validate.add_argument("profile", type=Path) + render = sub.add_parser("render", help="render a canonical profile to a static directory") + render.add_argument("profile", type=Path) + render.add_argument("--output", type=Path, required=True) + args = parser.parse_args(argv) + try: + profile = json.loads(args.profile.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError) as exc: + print(f"error: cannot read profile JSON: {exc}", file=sys.stderr) + return 2 + errors = validate_profile(profile) + if errors: + for error in errors: + print(f"error: {error}", file=sys.stderr) + return 1 + if args.command == "validate": + print(f"valid profile: {profile['slug']}") + return 0 + try: + page, stylesheet = render_profile(profile) + args.output.mkdir(parents=True, exist_ok=True) + (args.output / "index.html").write_text(page, encoding="utf-8") + (args.output / "style.css").write_text(stylesheet, encoding="utf-8") + except OSError as exc: + print(f"error: cannot write output: {exc}", file=sys.stderr) + return 2 + print(f"rendered {profile['slug']} to {args.output}") + return 0 + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/manage-subtrees.sh b/scripts/manage-subtrees.sh index b7622bbf8..4221d2f91 100755 --- a/scripts/manage-subtrees.sh +++ b/scripts/manage-subtrees.sh @@ -23,7 +23,7 @@ set -uo pipefail MANIFEST="${MANIFEST:-config/subtree-manifest.yml}" DRY_RUN="${DRY_RUN:-false}" -CMD="${1:-sync}" +CMD="${1:-status}" info() { echo "[manage-subtrees] $*" >&2; } ok() { echo "[manage-subtrees][ok] $*" >&2; } @@ -314,6 +314,14 @@ else: " 2>/dev/null || true } +# Fail closed: this legacy writer has not yet been redesigned around +# immutable authorized plans, expected-old-state checks, and exact path allowlists. +# Keep status available; reject every mutation command before dispatch. +case "$CMD" in + status) ;; + *) fail "Mutation command '$CMD' is disabled pending writer-safety remediation; use status only." 2 ;; +esac + # ── Dispatch ────────────────────────────────────────────────────────────────── case "$CMD" in sync) diff --git a/scripts/plan-submodule-repairs.py b/scripts/plan-submodule-repairs.py new file mode 100644 index 000000000..fddda216e --- /dev/null +++ b/scripts/plan-submodule-repairs.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python3 +"""Generate deterministic, non-mutating review plans from a remote inventory JSON report. + +This tool never calls a network API, checks out source, initializes submodules, or +writes to repositories. It only reads an inventory JSON file and writes a plan. +Every finding is bound to the exact repository HEAD/tree and declaration/gitlink +evidence that was observed by the inventory scanner. +""" +from __future__ import annotations + +import argparse +import configparser +import hashlib +import json +import sys +from pathlib import PurePosixPath +from typing import Any +from urllib.parse import urlsplit, urlunsplit + + +def canonical_url(value: str) -> str: + """Normalize transport/host only; preserve case-sensitive URL path data.""" + value = value.strip() + if value.startswith("git@github.com:"): + value = "https://github.com/" + value.split(":", 1)[1] + elif value.startswith("ssh://git@github.com/"): + value = "https://github.com/" + value.split("/", 3)[-1] + parsed = urlsplit(value) + if not parsed.scheme or not parsed.netloc: + return value.rstrip("/").removesuffix(".git") + scheme = parsed.scheme.casefold() + host = (parsed.hostname or "").casefold() + try: + port = parsed.port + except ValueError: + return value + if port and not ((scheme == "https" and port == 443) or (scheme == "http" and port == 80)): + host = f"{host}:{port}" + path = parsed.path.rstrip("/") + if path.endswith(".git"): + path = path[:-4] + return urlunsplit((scheme, host, path, parsed.query, parsed.fragment)) + + +def parse_declarations(content: str | None) -> tuple[list[dict[str, str]], list[str]]: + if not content: + return [], [] + parser = configparser.ConfigParser(interpolation=None, strict=False, delimiters=("=",)) + parser.optionxform = str.lower + try: + parser.read_string(content) + except configparser.Error as exc: + return [], [f"invalid_gitmodules:{exc}"] + declarations: list[dict[str, str]] = [] + errors: list[str] = [] + seen_paths: set[str] = set() + for section in parser.sections(): + if not section.startswith('submodule "') or not section.endswith('"'): + continue + name = section[len('submodule "'):-1] + path = parser.get(section, "path", fallback="").strip() + url = parser.get(section, "url", fallback="").strip() + if not path or not url: + errors.append(f"declaration_missing_path_or_url:{name}") + continue + p = PurePosixPath(path) + if p.is_absolute() or ".." in p.parts or path in {".", ""}: + errors.append(f"unsafe_declaration_path:{path}") + continue + if path in seen_paths: + errors.append(f"duplicate_declaration_path:{path}") + seen_paths.add(path) + declarations.append({"name": name, "path": path, "url": url}) + return sorted(declarations, key=lambda x: (x["path"], x["name"], x["url"])), sorted(errors) + + +def plan_repository(record: dict[str, Any]) -> dict[str, Any]: + repository = record.get("repository") + head, tree = record.get("head"), record.get("tree") + status = record.get("status") + gm = record.get("gitmodules") or {} + links = record.get("gitlinks") + evidence_complete = ( + status in {"complete", "warning"} + and isinstance(repository, str) and bool(repository) + and isinstance(head, str) and bool(head) + and isinstance(tree, str) and bool(tree) + and isinstance(links, list) + and isinstance(gm, dict) and gm.get("error") is None + ) + if not evidence_complete: + return { + "repository": repository, + "status": "blocked", + "reason": "Inventory evidence is incomplete or inaccessible; no repair suggestions generated.", + "expected_old_state": {"head": head, "tree": tree, "gitmodules_blob_sha": gm.get("blob_sha")}, + "suggestions": [], + } + + declarations, parse_errors = parse_declarations(gm.get("content")) + if parse_errors: + return { + "repository": repository, + "status": "blocked", + "reason": "The .gitmodules evidence could not be parsed safely.", + "parse_errors": parse_errors, + "expected_old_state": {"head": head, "tree": tree, "gitmodules_blob_sha": gm.get("blob_sha")}, + "suggestions": [], + } + + link_by_path: dict[str, str] = {} + for link in links: + if not isinstance(link, dict) or not isinstance(link.get("path"), str) or not isinstance(link.get("commit"), str): + return { + "repository": repository, "status": "blocked", + "reason": "Malformed gitlink evidence; no suggestions generated.", + "expected_old_state": {"head": head, "tree": tree, "gitmodules_blob_sha": gm.get("blob_sha")}, + "suggestions": [], + } + if link["path"] in link_by_path: + return { + "repository": repository, "status": "blocked", + "reason": "Duplicate gitlink paths; no suggestions generated.", + "expected_old_state": {"head": head, "tree": tree, "gitmodules_blob_sha": gm.get("blob_sha")}, + "suggestions": [], + } + link_by_path[link["path"]] = link["commit"] + + decl_by_path: dict[str, dict[str, str]] = {} + for declaration in declarations: + if declaration["path"] in decl_by_path: + return { + "repository": repository, "status": "blocked", + "reason": "Duplicate declaration paths; no suggestions generated.", + "expected_old_state": {"head": head, "tree": tree, "gitmodules_blob_sha": gm.get("blob_sha")}, + "suggestions": [], + } + decl_by_path[declaration["path"]] = declaration + + suggestions: list[dict[str, Any]] = [] + for path in sorted(set(decl_by_path) | set(link_by_path)): + declaration = decl_by_path.get(path) + gitlink_sha = link_by_path.get(path) + if declaration and not gitlink_sha: + code = "declaration_without_gitlink" + rationale = "A .gitmodules declaration exists but the committed tree has no mode-160000 gitlink." + elif gitlink_sha and not declaration: + code = "gitlink_without_declaration" + rationale = "A mode-160000 gitlink exists but no matching .gitmodules declaration was found." + else: + continue + suggestions.append({ + "code": code, + "path": path, + "review_action": "human_review_required", + "rationale": rationale, + "observed_declaration": declaration, + "observed_gitlink_sha": gitlink_sha, + "proposed_mutation": None, + }) + + # URL mismatches are not inferred from a gitlink: Git tree entries carry no URL. + # This generator intentionally does not guess repository identity or desired pins. + status_out = "review_required" if suggestions else "no_structural_drift_detected" + return { + "repository": repository, + "status": status_out, + "expected_old_state": { + "head": head, + "tree": tree, + "gitmodules_blob_sha": gm.get("blob_sha"), + "gitlink_paths_and_shas": [{"path": p, "commit": link_by_path[p]} for p in sorted(link_by_path)], + }, + "suggestions": suggestions, + "safety": { + "review_only": True, + "proposed_mutation_is_null": True, + "no_repository_writes": True, + "no_submodule_init_or_fetch": True, + "no_pin_or_directory_changes": True, + "no_authorization_granted": True, + }, + } + + +def build_plan(report: dict[str, Any]) -> dict[str, Any]: + if report.get("read_only") is not True or not isinstance(report.get("repositories"), list): + raise ValueError("Input must be a read-only registered-consumer inventory report") + plans = [plan_repository(x) for x in report["repositories"] if isinstance(x, dict)] + plans.sort(key=lambda x: str(x.get("repository", ""))) + identity = { + "inventory_schema_version": report.get("schema_version"), + "registry": report.get("registry"), + "repositories": [{ + "repository": x.get("repository"), + "head": x.get("expected_old_state", {}).get("head"), + "tree": x.get("expected_old_state", {}).get("tree"), + "status": x.get("status"), + "suggestions": x.get("suggestions", []), + } for x in plans], + } + digest = hashlib.sha256(json.dumps(identity, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + return { + "schema_version": 1, + "plan_id": "sha256:" + digest, + "source_inventory_generated_at": report.get("generated_at"), + "source_registry": report.get("registry"), + "read_only": True, + "plan_only": True, + "repository_count": len(plans), + "review_required": sum(1 for x in plans if x["status"] in {"review_required", "blocked"}), + "suggestion_count": sum(len(x.get("suggestions", [])) for x in plans), + "repositories": plans, + "safety": { + "no_network_access": True, + "no_repository_writes": True, + "no_submodule_initialization_or_fetch": True, + "no_source_execution": True, + "no_authorization_or_mutation": True, + "revalidate_expected_old_state_before_any_future_action": True, + }, + } + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--inventory", required=True, help="Read-only inventory JSON input") + parser.add_argument("--json-out", required=True) + parser.add_argument("--markdown-out", required=True) + args = parser.parse_args() + try: + with open(args.inventory, encoding="utf-8") as stream: + report = json.load(stream) + plan = build_plan(report) + except (OSError, json.JSONDecodeError, ValueError) as exc: + print(f"plan generation failed: {exc}", file=sys.stderr) + return 2 + with open(args.json_out, "w", encoding="utf-8") as stream: + json.dump(plan, stream, indent=2, sort_keys=True) + stream.write("\n") + lines = [ + "# Deterministic submodule repair review plan", "", + f"- Plan ID: `{plan['plan_id']}`", + f"- Source inventory: {plan.get('source_inventory_generated_at') or 'unknown'}", + f"- Repositories: {plan['repository_count']}", + f"- Review required: {plan['review_required']}", + f"- Suggestions: {plan['suggestion_count']}", + "- Mutations: none", "", + "## Repository results", "", + "| Repository | Status | Suggestions | Expected HEAD |", + "|---|---|---:|---|", + ] + for item in plan["repositories"]: + old = item.get("expected_old_state", {}) + lines.append(f"| {item.get('repository', 'unknown')} | {item['status']} | {len(item.get('suggestions', []))} | {old.get('head') or '—'} |") + lines += ["", "## Review suggestions", ""] + for item in plan["repositories"]: + for suggestion in item.get("suggestions", []): + lines.append(f"- **{item['repository']}** `{suggestion['code']}` at `{suggestion['path']}`: {suggestion['rationale']}") + if plan["suggestion_count"] == 0: + lines.append("- No declaration/gitlink structural drift detected in complete evidence.") + lines += ["", "## Safety", "", + "This artifact is a review aid, not an execution plan. It contains no proposed mutations.", + "It grants no authorization and performs no network access, repository writes, source execution,", + "submodule initialization/fetch, pin updates, directory changes, or mirror propagation.", + "Any future action must revalidate the exact expected HEAD, tree, .gitmodules blob, and gitlink state", + "and pass through the common authorization and review lifecycle."] + with open(args.markdown_out, "w", encoding="utf-8") as stream: + stream.write("\n".join(lines) + "\n") + print(json.dumps({"plan_id": plan["plan_id"], "review_required": plan["review_required"], + "suggestion_count": plan["suggestion_count"]}, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/tests/test-check-readme-render-mobile.sh b/scripts/tests/test-check-readme-render-mobile.sh index b984b65c2..d5c15ca2e 100755 --- a/scripts/tests/test-check-readme-render-mobile.sh +++ b/scripts/tests/test-check-readme-render-mobile.sh @@ -55,7 +55,7 @@ echo "" # ── Check 13: ─────────────────────────────────────────────── run_test "13-img-align-detected" \ 'logo' \ - "align attribute stripped by GFM" + "align attribute detected" run_test "13-img-no-align-clean" \ 'logo' \ @@ -100,7 +100,7 @@ run_test "16-img-url-encoded-space-clean" \ # ── Check 17:
    layout blocks ──────────────────────────────────────────── run_test "17-div-detected" \ '
    some content
    ' \ - "stripped by GFM sanitiser" + "HTML sanitization is provider-specific" run_test "17-no-div-clean" \ 'Some plain paragraph text.' \ @@ -122,7 +122,7 @@ run_test "19-wide-table-detected" \ '| A | B | C | D | E | F | |---|---|---|---|---|---| | 1 | 2 | 3 | 4 | 5 | 6 |' \ - "overflows on mobile" + "may overflow narrow viewports" run_test "19-narrow-table-clean" \ '| A | B | C | @@ -134,7 +134,7 @@ run_test "19-narrow-table-clean" \ LONG_LINE=$(python3 -c "print('x' * 501)") run_test "20-long-line-detected" \ "$LONG_LINE" \ - "mobile parser memory pressure" + "long line may wrap poorly" SHORT_LINE=$(python3 -c "print('x' * 100)") run_test "20-short-line-clean" \ @@ -163,7 +163,7 @@ content # ── Check 22: untrusted image host ─────────────────────────────────────────── run_test "22-untrusted-host-detected" \ '![logo](https://example.com/logo.png)' \ - "untrusted host" + "outside the legacy advisory list" run_test "22-trusted-host-raw-clean" \ '![logo](https://raw.githubusercontent.com/test/repo/main/logo.png)' \ diff --git a/scripts/trigger-readme-update.sh b/scripts/trigger-readme-update.sh index 23f9ea6f7..42726507d 100755 --- a/scripts/trigger-readme-update.sh +++ b/scripts/trigger-readme-update.sh @@ -2,32 +2,36 @@ # # trigger-readme-update.sh # -# Triggers update-readmes.yml for all OSP-bound repos (mirror + full + infra-core -# profiles) to fill in placeholder AI sections and inject any missing sections. +# Dispatches update-readmes.yml for selected OSP-bound template consumers. +# This script is also called by .github/workflows/trigger-readme-update.yml; +# keep its environment-input handling aligned with that workflow. # -# ── Dev utility ─────────────────────────────────────────────────────────────── -# This is a local dev tool — not called by any workflow. Run it manually -# after a rate-limit reset to batch-dispatch README updates across all -# OSP-bound repos without having to trigger each one individually from -# the GitHub Actions UI. -# -# Run this after the GitHub API rate limit resets (check with: gh api rate_limit). +# Safety: +# - DRY_RUN from the workflow environment is honored (and --dry-run forces it). +# - force_rewrite is always false: this dispatcher must never strip AI:skip +# markers or migrate static/human-authored READMEs. +# - README.md is globally excluded from template sync in any case. # # Usage: -# GH_TOKEN=ghp_... bash scripts/trigger-readme-update.sh [--dry-run] -# -# With --dry-run: triggers the workflow in dry_run mode (detects stale sections -# without writing changes — useful to audit scope first). +# GH_TOKEN=... bash scripts/trigger-readme-update.sh [--dry-run] # set -uo pipefail : "${GH_TOKEN:?GH_TOKEN is required}" -DRY_RUN="false" +DRY_RUN="${DRY_RUN:-false}" [[ "${1:-}" == "--dry-run" ]] && DRY_RUN="true" +PROFILE="${PROFILE:-all}" + +case "$PROFILE" in + all|mirror|full|infra-core) ;; + *) + echo "Unsupported PROFILE '$PROFILE' (expected all, mirror, full, or infra-core)." >&2 + exit 2 + ;; +esac OWNER="Interested-Deving-1896" -REPO="fork-sync-all" WORKFLOW="update-readmes.yml" API="https://api.github.com" @@ -52,45 +56,51 @@ if [[ "$remaining" -lt 10 ]]; then exit 1 fi -# ── Build repo list from template-consumers.yml ─────────────────────────────── +# ── Build repo list from the template-consumer registry ─────────────────────── echo "" -echo "Reading OSP-bound repos from config/template-consumers.yml..." +echo "Reading OSP-bound repos from config/template-consumers.yml (profile: ${PROFILE})..." -mapfile -t OSP_REPOS < <(python3 -c " +mapfile -t OSP_REPOS < <(python3 - "$PROFILE" <<'PYEOF' import sys -with open('config/template-consumers.yml') as f: +profile = sys.argv[1] +allowed = { + "all": {"full", "mirror", "infra-core"}, + "mirror": {"mirror"}, + "full": {"full"}, + "infra-core": {"infra-core"}, +}[profile] + +with open("config/template-consumers.yml", encoding="utf-8") as f: content = f.read() consumers = [] current = {} for line in content.splitlines(): - s = line.strip() - if s.startswith('- name:'): + stripped = line.strip() + if stripped.startswith("- name:"): if current: consumers.append(current) - current = {'name': s.split(':', 1)[1].strip(), 'profile': 'full'} - elif s.startswith('profile:') and current: - current['profile'] = s.split(':', 1)[1].strip() - elif s.startswith('disabled: true') and current: - current['disabled'] = True + current = {"name": stripped.split(":", 1)[1].strip(), "profile": "full"} + elif stripped.startswith("profile:") and current: + current["profile"] = stripped.split(":", 1)[1].strip() + elif stripped == "disabled: true" and current: + current["disabled"] = True if current: consumers.append(current) -for c in consumers: - if c.get('disabled'): +for consumer in consumers: + if consumer.get("disabled"): continue - if c.get('profile', 'full') in ('full', 'mirror', 'infra-core'): - print(c['name']) -" 2>/dev/null) + if consumer.get("profile", "full") in allowed: + print(consumer["name"]) +PYEOF +) -echo " Found ${#OSP_REPOS[@]} OSP-bound repos" +echo " Found ${#OSP_REPOS[@]} matching repos" # ── Trigger workflow in batches ─────────────────────────────────────────────── -# update-readmes.yml accepts a space-separated 'repos' input. -# We trigger in batches of 10 to avoid hitting the input length limit and to -# allow each batch to run concurrently without overwhelming the Models API quota. BATCH_SIZE=10 total=${#OSP_REPOS[@]} @@ -98,7 +108,12 @@ batch_num=0 triggered=0 echo "" -[[ "$DRY_RUN" == "true" ]] && echo "DRY RUN MODE — workflow will detect but not write changes" +if [[ "$DRY_RUN" == "true" ]]; then + echo "DRY RUN MODE — dispatched workflows will detect changes without writing." +else + echo "LIVE MODE — dispatched workflows may update AI-owned sections and metadata." +fi +echo "Force rewrite is disabled for this dispatcher." echo "Triggering ${WORKFLOW} in batches of ${BATCH_SIZE}..." echo "" @@ -109,18 +124,21 @@ for (( i=0; i/dev/null || echo "$body")" fi - # Pace batches — avoid hammering the dispatch endpoint if (( i + BATCH_SIZE < total )); then echo " Waiting 5s before next batch..." sleep 5 @@ -152,7 +169,9 @@ echo "========================================" echo " README update trigger complete" echo " Repos targeted: ${total}" echo " Batches triggered: ${triggered}/${batch_num}" -[[ "$DRY_RUN" == "true" ]] && echo " Mode: DRY RUN (no writes)" +echo " Profile: ${PROFILE}" +echo " Dry run: ${DRY_RUN}" +echo " Force rewrite: false" echo "" echo " Monitor runs at:" echo " https://github.com/${OWNER}/${REPO}/actions/workflows/${WORKFLOW}" diff --git a/scripts/update-readmes.sh b/scripts/update-readmes.sh index 6d869c2d6..b446a2374 100755 --- a/scripts/update-readmes.sh +++ b/scripts/update-readmes.sh @@ -383,7 +383,7 @@ EOF else # Do not claim an audit workflow exists unless it has been verified. cat << EOF -No `accessibility-report.json` was found when this README was generated. Check the +No \`accessibility-report.json\` was found when this README was generated. Check the [Actions tab](${base}/actions) for repository-specific checks, and document an accessibility status only when a report or workflow provides evidence for it. diff --git a/scripts/validate-accessibility-integration.py b/scripts/validate-accessibility-integration.py new file mode 100644 index 000000000..574f0af20 --- /dev/null +++ b/scripts/validate-accessibility-integration.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Validate FSA's read-only accessibility/rendering/visual-evidence contract.""" +from __future__ import annotations +import json +import re +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +CONTRACT = ROOT / "config/accessibility/integration-contract.json" +TARGETS = ROOT / "config/rendering/presentation-targets.json" +FIXTURES = ROOT / "config/rendering/fixtures.json" +ID_RE = re.compile(r"^[a-z0-9][a-z0-9-]*$") +METHODS = {"static", "rendered-dom", "derived-output", "target-render", "capture", "live-session"} +LIVE_GATES = {"explicit_consent", "authenticated_viewer", "visible_indicator", "expiry", "revocation", "audit_event"} + +def load(path): + with path.open(encoding="utf-8") as stream: + return json.load(stream) + +def validate(contract, targets_doc, fixtures_doc): + errors = [] + if contract.get("schema_version") != "1.0.0": errors.append("schema_version must be 1.0.0") + if contract.get("mode") != "read-only": errors.append("mode must remain read-only") + orchestrator = contract.get("orchestrator", {}) + if orchestrator.get("workflow_group") != "accessibility": errors.append("must reuse accessibility workflow group") + if orchestrator.get("workflow") != ".github/workflows/check-accessibility.yml": errors.append("must reference existing accessibility workflow") + consumers = contract.get("consumers", {}) + if consumers.get("rendering", {}).get("issue") != 1160: errors.append("rendering consumer must bind to #1160") + capture = consumers.get("capture", {}) + if capture.get("issue") != 1174: errors.append("capture consumer must bind to #1174") + defaults = capture.get("defaults", {}) + for key in ("screenshot", "recording", "live_view", "audio"): + if defaults.get(key) is not False: errors.append(f"capture default {key} must be false") + if not LIVE_GATES <= set(capture.get("live_view_requires", [])): errors.append("live viewing is missing security gates") + actions = contract.get("actions", []) + if not isinstance(actions, list) or not actions: errors.append("actions must be a non-empty array"); actions = [] + seen = set() + for i, action in enumerate(actions): + if not isinstance(action, dict): errors.append(f"actions[{i}] must be an object"); continue + aid = action.get("id") + if not isinstance(aid, str) or not ID_RE.fullmatch(aid): errors.append(f"actions[{i}] has invalid id") + elif aid in seen: errors.append(f"duplicate action id: {aid}") + seen.add(aid) + if action.get("method") not in METHODS: errors.append(f"actions[{i}] has unsupported method") + if action.get("writes_repository") is not False: errors.append(f"actions[{i}] must not write to repository") + required = {"codeowners-audit","readme-structure","html-wcag-pa11y","axe-core","audio-overview","braille-output","rendering-compatibility","visual-screenshot","visual-recording","live-visual-session"} + for missing in sorted(required - seen): errors.append(f"missing action declaration: {missing}") + for aid in ("visual-screenshot","visual-recording","live-visual-session"): + item = next((a for a in actions if isinstance(a, dict) and a.get("id") == aid), None) + if item and item.get("enabled") is not False: errors.append(f"{aid} must remain disabled until verified") + media = contract.get("evidence", {}).get("media_policy", {}) + for key, expected in {"private_by_default":True,"redaction_required_before_sharing":True,"public_upload":False,"unbounded_recording":False,"baseline_auto_update":False}.items(): + if media.get(key) is not expected: errors.append(f"media_policy.{key} must be {str(expected).lower()}") + identity = {"commit_sha","workflow_run_id","target_profile_id","fixture_id","test_step_id"} + if not identity <= set(contract.get("evidence", {}).get("required_identity", [])): errors.append("evidence identity must correlate commit/run/target/fixture/test step") + if not any(isinstance(x, dict) and x.get("id") for x in targets_doc.get("targets", [])): errors.append("rendering target registry is empty") + if not any(isinstance(x, dict) and x.get("id") for x in fixtures_doc.get("fixtures", [])): errors.append("rendering fixture registry is empty") + policy = contract.get("status_policy", {}) + if policy.get("unknown_target_is_not_pass") is not True: errors.append("unknown target must never pass") + if policy.get("automated_scan_does_not_claim_full_wcag_conformance") is not True: errors.append("automated scans cannot claim full WCAG conformance") + return errors + +def main(): + try: contract, targets, fixtures = load(CONTRACT), load(TARGETS), load(FIXTURES) + except (OSError, json.JSONDecodeError) as exc: + print(f"accessibility integration validation: cannot load config: {exc}", file=sys.stderr); return 2 + errors = validate(contract, targets, fixtures) + if errors: + for error in errors: print(f"ERROR: {error}", file=sys.stderr) + return 1 + print(f"accessibility integration validation: OK ({len(contract['actions'])} actions; capture disabled by default)") + return 0 + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/validate-rendering-profiles.py b/scripts/validate-rendering-profiles.py new file mode 100644 index 000000000..ed23f000e --- /dev/null +++ b/scripts/validate-rendering-profiles.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Validate FSA presentation-target profiles and fixture references. + +Structural contract check only: this is not a renderer or device test. +""" +from __future__ import annotations +import json +import re +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +TARGETS = ROOT / "config/rendering/presentation-targets.json" +FIXTURES = ROOT / "config/rendering/fixtures.json" +STATUSES = {"verified", "partially-verified", "unsupported", "unknown", "stale"} +FEATURE_STATES = {"supported", "partial", "unsupported", "unknown"} +PROVIDERS = {"github", "gitlab", "gitea", "forgejo", "codeberg", "other"} +SURFACES = {"repository-readme", "issue", "pull-request", "wiki", "pages", "release-notes"} +CLIENTS = {"web", "mobile-web", "android", "ios"} +ID_RE = re.compile(r"^[a-z0-9][a-z0-9-]*$") +VERSION_RE = re.compile(r"^\d+\.\d+\.\d+$") + +def main() -> int: + errors = [] + try: + targets_doc = json.loads(TARGETS.read_text(encoding="utf-8")) + fixtures_doc = json.loads(FIXTURES.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError) as exc: + print(f"rendering-profile validation: cannot load registry: {exc}", file=sys.stderr) + return 2 + for label, doc in (("targets", targets_doc), ("fixtures", fixtures_doc)): + if not VERSION_RE.fullmatch(str(doc.get("schema_version", ""))): + errors.append(f"{label}: schema_version must be semantic x.y.z") + fixtures = fixtures_doc.get("fixtures") + if not isinstance(fixtures, list): + errors.append("fixtures: fixtures must be an array") + fixtures = [] + fixture_ids = set() + for index, fixture in enumerate(fixtures): + if not isinstance(fixture, dict): + errors.append(f"fixtures[{index}] must be an object") + continue + fid = fixture.get("id") + if not isinstance(fid, str) or not ID_RE.fullmatch(fid): + errors.append(f"fixtures[{index}]: invalid id") + elif fid in fixture_ids: + errors.append(f"fixtures[{index}]: duplicate id {fid}") + else: + fixture_ids.add(fid) + if fixture.get("evidence_class") not in {"static-fixture", "browser-observation", "device-observation"}: + errors.append(f"fixtures[{index}]: invalid evidence_class") + targets = targets_doc.get("targets") + if not isinstance(targets, list) or not targets: + errors.append("targets: targets must be a non-empty array") + targets = [] + target_ids = set() + for index, target in enumerate(targets): + if not isinstance(target, dict): + errors.append(f"targets[{index}] must be an object") + continue + tid = target.get("id") + if not isinstance(tid, str) or not ID_RE.fullmatch(tid): + errors.append(f"targets[{index}]: invalid id") + elif tid in target_ids: + errors.append(f"targets[{index}]: duplicate id {tid}") + else: + target_ids.add(tid) + for key, allowed in (("provider", PROVIDERS), ("surface", SURFACES), ("client", CLIENTS), ("status", STATUSES)): + if target.get(key) not in allowed: + errors.append(f"targets[{index}]: invalid {key}") + status = target.get("status") + if status in {"verified", "partially-verified", "unsupported"}: + if not target.get("tested_version"): + errors.append(f"targets[{index}]: {status} requires tested_version") + if not target.get("evidence"): + errors.append(f"targets[{index}]: {status} requires evidence") + evidence = target.get("evidence", []) + if not isinstance(evidence, list): + errors.append(f"targets[{index}]: evidence must be an array") + evidence = [] + for fid in evidence: + if fid not in fixture_ids: + errors.append(f"targets[{index}]: unknown fixture reference {fid}") + features = target.get("features", {}) + if not isinstance(features, dict): + errors.append(f"targets[{index}]: features must be an object") + continue + for feature, state in features.items(): + if state not in FEATURE_STATES: + errors.append(f"targets[{index}]: invalid state for feature {feature}") + if errors: + for error in errors: + print(f"ERROR: {error}", file=sys.stderr) + print(f"rendering-profile validation: {len(errors)} error(s)", file=sys.stderr) + return 1 + print(f"rendering-profile validation: OK ({len(targets)} targets, {len(fixtures)} fixtures; compatibility claims remain evidence-gated)") + return 0 + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/validate-workflows.sh b/scripts/validate-workflows.sh index 5951a70c1..ec7883913 100755 --- a/scripts/validate-workflows.sh +++ b/scripts/validate-workflows.sh @@ -180,6 +180,9 @@ ALLOWED_WORKFLOWS=( "list-active-runs.yml" "manage-repo-settings.yml" "manage-subtrees.yml" + "submodule-directory-audit.yml" # read-only submodule/gitlink/directory inventory + "registered-consumer-inventory.yml" # read-only registered-consumer submodule inventory + "declared-source-scope.yml" # read-only cross-registry declaration inventory "merge-ready-prs.yml" "mirror-chain-dispatch.yml" "mirror-flatpak.yml" diff --git a/tests/test_accessibility_integration.py b/tests/test_accessibility_integration.py new file mode 100644 index 000000000..74d4d6278 --- /dev/null +++ b/tests/test_accessibility_integration.py @@ -0,0 +1,33 @@ +import importlib.util +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("a11y_contract", ROOT / "scripts/validate-accessibility-integration.py") +MODULE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(MODULE) + +def docs(): + return MODULE.load(MODULE.CONTRACT), MODULE.load(MODULE.TARGETS), MODULE.load(MODULE.FIXTURES) + +def test_contract_validates(): + assert MODULE.validate(*docs()) == [] + +def test_capture_is_disabled_by_default(): + contract, targets, fixtures = docs() + contract["consumers"]["capture"]["defaults"]["live_view"] = True + assert any("capture default live_view" in e for e in MODULE.validate(contract, targets, fixtures)) + +def test_repository_write_is_rejected(): + contract, targets, fixtures = docs() + contract["actions"][0]["writes_repository"] = True + assert any("must not write" in e for e in MODULE.validate(contract, targets, fixtures)) + +def test_unknown_target_is_not_pass(): + contract, targets, fixtures = docs() + contract["status_policy"]["unknown_target_is_not_pass"] = False + assert any("unknown target must never pass" in e for e in MODULE.validate(contract, targets, fixtures)) + +def test_live_view_security_gates_are_required(): + contract, targets, fixtures = docs() + contract["consumers"]["capture"]["live_view_requires"].remove("explicit_consent") + assert any("missing security gates" in e for e in MODULE.validate(contract, targets, fixtures)) diff --git a/tests/test_agent_badge_registry.py b/tests/test_agent_badge_registry.py index f0eee0a87..13fedf42e 100644 --- a/tests/test_agent_badge_registry.py +++ b/tests/test_agent_badge_registry.py @@ -15,11 +15,16 @@ def test_registry_renders_universal_and_provider_badges(): rendered = REGISTRY.render(config, "https://github.com/example/project") assert "AI agent ready" in rendered + assert rendered.splitlines()[0].startswith("[![AI agent ready]") + assert rendered.splitlines()[1].startswith("[![Cohere models]") + assert "Cohere models" in rendered assert "Open in Codex" in rendered assert "Open in Claude Code" in rendered assert "Open in GitHub Copilot" in rendered assert "Open in Cursor" in rendered assert "Use with Gemini CLI" in rendered + assert config["providers"][0]["id"] == "cohere" + assert config["providers"][0]["kind"] == "model-provider" assert "ona.com" not in rendered diff --git a/tests/test_audit_registered_consumers.py b/tests/test_audit_registered_consumers.py new file mode 100644 index 000000000..e3b6b6dc9 --- /dev/null +++ b/tests/test_audit_registered_consumers.py @@ -0,0 +1,117 @@ +import base64 +import importlib.util +import tempfile +import unittest +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +SPEC = importlib.util.spec_from_file_location("remote_inventory", ROOT / "scripts" / "audit-registered-consumers.py") +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader +SPEC.loader.exec_module(MODULE) + +class RemoteInventoryTests(unittest.TestCase): + def test_unqualified_and_qualified_names_preserve_owner(self): + self.assertEqual(MODULE.resolve_repository("demo"), "Interested-Deving-1896/demo") + self.assertEqual(MODULE.resolve_repository("OtherOrg/demo"), "OtherOrg/demo") + + def test_invalid_names_are_rejected(self): + for name in ("", "/demo", "org/", "a/b/c"): + with self.subTest(name=name), self.assertRaises(ValueError): + MODULE.resolve_repository(name) + + def test_registry_metadata_is_preserved_and_duplicates_rejected(self): + with tempfile.TemporaryDirectory() as tmp: + path = Path(tmp) / "registry.yml" + path.write_text("consumers:\n - name: demo\n tier: protected\n disabled: true\n") + items = MODULE.load_consumers(path) + self.assertEqual(items[0]["tier"], "protected") + self.assertEqual(items[0]["repository"], "Interested-Deving-1896/demo") + path.write_text("consumers:\n - name: demo\n - name: Interested-Deving-1896/demo\n") + with self.assertRaises(ValueError): + MODULE.load_consumers(path) + + def test_disabled_entry_is_not_queried(self): + entry = {"name":"demo","repository":"Interested-Deving-1896/demo","disabled":True} + def unexpected(_): + raise AssertionError("disabled consumer must not be queried") + self.assertEqual(MODULE.inspect_consumer(entry, unexpected)["status"], "disabled") + + def test_inventory_pins_default_branch_head_and_gitlink(self): + calls = [] + gm = '[submodule "child"]\n\tpath = vendor/child\n' + blob = base64.b64encode(gm.encode()).decode() + def fake_get(path): + calls.append(path) + if path == "/repos/Interested-Deving-1896/demo": + return {"default_branch":"trunk","archived":False,"private":False} + if path == "/repos/Interested-Deving-1896/demo/commits/trunk": + return {"sha":"a"*40,"commit":{"tree":{"sha":"b"*40}}} + if path == "/repos/Interested-Deving-1896/demo/git/trees/" + "b"*40 + "?recursive=1": + return {"truncated":False,"tree":[ + {"path":".gitmodules","type":"blob","sha":"c"*40}, + {"path":"vendor/child","type":"commit","mode":"160000","sha":"d"*40}, + {"path":"src/main.py","type":"blob","mode":"100644","sha":"e"*40}]} + if path == "/repos/Interested-Deving-1896/demo/git/blobs/" + "c"*40: + return {"content":blob,"encoding":"base64"} + raise AssertionError(path) + entry={"name":"demo","repository":"Interested-Deving-1896/demo"} + record=MODULE.inspect_consumer(entry,fake_get) + self.assertEqual(record["status"],"complete") + self.assertEqual(record["default_branch"],"trunk") + self.assertEqual(record["head"],"a"*40) + self.assertEqual(record["gitlinks"],[{"path":"vendor/child","commit":"d"*40}]) + self.assertEqual(record["counts"]["directories"],3) + self.assertEqual({d["path"] for d in record["directories"]["directories"]},{"vendor","vendor/child","src"}) + self.assertIn("vendor/child",record["gitmodules"]["content"]) + self.assertEqual(len(calls),4) + + def test_gitmodules_parser_preserves_path_and_url_metadata(self): + parsed = MODULE.parse_gitmodules_paths('[submodule "child"]\n\tpath = vendor/child\n\turl = https://example.invalid/child.git\n') + self.assertEqual(parsed["vendor/child"]["name"], "child") + self.assertEqual(parsed["vendor/child"]["url"], "https://example.invalid/child.git") + + def test_manifest_reconciliation_reports_divergence_without_mutation(self): + result = MODULE.reconcile_remote_manifest( + {"submodules":[{"name":"child","path":"modules/child"}], + "subtrees":[{"name":"vendor","prefix":"vendor/project"}]}, + {"modules/other":{}}, + {"modules/other","vendor/orphan"}, + {"vendor/project"}, + ) + kinds = {item["kind"] for item in result["findings"]} + self.assertIn("manifest_submodule_missing_gitmodules", kinds) + self.assertIn("gitmodules_submodule_missing_manifest", kinds) + self.assertIn("manifest_submodule_missing_gitlink", kinds) + self.assertIn("gitlink_missing_manifest_submodule", kinds) + self.assertFalse(result["consistent"]) + + def test_inaccessible_or_missing_is_not_reported_as_absent(self): + def missing(_): + raise MODULE.ApiError(404,"Not Found") + entry={"name":"demo","repository":"Interested-Deving-1896/demo"} + self.assertEqual(MODULE.inspect_consumer(entry,missing)["status"],"not_found_or_inaccessible") + + def test_truncated_tree_is_partial_unavailable(self): + def fake_get(path): + if path.endswith("/demo"): + return {"default_branch":"main"} + if path.endswith("/commits/main"): + return {"sha":"a"*40,"commit":{"tree":{"sha":"b"*40}}} + return {"truncated":True,"tree":[]} + entry={"name":"demo","repository":"Interested-Deving-1896/demo"} + record=MODULE.inspect_consumer(entry,fake_get) + self.assertEqual(record["status"],"unavailable") + + def test_report_coverage_excludes_disabled_from_query_count(self): + entries=[ + {"name":"demo","repository":"Interested-Deving-1896/demo","disabled":True}, + ] + report=MODULE.build_report(entries,lambda _: {}) + self.assertEqual(report["queried_repositories"],0) + self.assertEqual(report["coverage"]["incomplete"],0) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_audit_submodule_directory.py b/tests/test_audit_submodule_directory.py new file mode 100644 index 000000000..f0bf391b5 --- /dev/null +++ b/tests/test_audit_submodule_directory.py @@ -0,0 +1,98 @@ +import importlib.util +import subprocess +import tempfile +import unittest +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location( + "audit_submodule_directory", ROOT / "scripts" / "audit-submodule-directory.py" +) +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader +SPEC.loader.exec_module(MODULE) + + +def run(repo, *args): + subprocess.run(["git", *args], cwd=repo, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + +class AuditSubmoduleDirectoryTests(unittest.TestCase): + def make_repo(self, active=True, manifest_entry=True): + temp = tempfile.TemporaryDirectory() + repo = Path(temp.name) + run(repo, "init", "-q") + run(repo, "config", "user.email", "test@example.com") + run(repo, "config", "user.name", "Test") + (repo / "config").mkdir() + (repo / "scripts").mkdir() + (repo / "scripts" / "check.sh").write_text("#!/bin/sh\nexit 0\n") + (repo / "vendor" / "demo").mkdir(parents=True) + (repo / ".gitmodules").write_text( + '[submodule "demo"]\n\tpath = vendor/demo\n' + '\turl = https://github.com/example/demo.git\n' + ) + manifest = "subtrees: []\nsubmodules:\n" + if manifest_entry: + manifest += ( + " - name: demo\n url: https://github.com/example/demo\n" + " path: vendor/demo\n" + ) + (repo / "config" / "subtree-manifest.yml").write_text(manifest) + run(repo, "add", ".") + if active: + run(repo, "update-index", "--add", "--cacheinfo", "160000," + "a" * 40 + ",vendor/demo") + run(repo, "commit", "-qm", "fixture") + return temp, repo + + def test_clean_manifest_gitmodules_and_gitlink_reconcile(self): + temp, repo = self.make_repo() + self.addCleanup(temp.cleanup) + report = MODULE.audit(repo) + self.assertEqual(report["status"], "clean") + self.assertEqual(report["summary"]["gitlinks"], 1) + self.assertTrue(report["read_only"]) + + def test_declared_submodule_without_gitlink_is_blocked(self): + temp, repo = self.make_repo(active=False) + self.addCleanup(temp.cleanup) + report = MODULE.audit(repo) + self.assertEqual(report["status"], "blocked") + self.assertIn("manifest_submodule_missing_gitlink", {x["code"] for x in report["findings"]}) + + def test_gitlink_without_manifest_entry_is_blocked(self): + temp, repo = self.make_repo(manifest_entry=False) + self.addCleanup(temp.cleanup) + report = MODULE.audit(repo) + self.assertEqual(report["status"], "blocked") + self.assertIn("gitlink_missing_manifest_entry", {x["code"] for x in report["findings"]}) + + def test_directory_classification_is_explicitly_unassigned(self): + temp, repo = self.make_repo() + self.addCleanup(temp.cleanup) + report = MODULE.audit(repo) + records = {x["path"]: x for x in report["directories"]} + self.assertEqual(records["scripts"]["classification"], "first_party_tooling") + self.assertEqual(records["vendor"]["classification"], "vendored_or_imported") + self.assertEqual(records["scripts"]["ownership"], "unassigned") + self.assertEqual(records["vendor/demo"]["classification"], "vendored_or_imported") + self.assertEqual(records["vendor/demo"]["ownership"], "unassigned") + + def test_url_normalization_preserves_case_sensitive_paths(self): + self.assertEqual( + MODULE.canonical_url("git@github.com:Example/Repo.git"), + "https://github.com/Example/Repo", + ) + self.assertEqual( + MODULE.canonical_url("https://gitlab.example/Group/Repo.git"), + "https://gitlab.example/Group/Repo", + ) + self.assertNotEqual( + MODULE.canonical_url("https://gitlab.example/Group/Repo.git"), + MODULE.canonical_url("https://gitlab.example/group/repo.git"), + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_check_markdown_links.py b/tests/test_check_markdown_links.py index 68852afa5..41567970c 100644 --- a/tests/test_check_markdown_links.py +++ b/tests/test_check_markdown_links.py @@ -125,5 +125,22 @@ def opener(request, timeout): self.assertEqual(result, (True, 403, 1, "allowed status")) + def test_audit_reports_403_as_inconclusive_without_failing(self): + from unittest.mock import patch + occurrence = self.module.LinkOccurrence( + "https://example.com/community", "README.md", 12 + ) + with patch.object( + self.module, "check_url", return_value=(False, 403, 1, "HTTP 403") + ): + report = self.module.audit([occurrence], 3.0, 1, 0.0, 1) + self.assertTrue(report["healthy"]) + result = report["results"][0] + self.assertEqual(result["classification"], "blocked_or_restricted") + self.assertFalse(result["blocking"]) + rendered = self.module.render_markdown(report) + self.assertIn("Inconclusive or restricted responses", rendered) + self.assertIn("HTTP status", rendered) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_declared_source_scope.py b/tests/test_declared_source_scope.py new file mode 100644 index 000000000..ab30ad03e --- /dev/null +++ b/tests/test_declared_source_scope.py @@ -0,0 +1,81 @@ +import json +import tempfile +import unittest +from pathlib import Path + +import yaml +import importlib.util + +SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "build-declared-source-scope.py" +SPEC = importlib.util.spec_from_file_location("declared_source_scope", SCRIPT) +MODULE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(MODULE) +build_scope = MODULE.build_scope + + +class DeclaredSourceScopeTests(unittest.TestCase): + def make_root(self, root: Path) -> None: + (root / "config").mkdir() + (root / "registered-imports.json").write_text(json.dumps([ + {"source_url": "https://github.com/acme/lib.git", "target_name": "lib", "platform": "github"}, + {"source_url": "https://gitlab.com/group/tool.git", "target_name": "tool", "platform": "gitlab"}, + ])) + (root / "config/template-consumers.yml").write_text(yaml.safe_dump({ + "consumers": [{"name": "consumer"}, {"name": "other-org/consumer"}] + })) + (root / "config/live-chain-manifest.json").write_text(json.dumps({ + "source": {"namespace": "source-org"}, + "mirrors": [{"platform": "github", "namespace": "mirror-org"}], + "projects": [{"name": "consumer", "readme_policy": "managed"}], + })) + (root / ".gitmodules").write_text( + '[submodule "lib"]\n\tpath = vendor/lib\n\turl = https://github.com/acme/lib.git\n' + ) + (root / "config/subtree-manifest.yml").write_text( + "subtrees:\n - name: docs\n remote: https://github.com/acme/docs.git\n prefix: vendor/docs\n" + ) + (root / "config/gitlab-mirror-sources.yml").write_text("sources: []\n") + (root / "config/gitlab-subgroups.yml").write_text("subgroups:\n ops:\n path: openos-project/ops\n repos: [lib]\n") + (root / "config/gitlab-subgroups-ooc.yml").write_text("subgroups: {}\n") + (root / "config/shell-tools-registry.yml").write_text( + "tools:\n - repo: helper\n upstream: https://github.com/acme/helper\n" + ) + + def test_unions_sources_and_preserves_multiple_declarations(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + self.make_root(root) + report = build_scope(root) + repos = {(x["platform"], x["repository"]): x for x in report["repositories"]} + lib = repos[("github", "acme/lib")] + self.assertEqual( + {d["registry"] for d in lib["declarations"]}, + {"registered-imports.json", ".gitmodules"}, + ) + self.assertIn(("github", "Interested-Deving-1896/lib"), repos) + self.assertIn(("gitlab", "group/tool"), repos) + self.assertIn(("github", "source-org/consumer"), repos) + self.assertIn(("github", "mirror-org/consumer"), repos) + self.assertIn(("github", "acme/docs"), repos) + self.assertIn(("github", "acme/helper"), repos) + self.assertIn(("gitlab", "openos-project/ops/lib"), repos) + self.assertTrue(report["read_only"]) + self.assertFalse(report["network_access"]) + + def test_scope_is_deterministic(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + self.make_root(root) + first = build_scope(root) + second = build_scope(root) + self.assertEqual(first, second) + + def test_missing_inputs_are_explicit(self): + with tempfile.TemporaryDirectory() as directory: + report = build_scope(Path(directory)) + self.assertEqual(report["repository_count"], 0) + self.assertTrue(report["missing_inputs"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_directory_inventory.py b/tests/test_directory_inventory.py new file mode 100644 index 000000000..a9ee5f40d --- /dev/null +++ b/tests/test_directory_inventory.py @@ -0,0 +1,43 @@ +import importlib.util +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("directory_inventory", ROOT / "scripts" / "directory_inventory.py") +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader +SPEC.loader.exec_module(MODULE) + + +class DirectoryInventoryTests(unittest.TestCase): + def test_classification_is_conservative_and_path_only(self): + self.assertEqual(MODULE.classify_directory("src/kernel"), "source_candidate_unverified") + self.assertEqual(MODULE.classify_directory("vendor/libfoo"), "vendored_or_imported_candidate") + self.assertEqual(MODULE.classify_directory("build/output"), "generated_or_cache_candidate") + self.assertEqual(MODULE.classify_directory("unknown/area"), "unclassified") + + def test_inventory_counts_tracked_entries_and_gitlinks(self): + report = MODULE.inventory_directories([ + {"path": "src/main.py", "type": "blob", "mode": "100644"}, + {"path": "src/lib/util.py", "type": "blob", "mode": "100644"}, + {"path": "src/child", "type": "commit", "mode": "160000"}, + {"path": "docs/readme.md", "type": "blob", "mode": "100644"}, + {"path": "src", "type": "tree", "mode": "040000"}, + ]) + by_path = {item["path"]: item for item in report["directories"]} + self.assertEqual(report["directory_count"], 4) + self.assertEqual(by_path["src"]["tracked_entries"], 3) + self.assertEqual(by_path["src"]["blobs"], 2) + self.assertEqual(by_path["src"]["gitlinks"], 1) + self.assertEqual(by_path["src/child"]["tracked_entries"], 1) + self.assertEqual(by_path["src/child"]["gitlinks"], 1) + self.assertEqual(by_path["src/child"]["ownership"], "unassigned") + self.assertEqual(by_path["src/child"]["provenance"], "unknown") + self.assertTrue(by_path["src/child"]["classification_is_heuristic"]) + + def test_empty_tree_has_empty_directory_inventory(self): + self.assertEqual(MODULE.inventory_directories([])["directories"], []) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_external_services.py b/tests/test_external_services.py new file mode 100644 index 000000000..8e1d9b946 --- /dev/null +++ b/tests/test_external_services.py @@ -0,0 +1,40 @@ +"""Offline tests for the shared external-services result contract.""" +from datetime import datetime, timezone +import unittest + +from scripts.external_services import Outcome, classify_http_status, classify_transport_failure, is_non_blocking_outcome, retry_after_seconds + + +class ExternalServicesTests(unittest.TestCase): + def test_status_classes_are_distinct(self): + self.assertEqual(classify_http_status(204).outcome, Outcome.REACHABLE) + self.assertEqual(classify_http_status(404).outcome, Outcome.NOT_FOUND) + self.assertEqual(classify_http_status(410).outcome, Outcome.NOT_FOUND) + self.assertEqual(classify_http_status(403).outcome, Outcome.BLOCKED_OR_RESTRICTED) + self.assertEqual(classify_http_status(429).outcome, Outcome.RATE_LIMITED) + self.assertEqual(classify_http_status(503).outcome, Outcome.TRANSIENT_FAILURE) + + def test_blocked_is_visible_but_not_a_dead_link(self): + result = classify_http_status(403) + self.assertIn("validity is unknown", result.reason) + self.assertTrue(is_non_blocking_outcome(result.outcome)) + self.assertFalse(is_non_blocking_outcome(Outcome.NOT_FOUND)) + + def test_retry_after_delta_seconds(self): + self.assertEqual(retry_after_seconds({"Retry-After": "12"}), 12.0) + + def test_retry_after_http_date(self): + now = datetime(2026, 1, 1, tzinfo=timezone.utc) + self.assertEqual(retry_after_seconds({"retry-after": "Thu, 01 Jan 2026 00:00:10 GMT"}, now), 10.0) + + def test_invalid_retry_after_is_ignored(self): + self.assertIsNone(retry_after_seconds({"Retry-After": "not-a-date"})) + + def test_transport_failure_is_retryable(self): + result = classify_transport_failure("timeout") + self.assertEqual(result.outcome, Outcome.TRANSIENT_FAILURE) + self.assertTrue(result.retryable) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_fleet_engine_contract.py b/tests/test_fleet_engine_contract.py new file mode 100644 index 000000000..ff0bc56bc --- /dev/null +++ b/tests/test_fleet_engine_contract.py @@ -0,0 +1,50 @@ +"""Safety invariants for the initial Fleet Engine contract.""" + +import json +from pathlib import Path +import unittest + + +ROOT = Path(__file__).resolve().parents[1] +CONFIG = ROOT / "config" / "fleet-engine.json" +SCHEMA = ROOT / "schema" / "fleet-engine.schema.json" + + +class FleetEngineContractTests(unittest.TestCase): + def setUp(self): + self.config = json.loads(CONFIG.read_text(encoding="utf-8")) + self.schema = json.loads(SCHEMA.read_text(encoding="utf-8")) + + def test_contract_is_versioned_and_audit_only(self): + self.assertEqual(self.config["schema_version"], 1) + self.assertEqual(self.config["mode"], "audit-only") + self.assertEqual(self.schema["$schema"], "https://json-schema.org/draft/2020-12/schema") + + def test_default_policy_fails_closed(self): + policy = self.config["policy"] + self.assertEqual(policy["default_disposition"], "unresolved") + self.assertEqual(policy["default_write_authority"], "none") + self.assertIs(policy["registry_membership_grants_write"], False) + self.assertEqual(policy["unknown_operation"], "deny") + self.assertEqual(policy["protected_or_conflicted_write"], "deny") + + def test_inventory_starts_empty_without_implied_targets(self): + self.assertEqual(self.config["repositories"], []) + + def test_source_dimensions_are_explicit_and_separate(self): + sources = {item["id"]: item for item in self.config["sources"]} + self.assertEqual(sources["template-consumers"]["authoritative_for"], ["template-membership"]) + self.assertEqual(sources["registered-imports"]["authoritative_for"], ["import-provenance"]) + self.assertEqual(sources["live-chain-manifest"]["authoritative_for"], ["mirror-role"]) + self.assertEqual(sources["readme-subsystem"]["authoritative_for"], ["readme-ownership", "artifact-ownership"]) + self.assertEqual(sources["gitlab-subgroups"]["authoritative_for"], ["placement"]) + self.assertIn("fall back", sources["gitlab-subgroups"]["meaning"]) + + def test_profile_chain_content_owner_is_not_redefined(self): + readme = next(item for item in self.config["sources"] if item["id"] == "readme-subsystem") + self.assertIn("artifact ownership", readme["meaning"]) + self.assertIn("does not independently establish", self.config["sources"][0]["meaning"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_linktree_engine.py b/tests/test_linktree_engine.py new file mode 100644 index 000000000..41ed370a6 --- /dev/null +++ b/tests/test_linktree_engine.py @@ -0,0 +1,55 @@ +"""Offline tests for the provider-neutral Linktree profile engine.""" +import json +from pathlib import Path +import tempfile +import unittest + +from scripts.linktree_engine import render_profile, validate_profile + +ROOT = Path(__file__).resolve().parents[1] + +class LinktreeEngineTests(unittest.TestCase): + def setUp(self): + self.profile = json.loads((ROOT / "examples" / "linktree-profile.example.json").read_text(encoding="utf-8")) + + def test_example_profile_is_valid(self): + self.assertEqual(validate_profile(self.profile), []) + + def test_rejects_unsafe_link_scheme(self): + self.profile["links"][0]["url"] = "javascript:alert(1)" + self.assertTrue(any("absolute HTTP(S)" in error for error in validate_profile(self.profile))) + + def test_rejects_embedded_credentials(self): + self.profile["links"][0]["url"] = "https://user:pass@example.com/" + self.assertTrue(any("absolute HTTP(S)" in error for error in validate_profile(self.profile))) + + def test_rejects_duplicate_ids(self): + self.profile["links"].append(dict(self.profile["links"][0])) + self.assertTrue(any("must be unique" in error for error in validate_profile(self.profile))) + + def test_rejects_invalid_theme_color(self): + self.profile["theme"]["accent"] = "red" + self.assertTrue(any("theme.accent" in error for error in validate_profile(self.profile))) + + def test_renderer_escapes_user_content_and_emits_accessible_links(self): + self.profile["name"] = "" + self.profile["links"][0]["label"] = "A & B" + page, css = render_profile(self.profile) + self.assertIn("<script>", page) + self.assertNotIn("", page) + self.assertIn('rel="noopener noreferrer"', page) + self.assertIn('aria-label="Profile links"', page) + self.assertIn("prefers-reduced-motion", css) + + def test_render_command_outputs_two_static_files(self): + from scripts.linktree_engine import main + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) / "profile.json" + output = Path(directory) / "site" + source.write_text(json.dumps(self.profile), encoding="utf-8") + self.assertEqual(main(["render", str(source), "--output", str(output)]), 0) + self.assertTrue((output / "index.html").is_file()) + self.assertTrue((output / "style.css").is_file()) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_manage_subtrees_safety.py b/tests/test_manage_subtrees_safety.py new file mode 100644 index 000000000..4be50a12f --- /dev/null +++ b/tests/test_manage_subtrees_safety.py @@ -0,0 +1,35 @@ +import os +import subprocess +import tempfile +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +SCRIPT = ROOT / "scripts" / "manage-subtrees.sh" + + +class ManageSubtreesSafetyTests(unittest.TestCase): + def test_mutation_commands_fail_closed(self): + with tempfile.TemporaryDirectory() as tmp: + manifest = Path(tmp) / "manifest.yml" + manifest.write_text("subtrees: []\nsubmodules: []\numbrella:\n enabled: false\n", encoding="utf-8") + env = os.environ.copy() + env.update({"MANIFEST": str(manifest), "DRY_RUN": "false"}) + for command in ("sync", "umbrella-init", "update-submodules", "add-subtree", "pull-subtree", "add-submodule"): + result = subprocess.run(["bash", str(SCRIPT), command], env=env, text=True, capture_output=True) + self.assertNotEqual(result.returncode, 0, command) + self.assertIn("disabled pending writer-safety remediation", result.stderr) + + def test_status_remains_read_only_and_available(self): + with tempfile.TemporaryDirectory() as tmp: + manifest = Path(tmp) / "manifest.yml" + manifest.write_text("subtrees: []\nsubmodules: []\numbrella:\n enabled: false\n", encoding="utf-8") + env = os.environ.copy() + env.update({"MANIFEST": str(manifest), "DRY_RUN": "false"}) + result = subprocess.run(["bash", str(SCRIPT), "status"], env=env, text=True, capture_output=True) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn("Subtree status", result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_plan_submodule_repairs.py b/tests/test_plan_submodule_repairs.py new file mode 100644 index 000000000..431ac9c55 --- /dev/null +++ b/tests/test_plan_submodule_repairs.py @@ -0,0 +1,70 @@ +import importlib.util +import unittest + +SPEC = importlib.util.spec_from_file_location( + "submodule_repair_plan", + "scripts/plan-submodule-repairs.py", +) +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader +SPEC.loader.exec_module(MODULE) + + +class RepairPlanTests(unittest.TestCase): + def record(self, content, links, status="warning"): + return { + "repository": "ExampleOrg/demo", + "status": status, + "head": "a" * 40, + "tree": "b" * 40, + "gitmodules": {"present": bool(content), "blob_sha": "c" * 40, "content": content, "error": None}, + "gitlinks": links, + } + + def test_declaration_without_gitlink_is_review_only(self): + record = self.record('[submodule "child"]\n path = vendor/child\n url = https://github.com/Example/Child.git\n', []) + result = MODULE.plan_repository(record) + self.assertEqual(result["status"], "review_required") + self.assertEqual(result["suggestions"][0]["code"], "declaration_without_gitlink") + self.assertIsNone(result["suggestions"][0]["proposed_mutation"]) + self.assertEqual(result["expected_old_state"]["head"], "a" * 40) + + def test_gitlink_without_declaration_is_review_only(self): + result = MODULE.plan_repository(self.record(None, [{"path": "vendor/child", "commit": "d" * 40}])) + self.assertEqual(result["suggestions"][0]["code"], "gitlink_without_declaration") + self.assertIsNone(result["suggestions"][0]["proposed_mutation"]) + + def test_matching_declaration_and_gitlink_has_no_structural_suggestion(self): + content = '[submodule "child"]\n path = vendor/child\n url = https://github.com/Example/Child.git\n' + result = MODULE.plan_repository(self.record(content, [{"path": "vendor/child", "commit": "d" * 40}])) + self.assertEqual(result["status"], "no_structural_drift_detected") + self.assertEqual(result["suggestions"], []) + + def test_incomplete_inventory_is_blocked_not_clean(self): + result = MODULE.plan_repository(self.record(None, [], status="unavailable")) + self.assertEqual(result["status"], "blocked") + self.assertEqual(result["suggestions"], []) + + def test_unsafe_path_blocks_plan(self): + content = '[submodule "bad"]\n path = ../outside\n url = https://example.com/repo.git\n' + result = MODULE.plan_repository(self.record(content, [])) + self.assertEqual(result["status"], "blocked") + self.assertEqual(result["suggestions"], []) + + def test_invalid_gitmodules_blocks_plan(self): + record = self.record('[submodule "bad"\n path = vendor/bad\n', []) + result = MODULE.plan_repository(record) + self.assertEqual(result["status"], "blocked") + + def test_plan_id_is_deterministic(self): + report = {"read_only": True, "schema_version": 1, "registry": "registry.yml", + "repositories": [self.record(None, [])]} + self.assertEqual(MODULE.build_plan(report)["plan_id"], MODULE.build_plan(report)["plan_id"]) + + def test_non_read_only_input_is_rejected(self): + with self.assertRaises(ValueError): + MODULE.build_plan({"read_only": False, "repositories": []}) + + +if __name__ == "__main__": + unittest.main()