Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions SESSION_FOCUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

*Current sprint, SDK status, and active work. Updated by operator and autonomous sessions.*

*Last updated: 2026-05-14 (Sprint 52)*
*Last updated: 2026-05-15 (Sprint 53)*

---

## Current Sprint

**See `docs/SPRINT.md` for full sprint plan and task details.** Do not duplicate sprint content here — SPRINT.md is the source of truth for task scope, status, and dependencies.

### Sprint 53 Summary: SDK v0.27.0 Release Housekeeping (COMPLETE)

| Task | Status | Notes |
|------|--------|-------|
| T1: v0.27.0 release housekeeping | DONE | Version bump 0.26.0->0.27.0. CHANGELOG for Sprints 41-42, 50-52. Added missing `validate_minimum_viable` export + `role` module to CLI info/selftest (was 22, now 23 modules). Updated README, quickstart, test assertions. 0 new files. 369 exports. 2709 tests. |

### Sprint 52 Summary: Conformance Test Vector Runner (COMPLETE)

| Task | Status | Notes |
Expand Down Expand Up @@ -206,11 +212,11 @@ See `docs/SPRINT.md` for full history. Highlights: JSON-LD serialization for all

## SDK Status

- **Version**: 0.26.0
- **Version**: 0.27.0
- **Modules**: 23 library modules + MCP server entry point (trust, lct, atp, federation, r6, mrh, acp, dictionary, entity, capability, errors, metabolic, binding, society, role, reputation, security, protocol, mcp, attestation, validation, deserialize, generate, mcp_server)
- **Tests**: 2709 total (2701 passing, 8 xfailed conformance gaps)
- **CLI**: `web4 info/validate/list-schemas/roundtrip/generate/selftest/trust` (7 subcommands)
- **Exports**: 368 symbols via `web4/__init__.py`
- **Exports**: 369 symbols via `web4/__init__.py`
- **from_dict()**: 58 classmethods across 10 modules — all classes with to_dict()/as_dict() have matching from_dict()
- **Dispatcher**: 23 types via `web4.from_jsonld()` (19 class-based + 3 function-based + TrustQuery)
- **Generator**: 23 types via `web4.generate()` — minimal valid JSON-LD documents
Expand Down Expand Up @@ -284,7 +290,7 @@ Sprint 50 T1 PR pending.

## Completeness Summary

- All 52 sprints COMPLETE (Sprints 1-52, all merged or PR pending)
- All 53 sprints COMPLETE (Sprints 1-53, all merged or PR pending)
- All 9 JSON-LD schemas with cross-language validation vectors (278 total, in pytest)
- All `to_jsonld()` functions have `from_jsonld()` inverses (API symmetry complete)
- All `to_dict()`/`as_dict()` methods have `from_dict()` inverses (58 round-trip methods total)
Expand Down Expand Up @@ -320,4 +326,4 @@ Sprint 50 T1 PR pending.

---

*Updated by autonomous session, 2026-05-14 (Sprint 52conformance test vector runner)*
*Updated by autonomous session, 2026-05-15 (Sprint 53SDK v0.27.0 release housekeeping)*
35 changes: 34 additions & 1 deletion docs/SPRINT.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
# Web4 Sprint Plan

**Created**: 2026-03-14
**Updated**: 2026-05-14 (Sprint 52)
**Updated**: 2026-05-15 (Sprint 53)
**Phase**: Development
**Track**: web4 (Legion)

---

## Sprint 53: SDK v0.27.0 Release Housekeeping (2026-05-15)

Version bump and documentation update consolidating Sprints 41-42 and 50-52
into a coherent release marker. Covers the Society Roles module (Sprint 50),
Constraint alignment (Sprint 51), conformance test runner (Sprint 52),
dead code removal (Sprint 41), and CI quickstart smoke (Sprint 42).

### T1: v0.27.0 release housekeeping
**Status**: DONE
**Completed**: 2026-05-15
**Authorized by**: Established release housekeeping pattern (Sprints 21, 23,
26, 31, 33, 34, 39). Policy-reviewed and approved.
**Scope**:
1. Version bump 0.26.0 -> 0.27.0 in `pyproject.toml`.
2. CHANGELOG entry for v0.27.0 covering Sprints 41-42, 50-52.
3. `__init__.py` docstring: corrected stale counters (tests 2668->2709),
added v0.27.0 version note, added missing `validate_minimum_viable` export.
4. `__main__.py`: added `role` to both `_cmd_info` and `_SELFTEST_MODULES`
module lists (was 22, now 23 — Sprint 50 added `web4/role.py` but the
CLI lists were not updated).
5. README: version, module count (22->23), export count (364->369), test
count (2613->2709), added `role` row to module table, project structure
section updated.
6. `examples/quickstart.py`: docstring version.
7. Test assertions: version strings in `test_cli.py` and `test_package_api.py`,
module count assertions (22->23).
8. `docs/SPRINT.md` and `SESSION_FOCUS.md` updated.

