testing
Technical notes on web development, DevOps, and AI integration.
83 articles
- 10:53backend
Guard Before the Payload: Requirements Are Global-Write Only
A cross-module document checklist could be rewritten by any account holding a service write permission. The guard now refuses before reading the payload.
TL;DR: Permission gate was too narrow. Added scope check to write path. Guard now runs before validation.
#go#rbac#api - 03:20backend
A Guard That Refuses Before the Payload Is Read
The organisation module finally has an owner: one guard in the service layer, one fixed 403, and one sidebar group that follows the owner.
TL;DR: Commit 96e93ae adds a guard function to check write permissions. The function runs before validation and returns an error for unauthorized bidang. A test ensures the guard's position and prevents unauthorized repository access.
#go#rbac#authorization - 06:00testing
Catching leaked E2E rows with test.afterAll
An afterAll safety net for E2E rows left behind when a test times out: identity unique per worker, a sweep limited to owned and stale rows, idempotent delete.
TL;DR: A timed-out test skipped its DELETE step, leaving a stale row in the admin grid despite a passing spec. The fix adds an afterAll hook that cleans up rows even when tests fail or time out. It targets only this run's rows to avoid deleting data from other workers.
#playwright#testing#e2e - 02:39testing
One Admin Account per Scope, Then RBAC Checks Prove Something
Manual permission checks stalled because no admin account matched the scope. A closed CLI creates one per scope and proves it with a real login.
TL;DR: Authorization testing needs the right privilege. Admin accounts are created per bidang. The create-bidang-users command has three guards.
#testing#security#go - 23:05testing
Writing E2E Tests for a Page That Postpones Its Fetch
A 52-line E2E spec for a listing page that debounces 350 ms: zero waitForTimeout, assertions that retry on their own, and five data-testid hooks.
TL;DR: The listing page debounces client fetch by 350 milliseconds. Playwright's automatic retry replaces waitForTimeout. The test uses a 10-second assertion timeout.
#playwright#testing#typescript - 03:53tooling
The Auditor Uses the Same Ruler as the Gate
An audit report accused eight documentation commits of missing trailers; all eight were false positives. One filter line aligned the auditor with the gate.
TL;DR: The audit flagged nineteen commits missing Security-review trailers, but eight were false positives on QA and doc paths the commit gate has always exempt. Root cause: the auditor didn't share the gate's exemption list, so two versions of one policy drifted apart. Fix is a one-line filter reusing the gate's constant, proven red-first by a selftest.
#git#bash#testing - 03:01testing
Checksummed Evidence: Test Numbers Are Claims Until Verified
Raw verification output wrapped in a self-checksum makes agent numbers tamper-evident, while a fail-closed gate rejects slices without anchored review verdicts.
TL;DR: The author learned that an agent-reported "all tests passed" without raw output is a claim, not evidence. The fix: a shell script bundling command, output, and exit code, sealed with a self-verifying sha256 digest, plus a fail-closed gate requiring anchored review approvals. Honest limitation: same-session checksums only catch cheap forgery, not determined attackers.
#ai-agents#testing#qa - 00:58testing
The test that could not fail
An exit-code assertion can be satisfied by another path entirely. The fix pins the assertion to widened output.
TL;DR: A CLI feature test that only checks the exit code passed even after the feature was deleted, proving the assertion was vacuous. The fix captures stdout and asserts the seed actually widened into a known task ID. Lesson: assert on observable effects, not status codes.
#testing#python#mutation-testing - 23:53database
Down to Zero: The Rollback Path That Never Ran
Checkpoint v56 was built on an untested theory. Two down-file bugs, errors 1553 and 1364, surfaced the day down-to-0 ran again.
TL;DR: Migrations down to zero failed below checkpoint 56, disproving the untested ENUM theory behind it. Two rotted down files broke: a missing slug column and a dropped index that a foreign key depended on. A roundtrip test now proves the chain reversibility, replacing theory with measurable guarantees.
#database-migration#mysql#golang-migrate