Commit Graph
147 Commits
Author SHA1 Message Date
marcopan 0cf09777f2 Fix session resume and PSD container configuration 2026-07-20 20:22:47 +02:00
marcopanandClaude Fable 5 c4951e2aa5 chore: hygiene pass — ruff clean, docs storage-model truth, replay /me, failSession log
Audit findings 6.1-6.4 + the audit's remediation plan itself
(docs/superpowers/plans/2026-07-20-full-audit-remediation-plan.md).

- ruff: 34 → 0 (unused imports/f-strings auto-fixed; E702 semicolon lines
  split in test files; one unused local dropped). Suite still 819 green.
- CLAUDE.md + PROJECT_STATE.md no longer claim "no database / settings in
  settings.json": the harness selects filesystem OR PostgreSQL session
  storage (repository.py, server mode), and settings flow through harness
  preferences with the JSON file as fallback only.
- tools/replay: stub /me (SPA boot was parsing the SPA's own HTML as JSON)
  and /runtime/prewarm.
- failSession best-effort persistence now logs its failure server-side
  instead of vanishing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 01:55:41 +02:00
marcopanandClaude Fable 5 1ab0015460 fix(harness): state-integrity pass — reopen order, atomic decision batch, bash anti-bypass
Audit findings 5.1-5.3.

5.1 `phase reopen` now appends `phase_reopened` BEFORE the artifact
teardown: a crash between the two used to leave later-phase artifacts
deleted with the ledger still at the old phase (resume entered a phase
missing its artifacts). The inverse half-state — reopened with stale later
artifacts — is benign. Order locked by tests/test_phase_reopen_order.py.

5.2 New `tht decision add-batch --doc -`: N substantive decisions in ONE
atomic ledger write (meta types and cte_approved stay on `decision add`;
strictest min-phase enforced). reviewer_schema_linking now builds the
complete curation set and persists it with a single add-batch call — a
mid-loop failure can no longer leave the audit ledger half-written, and a
retry cannot duplicate the first K decisions.

5.3 The anti-bypass hook now also blocks BASH mutations of protected
state (`echo >> review_decisions.jsonl`, `sed -i` on the manifest,
`cat > tht-gate.js`, python open('w'), mv/rm/tee/…): FORBIDDEN only
covered tht subcommands and the write/edit hook only covered pi's own
tools. Read-only access (cat/grep/tail/ls) stays allowed.

Also: knownDecisionTypes is defensive — a workflow meta declaring NO
emits at all (older tht, minimal stubs) skips pre-validation instead of
rejecting every substantive type; with emits present, unknown types are
still rejected before the widget (new L1 test).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 01:51:38 +02:00
marcopanandClaude Opus 4.6 6ee5bda7f0 feat: gate decision-type validation, force-advance, and frontend fixes
Gate (tht-gate.js):
- Pre-validate decision types against workflow.yaml before showing reviewer widget
- Reject decisions emitted by later phases (min-phase check)
- Copy top-level `kind` into artifact when model forgets it (prevents loop)
- Force-advance on reviewer_decide/schema_linking when advance:true — skip
  redundant reviewer_confirm gate

Backend:
- Emit agent_end on clean Pi exit (code 0 + bridge idle) instead of marking failed

Frontend:
- Strip <think> tags from transcript and activity panel
- Fix mermaid render with offscreen container + cleanup
- Graceful mermaid error: show source code instead of red error, fall back to table

Workflow:
- F2 now emits table_promoted and table_excluded (early schema linking decisions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-19 14:14:44 +02:00
marcopanandClaude Opus 4.8 9fbca06f7c feat(harness): make tht schema columns glob/pattern-aware
At F4 (schema_linking) a model asking for a whole table family, e.g.
`fact_sost_impianto_*`, used to hit a bare "tabella non nel catalogo" and stall
without recovering. Now a pattern (containing * ? [) resolves to every matching
catalog table and returns their columns (JSON becomes an array of per-table
objects); exact names keep the original single-object contract. A non-glob miss
also suggests sibling tables sharing the leading segment, to aid recovery.

Verified live: `fact_sost_impianto_*` resolves the 20-table family on the psd
catalog. Harness suite green (811 passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 13:24:20 +02:00
User 5cacf70a0d fix: bootstrap user preferences without invalidating DWH cache 2026-07-16 20:32:20 +02:00
User ccb3cf4aa9 test: cover user-owned session security boundaries 2026-07-16 19:16:58 +02:00
User 72db6b823d fix(harness): record postgres decision phases 2026-07-16 18:08:17 +02:00
User c1cddaa667 refactor(harness): route workflow persistence through repositories 2026-07-16 18:01:29 +02:00
User 259f021313 fix(harness): preserve session migration JSON errors 2026-07-16 17:35:54 +02:00
User 5dbb91390f feat(harness): persist server sessions in postgres 2026-07-16 17:31:04 +02:00
User 8f0154eb9e fix(harness): persist evidence artifact 2026-07-16 17:14:47 +02:00
User 8f364ec564 feat(harness): add local session repository 2026-07-16 17:11:22 +02:00
User 9d4e057426 fix: serialize decision ledger writes 2026-07-14 15:30:06 +02:00
User 333874a755 fix: make join approval atomic 2026-07-14 15:24:06 +02:00
User 6dbf93fff9 feat: harden runtime readiness and session workflow 2026-07-14 10:27:25 +02:00
User eb83cb8fc1 docs(state)+test(l2): deploy state snapshot + configurable L2 workspace path
PROJECT_STATE: sezione deploy Docker live (Profile A embedded portale, ruoli DB,
secrets, merge codex, fix load-bearing). L2 test: WORKSPACE da env THT_L2_WORKSPACE
(default path Mac) -> può girare ovunque, skip pulito se assente.
2026-07-12 23:11:20 +02:00
marcopan 09d50ac9bb fix(dwh): release snapshots before job startup 2026-07-12 07:34:56 +02:00
marcopan 4aae6c433d fix(dwh): bind snapshots to validated bytes 2026-07-12 07:31:46 +02:00
marcopan 2f6daaaea6 fix(dwh): anchor generation operations to lease fd 2026-07-12 07:26:10 +02:00
marcopan 24e61d5713 fix(preprocess): retain DWH root fd through lease 2026-07-12 07:12:28 +02:00
marcopan 4cf0adbdd2 fix(preprocess): initialize fresh DWH writers safely 2026-07-12 07:07:31 +02:00
marcopan 22e806a41b fix(preprocess): restrict DWH root claims to writers 2026-07-12 07:00:51 +02:00
marcopan c4dd6c8900 fix(preprocess): claim DWH roots atomically 2026-07-12 06:51:46 +02:00
marcopan 8110793f61 fix(evidence): make result summaries safe 2026-07-12 06:50:23 +02:00
marcopan b43075289e fix(preprocess): bind DWH artifacts to workspace 2026-07-12 06:46:06 +02:00
marcopan 0a2421c513 fix(evidence): bound reports and fail failed jobs 2026-07-12 06:45:19 +02:00
marcopan 03ee3ffda8 fix(evidence): validate active corpus artifacts 2026-07-12 06:35:27 +02:00
marcopan 5cc023f390 fix(evidence): harden unchanged job snapshot 2026-07-12 06:29:31 +02:00
marcopan 7d41c4cefc fix(preprocess): verify canonical generations and cleanup 2026-07-12 06:18:18 +02:00
marcopan 4a29086fe4 fix(preprocess): anchor DWH retention validation 2026-07-12 06:15:27 +02:00
marcopan 27697e5db2 fix(preprocess): ignore corrupt DWH retention entries 2026-07-12 06:11:40 +02:00
marcopan e6d44ba082 fix(evidence): close S3 and smoke safety gaps 2026-07-12 06:09:15 +02:00
marcopan efcb0deb31 fix(evidence): lock GC and preflight search ownership 2026-07-12 06:07:30 +02:00
marcopan d21aac9151 fix(evidence): validate ownership before all searches 2026-07-12 06:04:00 +02:00
marcopan c6966f3d15 fix(preprocess): harden S3 and real Compose jobs 2026-07-12 06:01:06 +02:00
marcopan 6bb158233f fix(preprocess): lease DWH generation reads 2026-07-12 05:58:12 +02:00
marcopan db35ddb041 fix(evidence): bind corpus to workspace identity 2026-07-12 05:57:23 +02:00
marcopan 78ff360882 fix(preprocess): reconcile durable DWH generations 2026-07-12 05:51:49 +02:00
marcopan 05accc1443 fix(evidence): isolate vectors by workspace 2026-07-12 05:50:59 +02:00
marcopan 24f6a5daa6 fix(preprocess): publish DWH artifacts atomically 2026-07-12 05:43:57 +02:00
marcopan 4028ef7821 feat(preprocess): add deployment jobs and S3 source 2026-07-12 05:42:07 +02:00
marcopan 6656a69630 fix(evidence): filter active data in every search 2026-07-12 05:40:45 +02:00
marcopan 92b1d3ccc3 fix(evidence): retain referenced vector generations 2026-07-12 05:34:47 +02:00
marcopan 3a9808f126 feat(preprocess): add resumable DWH jobs 2026-07-12 05:34:38 +02:00
marcopan 2624d1d342 test: assert removed evidence stays hidden 2026-07-12 05:26:11 +02:00
marcopan 9a9acbd122 test: gate real pgvector corpus lifecycle 2026-07-12 05:22:30 +02:00
marcopan 9e21cce036 test(evidence): harden generation lifecycle boundaries 2026-07-12 05:15:30 +02:00
marcopan 459ffa0bcd fix(evidence): reconcile generations safely 2026-07-12 05:10:19 +02:00
marcopan f3b49f41c8 feat(evidence): add safe retention and materialized reads 2026-07-12 05:02:47 +02:00