**Result**: 0 new files, 0 new exports beyond the missing `validate_minimum_viable`
(369 total). All version references consistent. CLI now reports 23 modules.

---

## Sprint 52: Conformance Test Vector Runner (2026-05-14)

Wires the operator-created conformance test vectors (`web4-standard/testing/
Expand Down
35 changes: 35 additions & 0 deletions web4-standard/implementation/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

All notable changes to the Web4 Python SDK.

## [0.27.0] - 2026-05-15

Sprints 41-42, 50-52: Society roles, constraint alignment, conformance test runner, cleanup.

### Added
- **Society Roles module** (Sprint 50 T1, PR #185) — new `web4/role.py` module (23rd SDK
module). `SocietyRole` enum (7 base-mandatory + 2 context-mandatory roles), `RoleAssignment`
dataclass (role-LCT binding, T3/V3 per role, rotation, multi-holder support),
`bootstrap_society_roles()` (solo-founder genesis per inter-society-protocol.md §2.1).
4 new exports (368 total at time of merge). 43 new tests.
- **`validate_minimum_viable()` function** (Sprint 51 T1, PR #187) — validates society
role assignments against inter-society-protocol.md §6.2 requirements: base-mandatory
completeness, internal differentiation (>=2 fillers when operational), witnessing
capacity (Witness or Auditor). Cross-language parity with Rust
`Society::validate_minimum_viable()`. 1 new export.
- **Conformance test runner** (Sprint 52 T1, PR #189) — `tests/test_conformance.py`
exercising 35 operator-created cross-language conformance vectors from 4 suites:
tensor ops (8), ATP (11), R6/R7 (8), society/roles (8). 39 new tests (31 pass,
8 xfailed conformance gaps documenting genuine cross-language divergences).
- **CI quickstart smoke** (Sprint 42 T1) — `examples/quickstart.py` now runs in the
CI `wheel` job against the installed wheel. API breakage in the quickstart fails CI.

### Changed
- **`Constraint` dataclass aligned with Rust** (Sprint 51 T1, PR #187) — `value: Any`
replaced with `threshold: float` + `hard: bool = True`. Updated serialization,
JSON schemas, and test vectors. Cross-language parity with Rust `Constraint`.
- **`role` module added to CLI `info` and `selftest`** — `web4 info` now reports 23
modules (was 22). `web4 selftest` now verifies `web4.role` import.
- Version bumped from 0.26.0 to 0.27.0.
- 2709 tests (2701 passed, 8 xfailed). 369 exports. 23 modules + MCP server.

### Removed
- **Dead `web4_sdk.py` removed** (Sprint 41 T1) — async HTTP client for nonexistent
services, not distributed in wheel. Deleted along with its 14 tests.

## [0.26.0] - 2026-04-17

Sprints 35, 37, 38: CI quality gate hardening — strict mypy, ruff lint, ruff format.
Expand Down
17 changes: 9 additions & 8 deletions web4-standard/implementation/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ specified in the [web4-standard](https://github.com/dp-web4/web4) and works with
network services — no async, no HTTP, no external dependencies beyond the Python
standard library.

**Version**: 0.26.0 | **Python**: 3.10+ | **License**: AGPL-3.0-or-later | **Typed**: PEP 561
**Version**: 0.27.0 | **Python**: 3.10+ | **License**: AGPL-3.0-or-later | **Typed**: PEP 561

## Installation

Expand Down Expand Up @@ -55,7 +55,7 @@ assert reconstructed.talent == trust.talent

## Modules

The SDK contains 22 modules, all importable from the `web4` namespace:
The SDK contains 23 modules, all importable from the `web4` namespace:

| Module | Description | Key Types |
|--------|-------------|-----------|
Expand All @@ -74,6 +74,7 @@ The SDK contains 22 modules, all importable from the `web4` namespace:
| `metabolic` | Society operational modes and energy effects | `MetabolicState`, `MetabolicProfile` |
| `binding` | Multi-device constellation management | `DeviceConstellation`, `DeviceRecord` |
| `society` | Core organizational primitive | `SocietyState`, `Treasury`, `SocietyLedger` |
| `role` | Society role taxonomy and role-LCT binding | `SocietyRole`, `RoleAssignment`, `bootstrap_society_roles` |
| `security` | Crypto suites, W4ID identifiers, key policies | `W4ID`, `CryptoSuite`, `SignatureEnvelope` |
| `protocol` | Handshake, transport, discovery, Web4 URIs | `Web4URI`, `Transport`, `ClientHello` |
| `mcp` | MCP context headers, sessions, ATP metering | `MCPSession`, `Web4Context` |
Expand All @@ -82,7 +83,7 @@ The SDK contains 22 modules, all importable from the `web4` namespace:
| `deserialize` | Generic JSON-LD deserialization dispatcher | `from_jsonld`, `from_jsonld_string`, `supported_types` |
| `generate` | Produce minimal valid JSON-LD documents | `generate`, `generate_string`, `available_types` |

364 symbols are exported from `web4.__init__`. All 22 submodules have `__all__` declarations.
369 symbols are exported from `web4.__init__`. All 23 submodules have `__all__` declarations.

## MCP Server

Expand Down Expand Up @@ -185,13 +186,13 @@ python -m pytest tests/ --cov=web4
mypy --strict web4/
```

2613 tests, 97.8% coverage, mypy strict zero-error, CI across Python 3.10-3.13.
2709 tests, 97.8% coverage, mypy strict zero-error, CI across Python 3.10-3.13.

## Project Structure

```
web4/ # Python package (22 modules + MCP server)
__init__.py # 364 re-exports
web4/ # Python package (23 modules + MCP server)
__init__.py # 369 re-exports
__main__.py # CLI entry point (web4 info/validate/list-schemas/roundtrip/generate/selftest/trust)
mcp_server.py # MCP server entry point (web4-mcp)
py.typed # PEP 561 marker
Expand All @@ -200,8 +201,8 @@ web4/ # Python package (22 modules + MCP server)
deserialize.py # Generic JSON-LD dispatcher (23 types)
generate.py # Minimal valid JSON-LD document generation
validation.py # Schema validation
... # (17 more modules)
tests/ # 2613 tests
... # (18 more modules)
tests/ # 2709 tests
schemas/ # JSON Schemas + JSON-LD contexts
pyproject.toml # Package metadata (single version source)
```
Expand Down
2 changes: 1 addition & 1 deletion web4-standard/implementation/sdk/examples/quickstart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Quickstart for the web4 Python SDK v0.26.0.
"""Quickstart for the web4 Python SDK v0.27.0.

Demonstrates the three behavioral composition points of the current SDK:

Expand Down
2 changes: 1 addition & 1 deletion web4-standard/implementation/sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "web4"
version = "0.26.0"
version = "0.27.0"
description = "Web4 SDK — trust tensors, LCTs, ATP/ADP, federation (SAL), R7 actions, MRH, ACP, security, protocol types"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
10 changes: 5 additions & 5 deletions web4-standard/implementation/sdk/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def test_info_shows_version(self, capsys: pytest.CaptureFixture[str]) -> None:
out = capsys.readouterr().out
assert rc == 0
assert "web4" in out
assert "0.26.0" in out
assert "0.27.0" in out

def test_info_shows_module_count(self, capsys: pytest.CaptureFixture[str]) -> None:
rc = main(["info"])
out = capsys.readouterr().out
assert rc == 0
assert "Modules: 22" in out
assert "Modules: 23" in out

def test_info_shows_export_count(self, capsys: pytest.CaptureFixture[str]) -> None:
rc = main(["info"])
Expand Down Expand Up @@ -554,14 +554,14 @@ def test_selftest_passes(self, capsys: pytest.CaptureFixture[str]) -> None:
out = capsys.readouterr().out
assert rc == 0
assert "OK" in out
assert "22 modules" in out
assert "23 modules" in out
assert "23 types roundtripped" in out

def test_selftest_verbose(self, capsys: pytest.CaptureFixture[str]) -> None:
rc = main(["selftest", "--verbose"])
out = capsys.readouterr().out
assert rc == 0
assert "Modules: 22/22" in out
assert "Modules: 23/23" in out
assert "Schemas:" in out
assert "Roundtrip: 23/23" in out
assert "OK" in out
Expand Down Expand Up @@ -617,7 +617,7 @@ def test_no_args(self) -> None:
def test_info(self) -> None:
r = _run_cli(["info"])
assert r.returncode == 0
assert "0.26.0" in r.stdout
assert "0.27.0" in r.stdout

def test_validate_valid_doc(self) -> None:
from web4.trust import T3
Expand Down
4 changes: 2 additions & 2 deletions web4-standard/implementation/sdk/tests/test_package_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

class TestPackageVersion:
def test_version_string(self):
assert web4.__version__ == "0.26.0"
assert web4.__version__ == "0.27.0"

def test_version_accessible(self):
from web4 import __version__

assert __version__ == "0.26.0"
assert __version__ == "0.27.0"


class TestAllExports:
Expand Down
10 changes: 2 additions & 8 deletions web4-standard/implementation/sdk/tests/test_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,7 @@ def test_context_mandatory_excluded(self) -> None:
# ── validate_minimum_viable ───────────────────────────────────


def _make_assignment(
role: SocietyRole, filler: str = "entity-001"
) -> RoleAssignment:
def _make_assignment(role: SocietyRole, filler: str = "entity-001") -> RoleAssignment:
"""Helper to create a minimal RoleAssignment for testing."""
return RoleAssignment(
role=role,
Expand Down Expand Up @@ -528,11 +526,7 @@ def test_empty_roles_fails(self) -> None:

def test_missing_one_base_mandatory(self) -> None:
"""Missing a single base-mandatory role is reported."""
roles = [
_make_assignment(r)
for r in BASE_MANDATORY_ROLES
if r != SocietyRole.TREASURER
]
roles = [_make_assignment(r) for r in BASE_MANDATORY_ROLES if r != SocietyRole.TREASURER]
errors = validate_minimum_viable(roles)
assert len(errors) == 1
assert "treasurer" in errors[0]
Expand Down
6 changes: 4 additions & 2 deletions web4-standard/implementation/sdk/web4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
- Deserialization — generic JSON-LD dispatcher for all Web4 types
- Generation — produce minimal valid JSON-LD documents for any Web4 type

23 modules + MCP server, 369 exports, 2668 tests, 3 behavioral functions, 8 MCP tools, 7 CLI subcommands.
v0.26.0: CI quality gates (strict mypy, ruff lint, ruff format) enforced on every PR.
23 modules + MCP server, 369 exports, 2709 tests, 3 behavioral functions, 8 MCP tools, 7 CLI subcommands.
v0.27.0: Society roles, Constraint alignment, conformance test runner, validate_minimum_viable.
These modules define the canonical data types and algorithms specified in the web4-standard.
They work offline (no network services required) and are designed to be
imported by applications, services, and other SDKs that build on web4.
Expand Down Expand Up @@ -397,6 +397,7 @@
SocietyRole,
RoleAssignment,
bootstrap_society_roles,
validate_minimum_viable,
BASE_MANDATORY_ROLES,
)

Expand Down Expand Up @@ -817,6 +818,7 @@
"SocietyRole",
"RoleAssignment",
"bootstrap_society_roles",
"validate_minimum_viable",
"BASE_MANDATORY_ROLES",
# security
"CryptoSuiteId",
Expand Down
2 changes: 2 additions & 0 deletions web4-standard/implementation/sdk/web4/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _cmd_info(args: argparse.Namespace) -> int:
"metabolic",
"binding",
"society",
"role",
"reputation",
"security",
"protocol",
Expand Down Expand Up @@ -266,6 +267,7 @@ def _cmd_generate(args: argparse.Namespace) -> int:
"metabolic",
"binding",
"society",
"role",
"reputation",
"security",
"protocol",
Expand Down
10 changes: 2 additions & 8 deletions web4-standard/implementation/sdk/web4/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,12 @@ def validate_minimum_viable(
# 2. Internal differentiation — at least 2 distinct role-filling entities
unique_fillers = {ra.filling_entity_lct_id for ra in roles}
if len(unique_fillers) < 2:
errors.append(
"Minimum viable society requires at least 2 distinct"
" role-filling entities"
)
errors.append("Minimum viable society requires at least 2 distinct role-filling entities")

# 3. Witnessing capacity — Witness or Auditor role must be assigned
has_witness = SocietyRole.WITNESS in assigned_roles
has_auditor = SocietyRole.AUDITOR in assigned_roles
if not has_witness and not has_auditor:
errors.append(
"Minimum viable society requires witnessing capacity"
" (Witness or Auditor role)"
)
errors.append("Minimum viable society requires witnessing capacity (Witness or Auditor role)")

return errors
Loading